Skip to main content
WSS
token
type:string
required

Optional. Authenticate with a temporary token (minted with product=tts) or an API key, for clients that cannot set the Authorization header, such as browsers. Ignored when the header is present. Mint one temporary token per connection, and never put your API key in a URL that runs on a user's device.

voice_id
type:string
required

Optional. The voice: the library slug of an AssemblyAI voice such as aai-jane, a voice's ID (a UUID, in any letter case), or the slug of one of your account's voices, such as a cloned voice. Slugs are lowercase, at most 64 characters. When unset, the session speaks the default voice of its model in its language, aai-jane. An AssemblyAI voice the session's model does not speak in the session's language closes with 3006; a voice_id that names no voice your account can use on this host closes with 3012.

model_id
type:string
required

Optional. The model to run the session on, such as assemblyai-tts-1, in lowercase. When unset, the default model of the session's language in the region. With voice_id, the voice must be paired with that model (3014 otherwise). A model the region does not know closes with 3006 before Begin. See Language and model.

language
type:enum
required

Optional. The language of the text you send, as its full English name, not an ISO code. Case-insensitive, echoed lowercase. The API does not detect language. Defaults to english; with a library or cloned voice that speaks one language, to that voice's language, and any other value closes the session with 3006. See Languages.

Available options: english, spanish, german, italian, portuguese, french
sample_rate
type:enum
required

Optional. Output sample rate in Hz. 24000 is the model's native rate; other rates are resampled.

Available options: 8000, 16000, 22050, 24000, 44100, 48000
encoding
type:enum
required

Optional. Encoding of the audio in Audio messages: raw bytes with no header. pcm_s16le is 16-bit signed little-endian PCM; pcm_mulaw and pcm_alaw are 8-bit G.711 for telephony. The aliases mulaw and alaw are accepted and echoed in canonical form. See Audio formats on WebSocket API basics.

Available options: pcm_s16le, pcm_mulaw, pcm_alaw
word_boundaries
type:enum
required

Optional. Whether to send a WordBoundaries message with per-word timings after each request's FlushDone. Takes true, false, 1 or 0, in any case. See Word boundaries.

Available options: true, false
inactivity_timeout
type:string
required

Optional. Seconds with no frame in either direction before the session closes with 3006 (error_type inactivity_timeout). Shortens the idle timeout every session has. An integer from 5 to 120; Begin.configuration.limits reports the accepted range.

extend_biometric_consent
type:enum
required

Optional. With voice_id, by the owner of a cloned voice only, true renews the voice's biometric consent and attests renewed consent on behalf of the account that owns it. Set on a voice another account owns, the session closes with 3006 (error_type not_owner). See Renew consent.

Available options: true, false
Generate
type:object

Client message with text to speak.

Flush
type:object

Client message that concludes the current request.

Cancel
type:object

Client message that stops the speech in flight, for barge-in.

Keep Alive
type:object

Client message that restarts the idle timer.

Terminate Session
type:object

Client message that ends the session cleanly.

Session Begins
type:object

Server message confirming the session opened, with its effective configuration.

Audio
type:object

Server message with a chunk of synthesized audio.

Flush Done
type:object

Server message confirming a request's audio has all been sent.

Word Boundaries
type:object

Server message with per-word timings for a request.

Cancelled
type:object

Server message answering a Cancel.

Session Terminated
type:object

Server message with the session summary after a clean Terminate.

Error
type:object

Server message sent before every failure close, with the reason.