Endpoint
Authentication
All connections require a Bearer token in theAuthorization header:
Connection query parameters
The websocket route reads these values fromrequest.args.get(...).
| Parameter | Type | Description | Required | Default |
|---|---|---|---|---|
session_id | String | Existing session ID. If omitted, server creates one and returns it in SESSION_CREATED. | No | Auto-generated |
sample_rate | Integer | Input audio sample rate in Hz. | No | 16000 |
bit_rate | Integer | Input PCM bit depth. | No | 16 |
num_channels | Integer | Number of input channels. | No | 1 |
use_language_asr_input | String | Input language code.(see the supported languages) | No | en |
Supported Languages
Supported Languages
Comprehensive list of languages supported
WebSocket handshake examples
Input message types
INPUT_AUDIO_CHUNK
| Field | Type | Required | Description |
|---|---|---|---|
message_type | String | Yes | Must be INPUT_AUDIO_CHUNK |
audio_base_64 | String | Yes | Base64 encoded PCM16 little-endian audio bytes |
ack_id | Integer | No | Client chunk sequence ID echoed by server ACK |
JSON
COMMIT
| Field | Type | Required | Description |
|---|---|---|---|
message_type | String | Yes | Must be COMMIT |
JSON
Response message types
Output payloads are based on websocket response classes (WebsocketResponse... and stream response classes).
Session and transcript messages
SESSION_CREATED
SESSION_CREATED
Sent immediately after successful authentication, capacity checks, and quota checks. It returns the active
session_id, current credit balance, and the effective stream configuration.JSON
AUDIO_CHUCK_ACK
AUDIO_CHUCK_ACK
Sent after the server accepts and stores an audio chunk. The server echoes the client
ack_id when present, otherwise it uses the running chunk count.JSON
PARTIAL_TRANSCRIPT
PARTIAL_TRANSCRIPT
Sent whenever a new partial transcript is available and differs from the last partial transcript already sent on the connection.
JSON
COMMITTED_TRANSCRIPT
COMMITTED_TRANSCRIPT
Sent after the client sends
COMMIT and the backend finishes processing the full stream. This is the final transcript payload for the session.JSON
PING
PING
Optional keep-alive message sent by the server when periodic pinging is enabled for the connection.
JSON
Error and terminal messages
AUTHENTICATION_ERROR
AUTHENTICATION_ERROR
Sent when the
Authorization header is missing, invalid, or the access key fails authentication. The server closes the connection after sending this message.JSON
RESOURCE_EXHAUSTED
RESOURCE_EXHAUSTED
Sent when the service does not currently have enough available capacity to accept the stream. The
status field indicates the capacity state returned by the backend.JSON
QUOTA_EXCEEDED
QUOTA_EXCEEDED
Sent when the authenticated user or entity has insufficient credits or has exceeded an allowed usage limit. The server closes the connection after sending this message.
JSON
INPUT_ERROR
INPUT_ERROR
Sent when the request payload is invalid, such as malformed JSON, an invalid message structure, invalid base64 audio data, invalid PCM16 payload length, or audio sent after
COMMIT.JSON
CHUNCK_SIZE_TOO_SMALL
CHUNCK_SIZE_TOO_SMALL
Sent when the received audio chunk is smaller than the minimum allowed chunk size.
JSON
CHUNK_SIZE_TOO_LARGE
CHUNK_SIZE_TOO_LARGE
Sent when the received audio chunk is larger than the maximum allowed chunk size.
JSON
INSUFFICIENT_AUDIO_ACTIVITY
INSUFFICIENT_AUDIO_ACTIVITY
Sent when no audio chunk has been received for longer than the allowed idle timeout while the session is still active.
JSON
SESSION_TIME_LIMIT_EXCEEDED
SESSION_TIME_LIMIT_EXCEEDED
Sent when the websocket session exceeds the maximum allowed session lifetime.
JSON
CONNECTION_LOST
CONNECTION_LOST
Sent when the server detects that the websocket connection has been lost.
JSON
ERROR
ERROR
Sent for unexpected server-side failures that do not map to a more specific websocket error message.
JSON
Runtime limits
Typical flow
- Open websocket connection with query parameters and
Authorizationheader. - Receive
SESSION_CREATED. - Send
INPUT_AUDIO_CHUNKmessages repeatedly. - Receive
AUDIO_CHUCK_ACKandPARTIAL_TRANSCRIPTmessages. - Send
COMMITwhen done streaming audio. - Receive
COMMITTED_TRANSCRIPTand the connection closes.
