Skip to main content

Qwen-LiveTranslate-Realtime WebSocket access

Qwen-LiveTranslate-Realtime WebSocket access

Scope of Application

This document is intended for Qwen-LiveTranslate-Realtime; the example model is qwen3.8-livetranslate-flash-realtime. The series of guides also covers qwen3.5-livetranslate-flash-realtime and the snapshot version qwen3.5-livetranslate-flash-realtime-2026-05-19. Configurations and event fields differ between 3.8 and 3.5; consult the event reference for the selected model.
  • Use the API Key and Workspace ID corresponding to your selected region and workspace.
  • Beijing domain: {WorkspaceId}.cn-beijing.maas.aliyuncs.com; Singapore domain: {WorkspaceId}.ap-southeast-1.maas.aliyuncs.com.
  • Long-term API keys are stored on the server and should not be placed in browsers or mobile applications.

Addresses and Authentication

Beijing: wss://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api-ws/v1/realtime?model=qwen3.8-livetranslate-flash-realtime Singapore: wss://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api-ws/v1/realtime?model=qwen3.8-livetranslate-flash-realtime For details on other domains, see Python SDK. Set Authorization: Bearer <API_KEY> in the WebSocket handshake request header. Replace the workspace ID and the actual model name; do not place long-term API keys in browsers or mobile apps. An optional user-agent request header is used to identify the client. General WebSocket integration documentation also lists X-DashScope-WorkSpace (workspace ID) and X-DashScope-DataInspection (data compliance check configuration), which are used as required by the model. For instructions on generating temporary API keys and their permissions, see Generate Temporary API Key.

Session Configuration

Send session.update after establishing the connection and receiving session.created. Send input only after receiving session.updated confirmation; handle errors via error events. The following examples apply to qwen3.8-livetranslate-flash-realtime; other versions use configurations from their respective event references—do not mix field levels. The example enables real-time voice cloning, where frequency: once extracts the input voice tone once at the start of the session and reuses it afterward, suitable for single-person scenarios. For details, see Voice Cloning.
{
  "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"
        }
      }
    }
  }
}
When using qwen3.5-livetranslate-flash-realtime, the configuration and events differ from the above 3.8 example:
  • Output mode uses modalities in session; the available values and default are the same as output_modalities in 3.8.
  • The source language can be specified via language in the input_audio_transcription object of session; if omitted, automatic recognition is used.
  • Incremental source text recognition uses conversation.item.input_audio_transcription.text; 3.8 uses conversation.item.input_audio_transcription.delta.
  • For text-only output, 3.5 returns translation increments via response.text.text, and 3.8 uses response.text.delta. For text and audio output, 3.5 returns translation increments via response.audio_transcript.text, and 3.8 uses response.audio_transcript.delta.
For complete fields, defaults, and events, see Client Events, Server Events, and Real-Time Speech Translation Guide.

Input, Results, and Termination

Audio is sent via input_audio_buffer.append; input formats, submission conditions, and image input restrictions are described in Client Events. Handle results, status, and errors in Server Events; do not consider connection establishment as completion of a business request. Real-time translation uses this model’s translation configuration and events; do not apply Omni’s response.create dialogue flow. After input ends, send session.finish, keep the connection open, and continue receiving remaining results; close the WebSocket connection only after receiving session.finished. If full playback of the translated audio is required, finish local playback first. Specific event fields are detailed in Client Events and Server Events.

Error Handling

When a handshake fails, verify the domain name, region, workspace, API Key, model name, and model activation status and permissions. After the connection is established, locate the issue based on the error event, and refer to Error Codes. Retain the event ID for troubleshooting; do not assume protocol support is lacking simply because there is no response.

SDKs and reference