{"type":"done"} JSON text frame.
1
mint a session
POST /v1/tts/ws-connect returns { ws_url, token }.2
connect and send
connect to
ws_url?token=<token> and send one JSON synthesis frame.3
collect PCM
read binary PCM chunks until the
done (or error) control frame.interruption (barge-in)
for a live “call with AI”, keep the WebSocket open for the whole call and send a new{"text": "..."} frame for each thing the agent says. if the caller talks over
the agent, just send the next utterance: a new text frame while one is still
generating interrupts the current one and starts the new one. this is
“latest-wins”, there is no special barge-in frame.
frames
once connected, the session is a two-way stream of JSON text frames and binary audio. client → server
server → client
on a barge-in you receive
{"type": "cancelled", "reason": "interrupt"} for the old
request, then the audio chunks and done for the new one. the old audio stops
almost immediately.
behavior
- latest-wins: only the newest utterance is held. a burst of requests during one generation never queues a backlog of now-stale audio, only the latest runs next.
- immediate stop: on interrupt or cancel the old audio stops streaming right away, so the caller stops hearing it within a couple hundred milliseconds (mostly network round-trip).
example
python