Skip to navigation

WebSocket

The Realtime Translation WebSocket API streams translation audio continuously to a target language given source audio. Currently for enterprise workspaces only.

Handshake

WSS
/v1/translation/realtime

Headers

xi-api-keystringOptional

Query parameters

authorizationstringOptional
Your authorization bearer token.
target_languagestringRequired

Target language as an ISO 639 code (e.g. de, es, fr, zh).

source_languagestringOptional

Source language as an ISO 639 code. When omitted the server auto-detects the spoken language.

voice_idstringRequired
Voice ID used for the translated speech output.
input_formatanyOptional
Audio encoding format for realtime translation input.
output_formatanyOptional
Audio encoding format for realtime translation output.
tts_model_idenumOptionalDefaults to eleven_v4_turbo
TTS model used to synthesize the translated speech.
Allowed values:
apply_text_normalizationenumOptionalDefaults to off

This parameter controls text normalization with three modes: ‘auto’, ‘on’, and ‘off’. When set to ‘auto’, the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With ‘on’, text normalization will always be applied, while with ‘off’, it will be skipped.

Allowed values:
eagernessenumOptionalDefaults to medium
How eagerly translation starts while the speaker is still talking. 'high' starts translating soonest for the lowest latency. 'low' waits for more of the sentence, giving higher quality translations with more delay.
Allowed values:
client_session_idstringOptional

Optional client-defined session identifier for tracking purposes.

enable_zrmbooleanOptionalDefaults to false

When enable_zrm is set to true, zero retention mode will be used for the request. Sensitive content (transcripts, translations, and TTS text) is not written to application logs or session history. Zero retention mode may only be used by enterprise customers.

Send

inputAudioChunkobjectRequired
Send a chunk of audio for translation.
OR
endOfStreamobjectRequired
Signal that the audio stream has ended.

Receive

sessionStartedobjectRequired
Sent by the server when the session is initialized.
OR
statusobjectRequired
Session lifecycle update indicating the session has started or stopped.
OR
partialTranscriptobjectRequired
Interim transcription of the source audio.
OR
finalTranscriptobjectRequired
Final transcription of a segment of source audio.
OR
translationobjectRequired
Translated text in the target language.
OR
audioobjectRequired

Base64-encoded audio of the translated speech.

OR
errorobjectRequired
Error encountered during translation.
OR
Translate Auth ErrorobjectRequired
Authentication failed for the session.
OR
Translate Rate Limited ErrorobjectRequired
The request rate limit was reached.
OR
Translate Queue Overflow ErrorobjectRequired
Audio was sent too frequently and the session was terminated.
OR
Translate Input ErrorobjectRequired

An input message could not be handled; check the message format.

OR
Translate Transcriber ErrorobjectRequired
The transcriber failed to process the audio.
OR
Translate Translation ErrorobjectRequired

Translation failed for a segment; the session continues.

OR
Translate Audio Output ErrorobjectRequired

Audio output for a segment failed or was dropped; the session continues.

OR
Translate Quota Exceeded ErrorobjectRequired

The workspace is out of credits; the session is closed.

OR
Translate Payment Issue ErrorobjectRequired

The workspace has a payment issue or is suspended; the session is closed.

OR
Translate Unaccepted Terms ErrorobjectRequired

The workspace has not accepted terms required for this feature; the session is closed.