This endpoint only supports text chunks with character lengths between 10 and 100
Runtime limits
Endpoint
Authentication
All requests require a Bearer token in the Authorization header:Connection query parameters
The websocket route reads these values fromrequest.args.get(...).
| Parameter | Type | Description | Required | Default |
|---|---|---|---|---|
voice_accent | String | Accent for the speech voice | yes | see page of supported accents |
voice_gender | String | Accent for the speech voice | yes | male / female |
voice_language | String | Language of the input text | no | see page of supported languages,en |
output_audio_format | String | Specify the output audio format | no | see list of supported audio formats below,wav |
Supported Output Audio Formats
| Format | Extensions |
|---|---|
| WAV | .wav |
| OPUS | .opus |
Supported Language And Accents
Supported Languages And Accents
Comprehensive list of languages and accents supported
WebSocket handshake examples
Input message types
INPUT_TEXT_CHUNK
| Field | Type | Required | Description |
|---|---|---|---|
message_type | String | Yes | Must be INPUT_TEXT_CHUNK |
text | String | Yes | the input text |
ack_id | Integer | No | Client chunk sequence ID echoed by server ACK |
JSON
FETCH_AUDIO_CHUNK
| Field | Type | Required | Description |
|---|---|---|---|
message_type | String | Yes | Must be FETCH_AUDIO_CHUNK |
chunk_id | Integer | No | id of the input text chunk |
JSON
COMMIT
| Field | Type | Required | Description |
|---|---|---|---|
message_type | String | Yes | Must be COMMIT |
JSON
Session Responses
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
TEXT_CHUNK_ACK
TEXT_CHUNK_ACK
Sent after the server accepts and stores a text chunk. The server echoes the client
ack_id when present, otherwise it uses the running chunk count.JSON
FETCH_AUDIO_CHUNK
FETCH_AUDIO_CHUNK
This is sent in response to the request
FETCH_AUDIO_CHUNK,with the base64 audio is available,
the processing_status is READY when that chunk is fully processed with a base64 audio else it’s PROCESSINGJSON
COMMITTED_AUDIO
COMMITTED_AUDIO
Sent after the client sends
COMMIT and the backend finishes processing the full stream. This is the summary payload for the session.JSON
Error and Terminal Responses
ERROR
ERROR
Sent for unexpected server-side failures that do not map to a more specific websocket error message.
JSON
INPUT_ERROR
INPUT_ERROR
Sent when the request payload is invalid, such as malformed JSON, an invalid message structure, invalid request data.
JSON
JSON
JSON
JSON
JSON
JSON
JSON
JSON
JSON
JSON
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
SESSION_TIME_LIMIT_EXCEEDED
SESSION_TIME_LIMIT_EXCEEDED
Sent when the websocket session exceeds the maximum allowed session lifetime.
JSON
INSUFFICIENT_TEXT_ACTIVITY
INSUFFICIENT_TEXT_ACTIVITY
Sent when no text chunk has been received for longer than the allowed idle timeout while the session is still active.
JSON
CHUNK_ID_MISMATCH_WITH_TOTAL
CHUNK_ID_MISMATCH_WITH_TOTAL
Sent when the provided sequential integer ack_id in the
INPUT_TEXT_CHUNK request does match the count total chunks sent.JSON
CHUNCK_SIZE_TOO_SMALL
CHUNCK_SIZE_TOO_SMALL
Sent when the received text chunk character count is smaller than the minimum required.
JSON
CHUNK_SIZE_TOO_LARGE
CHUNK_SIZE_TOO_LARGE
Sent when the received text chunk character count is larger than the maximum allowed.
JSON
Typical flow
- Open websocket connection with query parameters and
Authorizationheader. - Receive
SESSION_CREATED. - Send
INPUT_TEXT_CHUNKmessages repeatedly. - Send
FETCH_AUDIO_CHUNKrequests to get the base64 audio whenREADY - Send
COMMITwhen done streaming audio. - Receive
COMMITTED_AUDIOand the connection closes.
