탐색으로 건너뛰기

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.