Client events

Updated at:
Copy as MD

This topic describes the client events for the qwen3.5-livetranslate-flash-realtime API.

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).

type string (Required)

Event type. Must be set to session.update.

{
  "event_id": "event_ToPZqeobitzUJnt3QqtWg",
  "type": "session.update",
  "session": {
    "modalities": [
      "text",
      "audio"
    ],
    "voice": "Cherry",
    "sample_rate": 16000,
    "input_audio_format": "pcm",
    "output_audio_format": "pcm",
    "input_audio_transcription": {
      "model": "qwen3-asr-flash-realtime",
      "language": "zh"
    },
    "translation": {
      "language": "en",
      "corpus": {
        "phrases": {
          "人工智能": "Artificial Intelligence",
          "机器学习": "Machine Learning"
        }
      }
    }
  }
}

Example with voice clone enabled (frequency=once):

{
  "event_id": "event_ToPZqeobitzUJnt3QqtWg",
  "type": "session.update",
  "session": {
    "modalities": [
      "text",
      "audio"
    ],
    "voice": "default",
    "enable_voice_clone": true,
    "voice_clone_options": {
      "frequency": "once"
    },
    "sample_rate": 16000,
    "input_audio_format": "pcm",
    "output_audio_format": "pcm",
    "translation": {
      "language": "en"
    }
  }
}

session object (Optional)

The session configuration.

Properties

modalities array (Optional)

Output modalities. Valid values:

  • ["text"]

    Outputs text only.

  • ["text","audio"] (Default)

    Outputs text and audio.

voice string (Optional)

Voice for generated audio. When voice cloning is disabled, set this to a system preset voice. Valid values: Supported voices. Default value: Tina for Qwen3.5-LiveTranslate-Flash-Realtime, or Cherry for Qwen3-LiveTranslate-Flash-Realtime.

When enable_voice_clone is true, the value of voice depends on the 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.

enable_voice_clone boolean (Optional)

Whether to enable voice cloning. Default value: false. When enabled, the model clones the speaker's voice from the input audio for translated output. In this case, voice no longer accepts system preset voices and must be set to default or a voice ID previously created through the Voice Clone API.

voice_clone_options object (Optional)

Voice clone control options. Takes effect only when enable_voice_clone is true.

Properties

voice_clone_options.frequency string (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.

sample_rate integer (Optional)

Input audio sample rate, in Hz. Valid values:

  • 8000

  • 16000 (Default)

input_audio_transcription object (Optional)

Configuration for input audio.

Properties

model string (Optional)

Speech recognition model. If configured, the server returns both the recognition result (original source language text) and translation via the conversation.item.input_audio_transcription.text and conversation.item.input_audio_transcription.completed events.

Valid value: qwen3-asr-flash-realtime.

language string (Optional)

Source language for translation. Valid values: Supported languages. Default value: en.

input_audio_format string (Optional)

Input audio format. Valid values:

  • pcm (Default)

    Uncompressed raw audio data.

  • opus

    Lossy audio codec with low-latency support, suitable for VoIP scenarios.

output_audio_format string (Optional)

Output audio format. Currently, this parameter can only be set to pcm.

translation object (Optional)

Translation configuration.

Properties

language string (Optional)

Target language for translation. Valid values: Supported languages. Default value: en.

corpus object (Optional)

Hot-word configuration to improve translation accuracy for specific terms.

Properties

phrases object (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

Appends audio bytes to the input audio buffer. The service uses this buffer to detect speech and determine when to submit it.

type string (Required)

Event type. Must be set to input_audio_buffer.append.

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.append",
    "audio": "xxx"
}

audio string (Required)

Base64-encoded audio data.

input_image_buffer.append

Adds image data to the image buffer from a local file or real-time 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.

type string (Required)

Event type. Must be set to input_image_buffer.append.

{
    "event_id": "event_xxx",
    "type": "input_image_buffer.append",
    "image": "xxx"
}

image string (Required)

Base64-encoded image data.

session.finish

Send this event to end the current session. Server responses:

The client must disconnect after receiving session.finished.

type string (Required)

Event type. Must be set to session.finish.

{
    "event_id": "event_xxx",
    "type": "session.finish"
}