OptionalapiThe API key; the client's key is used when neither this nor token is given.
OptionalconnectMilliseconds to wait for the handshake and Begin. Defaults to 10 000.
Optionalencoding?: LiteralUnion<Exclude<TextToSpeechEncoding, "mp3">, string>pcm_s16le (default), pcm_mulaw or pcm_alaw. A session has no MP3 or container.
Optionalextendtrue renews the biometric consent of the cloned voice in voiceId.
Needs voiceId. connect() is refused with not_owner (close 3006,
param: "extend_biometric_consent") on a voice the account does not
own, and with biometric_terms_not_accepted (close 3006, not retryable)
until the account accepts the biometric data terms on the data controls
page of the AssemblyAI dashboard. The Termination summary's
voice_expires_at shows the new expiry.
OptionalinactivitySeconds (5 to 120, default 120) without a frame in either direction
after which the API closes the session (3006 inactivity_timeout,
retryable). See keepAlive().
Optionallanguage?: LiteralUnion<TextToSpeechLanguage, string>OptionalmodelOptionalsampleDefaults to 24000.
OptionalterminateMilliseconds without a message from the API after which close() stops
waiting for Termination and drops the audio still to come; 0 waits
indefinitely. Defaults to 35 000, a little over the API's own 30 s limit
for a stalled drain.
Optionaltoken?: stringA temporary token, for a session opened on a user's device. It is sent
instead of the API key and opens one connection: to reconnect, pass a
new token to connect({ token }). The API may refuse a token it has
already seen, and always refuses an expired one, with close code 1008
(unauthorized).
OptionalvoiceSee TextToSpeechVoiceOptions.voice_id.
OptionalwebsocketDefaults to wss://tts.us.assemblyai.com/v1/ws; wss://tts.eu.assemblyai.com/v1/ws for the EU zone.
OptionalwordWhether the server sends wordBoundaries events. Off by default here.
Parameters of a
TextToSpeechSession.