One connection = one conversation: history lives in server memory for the socket's lifetime. Frames are JSON text; unknown fields are ignored, an unknown message type gets a non-fatal `error`. The first frame must be `initializeConnection`, within 10 s of connecting. Application close codes: 4400 protocol violation, 4401 authentication failed, 4408 timeout (init deadline or 300 s idle), 4429 reser
Adds a completed turn (transcript and audio) to the history without generating anything.
Reference audio added for a speaker pins how that speaker sounds in every later generation.
Content-Type:
cancelResponse
Aborts the in-flight response. Idempotent — cancelling when nothing is generating (or naming
an already-finished response) is silently ignored.
Content-Type:
error
Any error, fatal or not. Non-fatal errors reject exactly one client message and change no
state; fatal errors are followed by a close.
Content-Type:
initializeConnection
Authenticates the session; must be the first frame, within 10 s of connecting. An invalid or
missing `api_key` gets a fatal `error` and close code 4401; if key verification is temporarily
unavailable
Content-Type:
responseAudio
One chunk of generated audio, in generation order.
Content-Type:
responseCreated
Generation for a flushed turn has started; `responseAudio` chunks follow.
Content-Type:
responseDone
The response settled — `completed` (the turn, with its final text, is now history) or
`cancelled` (the turn was dropped; partial audio is never context). Every response pairs a
`responseCreated` with
Content-Type:
sendText
Streams text for a turn. Text accumulates in the pending turn buffer (capped at 8,000
characters per turn); `flush: true` ends the turn and starts generation.
Content-Type:
sessionCreated
Acknowledges `initializeConnection`: the session is ready and audio will arrive in the fixed
output format below.
Content-Type:
About AsyncAPI
The AsyncAPI specification describes event-driven APIs the way OpenAPI describes request/response APIs. A channel is the named pipe — a webhook URL, a Kafka topic, a WebSocket route, an MQTT subject — that producers and consumers publish or subscribe to. Each channel carries one or more messages with structured payloads, and an operation declares whether a given party sends or receives on that channel.