Skip to main content

Overview

After session_ready, the wire is a two-way stream:
  • Client → server: binary audio frames, plus JSON control frames (end_utterance, close).
  • Server → client: JSON transcript frames, plus ack, backpressure, status, and error frames.
Every JSON message has a type field. Branch on it and ignore any message type or field you do not recognize.

Streaming audio (binary frames)

Send raw audio as binary WebSocket frames. Frames may be any length — the server re-frames the stream internally, so you do not need to align to segment boundaries. Send the encoding, sample rate, and channel count you declared in your config.

Control frames (client → server)

Two JSON text frames let you control the session:
Forces the server to finalize (flush) whatever audio is currently buffered, without ending the session. The server responds with an ack confirming the durable high-water mark. Useful for push-to-talk, or before you pause.
Ends the session cleanly. The server finalizes any remaining audio and closes the socket. You may also simply close the WebSocket.

transcript (server → client)

The server sends one transcript frame per finalized segment of speech.
string
Always "transcript".
integer
Monotonically increasing sequence number for this session. Use it to order and de-duplicate segments (helpful across a reconnect).
object
The finalized segment’s absolute time span: { "start": <seconds>, "end": <seconds> }. Includes any timeline_offset_seconds from your config.
string | null
The ISO 639-1 language detected for this segment (for example "de"), or null if undetermined.
boolean
Whether speaker separation is on for this session. When true, a speakers array is also present (see below).
string
The transcribed text for the segment.
array
Per-word timings. Each entry is { "w": <word>, "start": <seconds>, "end": <seconds> }, on the same absolute timeline as segment.
array
Only present when diarization_enabled is true. Per-speaker turns within the segment — see Diarization.
number
The absolute second up to which the server has consumed audio. This is your reconnection high-water mark — see Reconnection.
All times (segment, words, and speaker turns) are on one absolute timeline that already includes your timeline_offset_seconds. You never need to add the offset yourself.
The server may include additional advisory fields on a transcript frame. Treat any field not documented here as opaque and ignore it, so your integration stays forward-compatible.

Handling transcripts

Diarization (speakers)

When you enable diarization, each transcript frame carries a speakers array of per-speaker turns for that segment:
string
A stable label for a distinct speaker within the session (for example "S1", "S2").
number
Absolute start time of the turn.
number
Absolute end time of the turn.
string
The text attributed to that speaker for this turn.
Speaker labels are stable within a single session. If you reconnect mid-recording, speakers recovered after the boundary may be relabeled — treat labels as session-scoped. See the reconnection caveat.

ack (server → client)

Sent in response to an end_utterance control frame (and may be sent periodically in future). It confirms the durable high-water mark — the same meaning as processed_until on a transcript frame.
number
The absolute second up to which all audio has been consumed. A client can confirm its tail was processed before stopping or reconnecting. Content-free — clients that don’t need it can ignore it.

backpressure (server → client)

Sent when you are sending audio faster than the session can finalize it. Slow your send rate toward real time; if the pressure persists the server may drop some buffered segments to stay live.
string
Severity of the signal (for example "warn").
integer
How many buffered segments were dropped to keep the session live (0 when this is only an early warning).
A backpressure frame may carry additional advisory numeric fields; treat them as opaque. The actionable response is always the same: send audio closer to real time. See Errors → Backpressure.

status (server → client)

Informational session-state notifications.
string
A short state label. For example "idle_timeout" — the session received no audio for an extended period (roughly two minutes) and is being closed. Send audio, or end_utterance, periodically to keep a session alive.

Next steps

Reconnection

Resume mid-recording with processed_until and timeline_offset_seconds.

Errors

Error frames, the full code table, and backpressure handling.