ナビゲーションにスキップ

WebSocket

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

ハンドシェイク

WSS
/v1/translation/realtime

ヘッダー

xi-api-keystringオプション

クエリパラメータ

authorizationstringオプション
Your authorization bearer token.
target_languagestring必須

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

source_languagestringオプション

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

voice_idstring必須
Voice ID used for the translated speech output.
input_formatanyオプション
Audio encoding format for realtime translation input.
output_formatanyオプション
Audio encoding format for realtime translation output.
tts_model_idenumオプションデフォルト値 eleven_v4_turbo
TTS model used to synthesize the translated speech.
許可された値:
apply_text_normalizationenumオプションデフォルト値 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.

許可された値:
eagernessenumオプションデフォルト値 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.
許可された値:
client_session_idstringオプション

Optional client-defined session identifier for tracking purposes.

enable_zrmbooleanオプションデフォルト値 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.

送信

inputAudioChunkobject必須
Send a chunk of audio for translation.
OR
endOfStreamobject必須
Signal that the audio stream has ended.

受信

sessionStartedobject必須
Sent by the server when the session is initialized.
OR
statusobject必須
Session lifecycle update indicating the session has started or stopped.
OR
partialTranscriptobject必須
Interim transcription of the source audio.
OR
finalTranscriptobject必須
Final transcription of a segment of source audio.
OR
translationobject必須
Translated text in the target language.
OR
audioobject必須

Base64-encoded audio of the translated speech.

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

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

OR
Translate Transcriber Errorobject必須
The transcriber failed to process the audio.
OR
Translate Translation Errorobject必須

Translation failed for a segment; the session continues.

OR
Translate Audio Output Errorobject必須

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

OR
Translate Quota Exceeded Errorobject必須

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

OR
Translate Payment Issue Errorobject必須

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

OR
Translate Unaccepted Terms Errorobject必須

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