Docs / Live API / WebSocket

Live API

WebSocket

One WebSocket carries a Live session: your audio in, and the model’s speech, transcripts and turn events out.

Connect

WSS
wss://api.dotwave.ai/v1/live/sessionsNo query parameters are needed.
From your server
Authorization: Bearer <API key>
From a browser
?token=<client secret>, with a secret from POST /v1/live/client_secrets

Start the session

The first event you send must be session.start. The socket refuses anything else with the error “The first Live event must be session.start.” The server answers session.started, with the session’s id, model and audio configuration.

{"type": "session.start",
 "session": {"model": "nemotron-voicechat",
             "audio": {"input": {"format": {"type": "audio/pcm", "rate": 24000}},
                       "output": {"format": {"type": "audio/pcm", "rate": 24000},
                                  "encoding": "base64",
                                  "voice": "aria"}}}}

A refused session.start sends an error event and closes the socket with 4400; nothing is created or billed.

Audio

Format
24 kHz mono PCM16, both ways. Send it in chunks of 3,840 bytes.
In
session.input_audio.append with base64 audio, or the same chunks as binary messages.
Out
session.output_audio.delta, base64 by default. Set audio.output.encoding to binary to receive bare PCM16 as binary messages instead.
Pacing
Send audio at the speed of speech. The server buffers at most 1.28 s ahead; audio sent faster ends the session with close code 1013.
Muting
After session.input_audio.mute, keep streaming: the model hears silence until session.input_audio.unmute.

Turns and transcripts

The model takes and gives the turn on its own, so there is no buffer to commit and no response to request. session.turn.event reports each change. The user’s speech arrives as session.input_transcript.delta and the model’s as session.output_transcript.delta. See server events.

Close codes

Send session.close to end the session. The server answers session.closed, with the reason, the final session and its usage, then closes the socket. A session also ends when it reaches its limit.

Close codeMeaningWhat to do
1000Closed normally: by you, or when the session reached its limit.Nothing, or open a new session.
1011A server error.Open a new session.
1012The server is restarting.Open a new session.
1013Audio arrived faster than real time.Open a new session, and pace the audio.
4400A protocol error, such as a first event other than session.start, or a refused session.start.Fix the client.
4401The credential is invalid, expired or already used.Use your API key, or a new client secret.
4413The service is not ready.Retry shortly.
4429No capacity when the session started. An error event with capacity_exhausted comes first.Retry after a short wait.