Skip to main content
Real-time audio and video translation

Client events

This topic describes client events for the Qwen real-time speech and audiovisual translation API, including event types, parameters, and examples.

Reference: Real-time audio and video translation - Qwen .

session.update

Send this event after establishing a WebSocket connection to update the default session configuration. The server validates parameters and returns either an error (if invalid) or the updated configuration (if valid).
  • qwen3.8-livetranslate-flash-realtime
  • qwen3.5-livetranslate-flash-realtime
{
  "type": "session.update",
  "session": {
    "output_modalities": [
      "text",
      "audio"
    ],
    "audio": {
      "input": {
        "turn_detection": {
          "type": "speaker_detection",
          "threshold": 0.5
        }
      }
    },
    "voice": "default",
    "enable_voice_clone": true,
    "voice_clone_options": {
      "frequency": "once"
    },
    "translation": {
      "language": "en",
      "corpus": {
        "phrases": {
          "人工智能": "Artificial Intelligence",
          "机器学习": "Machine Learning"
        }
      }
    }
  }
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to session.update.
sessionobject(Optional) The session configuration.
session.output_modalitiesarray(Optional) Applies to qwen3.8-livetranslate-flash-realtime. Output modalities: ["text"] for text only or ["text", "audio"] for text and audio (default).
session.audioobject(Optional) Applies to qwen3.8-livetranslate-flash-realtime. Audio configuration.
session.audio.inputobjectInput audio configuration.
session.audio.input.formatobject(Optional) Input audio format.
session.audio.input.format.typestring(Optional) Audio format. Valid values: pcm (default) and opus.
session.audio.input.format.sample_rateinteger(Optional) Input audio sample rate in Hz. Default: 16000.
session.audio.input.turn_detectionobject(Optional) Speech detection configuration.
session.audio.input.turn_detection.typestring(Optional) Valid values: speaker_detection (default, enables real-time speaker diarization) and server_vad (voice activity detection).
session.audio.input.turn_detection.thresholdnumber(Optional) The detection threshold. In speaker_detection mode, it distinguishes silence from valid speech. Sounds below the threshold are filtered out and are not passed to the model. The value is fixed at 0.5.
session.modalitiesarray(Optional) Applies to qwen3.5-livetranslate-flash-realtime. Output modalities. Valid values:
  • ["text"]
Outputs text only.
  • ["text","audio"] (Default)
Outputs text and audio.
session.voicestring(Optional) Voice for generated audio. When voice cloning is disabled, set this to a system preset voice. Valid values: Supported voices. The default voice is Tina for qwen3.8-livetranslate-flash-realtime and qwen3.5-livetranslate-flash-realtime. > When enable_voice_clone is true, the value of voice depends on the voice_clone_options.frequency setting. When frequency is once or always, set it to default. When frequency is never, set it to the voice ID you previously cloned. Using a system preset voice in this case causes a server error.
session.enable_voice_cloneboolean(Optional) Whether to enable voice cloning. The default is false. When enabled, you can clone the input voice in real time during translation or use a voice cloned in advance. In this case, voice no longer uses a system preset voice. Set it to default or the ID of a voice you cloned in advance through the Voice cloning API.
session.voice_clone_optionsobject(Optional) Voice clone control options. Takes effect only when enable_voice_clone is true.
session.voice_clone_options.frequencystring(Optional) Voice cloning frequency. Valid values:
  • never
Disables server-side voice cloning and uses a voice you previously cloned. Set voice to your cloned voice ID.
  • once
Clones the voice once at the start of the session and reuses it for all subsequent output. Suitable for single-speaker scenarios. Set voice to default.
  • always
Re-clones the voice in real time before each output, dynamically adapting to the input audio. Suitable for multi-speaker scenarios. Set voice to default.
session.sample_rateinteger(Optional) Applies to qwen3.5-livetranslate-flash-realtime. Input audio sample rate, in Hz. Valid values:
  • 8000
  • 16000 (Default)
session.input_audio_transcriptionobject(Optional) Applies to qwen3.5-livetranslate-flash-realtime. For qwen3.8-livetranslate-flash-realtime, ASR is always enabled and cannot be disabled. Transcripts are free of charge. Configuration for input audio.
session.input_audio_transcription.modelstring|null(Optional) Speech recognition model. Defaults to qwen3-asr-flash-realtime; ASR is enabled by default. The server returns the input audio recognition result (original source language text) through the conversation.item.input_audio_transcription.text and conversation.item.input_audio_transcription.completed events. To disable ASR, explicitly set this parameter to null. Valid values: qwen3-asr-flash-realtime (default, enables ASR) and null (disables ASR).
session.input_audio_transcription.languagestring(Optional) Source language for translation. Valid values: Supported languages. If not specified, the model automatically detects the source language.
session.input_audio_formatstring(Optional) Applies to qwen3.5-livetranslate-flash-realtime. Input audio format. Valid values:
  • pcm (Default)
Uncompressed raw audio data.
  • opus
Lossy audio codec with low-latency support, suitable for VoIP scenarios.
session.output_audio_formatstring(Optional) Applies to qwen3.5-livetranslate-flash-realtime. Output audio format. Currently, this parameter can only be set to pcm.
session.turn_detectionobject|null(Optional) Applies to qwen3.5-livetranslate-flash-realtime. Voice Activity Detection (VAD) configuration, used to control how speech start and end are detected:
  • Set to a configuration object (default): Enables VAD mode. The server automatically detects speech start and end, commits the audio buffer, and triggers translation responses. The client does not need to send input_audio_buffer.commit events.
  • Set to null: Enables Manual mode. The client manually commits the audio buffer by sending input_audio_buffer.commit events. The server automatically starts generating translation responses upon receiving the commit.
session.turn_detection.typestring(Optional) VAD type. Must be set to server_vad.
session.turn_detection.thresholdfloat(Optional) VAD detection sensitivity. A lower value makes it easier to recognize faint sounds (including background noise) as speech; a higher value requires clearer, louder speech to trigger detection. Value range: [-1.0, 1.0]. Default value: 0.2.
session.turn_detection.silence_duration_msinteger(Optional) Minimum duration of silence (in milliseconds) required after speech ends. Once this duration is exceeded, the server determines that speech has ended, automatically commits the audio buffer, and triggers a translation response. Value range: [200, 6000]. Default value: 1000.
session.translationobject(Optional) Translation configuration.
session.translation.languagestring(Optional) Target language for translation. Valid values: Supported languages. Default value: en.
session.translation.same_language_skip_optionsobject(Optional) qwen3.8-livetranslate-flash-realtime does not support this parameter. Same-language output configuration. When the source and target languages are the same, the service can skip text output, audio output, or both. This parameter takes effect only when the target language is set to zh or en.
session.translation.same_language_skip_options.skip_textboolean(Optional) Specifies whether to skip text output when the source and target languages are the same.
session.translation.same_language_skip_options.skip_audioboolean(Optional) Specifies whether to skip audio output when the source and target languages are the same.
session.translation.corpusobject(Optional) Hot-word configuration to improve translation accuracy for specific terms.
session.translation.corpus.phrasesobject(Optional) Hot-word mapping. The key is the term in the source language, and the value is its target-language translation. Example: {"AI": "Artificial Intelligence"}

input_audio_buffer.append

For WebSocket access, appends audio bytes to the input audio buffer. The server uses this buffer to detect speech and determine when to commit it.
{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.append",
    "audio": "xxx"
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to input_audio_buffer.append.
audiostring(Required) Base64-encoded audio data.

input_audio_buffer.commit

Commits the input audio buffer. This event only needs to be sent in Manual mode (turn_detection set to null). In VAD mode, the server commits automatically and the client does not need to send this event. Upon receiving this event, the server returns an input_audio_buffer.committed event as confirmation and automatically starts generating a translation response (no additional event is needed to trigger the response). If the audio buffer is empty, the server returns an error event.
{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.commit"
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to input_audio_buffer.commit.

input_audio_buffer.clear

Clears uncommitted audio data from the input audio buffer.
{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.clear"
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to input_audio_buffer.clear.

input_image_buffer.append

For WebSocket access, adds image data to the image buffer. Images can come from a local file or be captured in real time from a video stream. Image input limits:
  • Image format: JPG or JPEG. Recommended resolution for optimal performance: 480p or 720p (maximum: 1080p).
  • Maximum image size: 500 KB (before Base64 encoding).
  • Image data must be Base64-encoded.
  • Maximum frequency: 2 images per second.
  • Send at least one input_audio_buffer.append event before sending input_image_buffer.append.
{
    "event_id": "event_xxx",
    "type": "input_image_buffer.append",
    "image": "xxx"
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to input_image_buffer.append.
imagestring(Required) Base64-encoded image data.

session.finish

Send this event to end the current session. Server responses: After receiving the session.finished event, the client must finish local playback of any remaining translated audio before actively disconnecting, if playback is needed.
{
    "event_id": "event_xxx",
    "type": "session.finish"
}
ParameterTypeDescription
typestring(Required) Event type. Must be set to session.finish.
Client events - QwenCloud