Text generation
Gemma 4 31B
Generate streamed text and structured function calls with Gemma. Enable the model for your project, then use the API key you manage in the Wave dashboard.
Model ID: gemma4-bf16. Endpoint: POST https://api.dotwave.ai/v1/chat/completions.
Start a generation
Create an API key in API keys, keep it on your server and set DOTWAVE_API_KEY.
curl --no-buffer https://api.dotwave.ai/v1/chat/completions \
-H "Authorization: Bearer $DOTWAVE_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Session-Affinity: conversation-example-001" \
-d '{"model":"gemma4-bf16","messages":[{"role":"user","content":"Say hello in French."}],"stream":true,"max_tokens":80,"reasoning_effort":"none","stream_options":{"include_usage":true}}'Reuse X-Session-Affinity for every turn of the same conversation, with a different opaque ID for each new call. See the affinity rules.
Responses use server-sent events. Read text from choices[].delta.content, function calls from choices[].delta.tool_calls, and the final usage event before [DONE].
Parameters and limits
- Text messages and function tools; images, audio and video are not accepted.
stream: trueis required. Non-streaming requests are not supported.- Context: up to 32,768 tokens, including the prompt and generated response.
max_tokensormax_completion_tokens: 1–4,096; default 256.- Use
reasoning_effort: "none"for the voice-agent configuration.
Access hours and billing follow your project agreement. The dashboard shows your configured access hours and recorded usage.
Access and errors
Check GET /v1/models to see whether Gemma is enabled for your project. A valid key outside its service hours returns 403 service_closed. Creating another key preserves the project's access hours.
Unavailable generation returns a non-200 response before output begins. If a stream is interrupted after it begins, treat it as a failed generation. Wave does not retry the generation or select another provider for you.
See error handling and the API reference.