Realtime Voice API
Realtime models hold a two-way voice conversation over a single WebSocket. You stream audio up, the model streams audio back, and either side can talk at any moment, so the model can be interrupted mid-sentence the way a person can.
This is the only EmpirioLabs model surface that is not HTTP. Streaming with stream: true on the regular endpoints sends data one way, from us to you, so it can deliver generated audio but has no channel to carry your microphone audio up. Full duplex needs a socket.
Endpoint
Authenticate with the same API key you use everywhere else, as an Authorization header on the handshake:
Browsers cannot set headers on a WebSocket, so a browser cannot open this connection directly. Connect from your server and relay audio to the browser over your own socket. Do not put your API key in the query string or ship it to a browser.
Models
Conversation is available in Chinese and English.
Your first session
Audio format
Audio travels in both directions as base64-encoded pcm16: 16-bit signed little-endian PCM. Send microphone audio with input_audio_buffer.append and read model audio from response.audio.delta.
Voices
Set the voice with session.update before the model produces any audio. It cannot be changed once the model has spoken, and any value outside this list is rejected.
Events
The protocol follows the widely used realtime event shape, so a client written against that convention works here.
Turn taking
Server-side voice activity detection decides when you have stopped speaking and when the model should reply. Speaking while the model is talking interrupts it, which is what makes the conversation feel natural rather than walkie-talkie.
Billing
Each completed turn is billed on its own, from the token usage reported in that turn’s response.done, at the model’s published input and output rates. Holding a session open costs nothing by itself; you pay for the turns you generate. Live rates are on each model page and on pricing.
Limits
- Conversation is Chinese and English only.
- A closed socket ends the session. Reconnecting starts a new one with no memory of the previous conversation, so keep your own transcript if you need continuity.
- One connection carries one conversation. Open a socket per concurrent caller.
