To start a Grok Voice 3.0 agent you open a WebSocket to wss://api.x.ai/v1/realtime?model=grok-voice-latest and send one session.update event with the voice, the system prompt and the tools. The builder above writes that event and the code around it from the options you pick, leaves out every setting that is already the default, and warns when a value breaks one of xAI's documented limits.
What the builder covers
Every field maps to a parameter in xAI's speech to speech docs (read 19 Oct 2026):
| Option in the builder | Parameter | Notes |
|---|---|---|
| Model | ?model= on the URL | grok-voice-latest is an alias for grok-voice-3.0; grok-voice-2.0 is deprecated |
| Voice | voice | any of the 28 built-in voices or a custom voice ID |
| Instructions | instructions | the system prompt |
| Reasoning effort | reasoning.effort | high (default) or none |
| Turn detection | turn_detection.type | server_vad for automatic turns, null for manual turns |
| Re-engage after silence | turn_detection.idle_timeout_ms | the agent speaks again if the user stays silent |
| Codec and sample rate | audio.input.format, audio.output.format | PCM at 8–48 kHz (24 kHz default), G.711 μ-law / A-law at 8 kHz, Opus at 24 kHz |
| Speaking speed | audio.output.speed | 0.7 to 1.5, default 1.0 |
| Language hint | audio.input.transcription.language_hint | BCP-47 code; Spanish and Portuguese need the regional variant |
| Key terms | audio.input.transcription.keyterms | up to 100 terms, 50 characters each |
| Pronunciation fixes | replace | changes what is spoken, not the transcript |
| Tools | tools | web_search (up to 5 domains), x_search (up to 20 handles), file_search, mcp, function |
| Session resumption | resumption.enabled | replays earlier turns on reconnect; history expires after 30 minutes idle |
| Opening line | force_message item | spoken word for word, no response.create needed |
Which code tab to use
- Python and Node.js connect with your API key in the
Authorizationheader. Use them on a server, for phone bridges, or to test a prompt from your terminal. - Browser is two pieces. Your server calls
POST /v1/realtime/client_secretsto mint a short-lived token (10 minutes by default, 1 hour at most) and the page connects with it as a WebSocket subprotocol,xai-client-secret.<token>, because browsers cannot set WebSocket headers. Your API key never reaches the page. - JSON is the raw event, for when you already have a client, such as an OpenAI Realtime client pointed at xAI's URL.
The code stops where your app starts: it sends the config and prints events, but microphone capture and audio playback depend on your platform. xAI's cookbook has full web, WebRTC, iOS and Twilio phone examples.
Choosing settings
- Reasoning. Leave
highon for agents that look things up, follow multi-step policies or handle unclear requests. Trynonefor simple, scripted flows where every bit of latency counts. The price per minute is the same either way. - Audio format. For browser and app audio, keep the 24 kHz PCM default and match it on both sides to avoid resampling. For phone audio over SIP or a telephony provider, pick G.711 μ-law (North America, Japan) or A-law (most other countries) so nothing has to be transcoded.
- Tools. Only switch on tools the prompt actually uses, and only name tools in the prompt that are switched on. xAI's prompting guide says a mismatch either way makes the agent worse; the builder warns if your instructions mention
web_search,x_searchorfile_searchwhile that tool is off. - Pin the model once you go live.
grok-voice-latestwill move to newer models;grok-voice-3.0will not.
Related tools
The Grok Voice 3.0 prompt generator writes the instructions in xAI's recommended five-section shape, and the Grok Voice 3.0 cost calculator turns your expected call volume into a monthly bill. To pick a voice by ear, try them in the free Grok text to speech tool: the voices are the same in text to speech and in voice agents. For background on the model, read the Grok Voice 3.0 guide and the Grok voice agent guide.
Last updated: