On this page

Configure Translation

2026-11-16

Feature Overview

During real-time speech recognition (ASR), you can enable the translation feature to translate recognized audio content into the target language in real-time.

  • This feature supports the following two main configuration modes:
    • Room-level translation: All streams in the room share one translation configuration.
    • Stream-level translation: Set personalized translation configurations for different streams in the room (e.g., different target languages).
  • Supported translation vendors/models. For the translation languages supported by each vendor, refer to the official documentation of the corresponding model:
    • Doubao doubao-seed-translation: The Volcengine Ark doubao-seed-translation translation model, ByteDance's self-developed multilingual translation model that supports dozens of languages with faithful and fluent translations. For details, refer to doubao-seed-translation model description.
    • Tongyi Qianwen Qwen-MT: The Alibaba Cloud Bailian Qwen-MT machine translation large model, optimized based on Qwen3, supporting translation between 92 languages. For details, refer to Translation Capability Qwen-MT.
    • Google Translate: Google Cloud Translation API (v2), which uses the nmt neural machine translation model by default and supports translation between 100+ languages. For details, refer to Google Cloud Translation documentation. (Note: Only available on overseas clusters)
  • Supported methods for obtaining translation results:
    • Server callback to get translation results.
    • Real-time audio/video room signaling (ZEGO Express SDK) callback.

Prerequisites

  1. Use a translation model supported by ZEGO cloud real-time speech recognition.
  2. Have activated the service of the corresponding translation vendor and obtained the model's API Key.

How to Use

When creating a real-time speech recognition task (StartRealtimeASRTask) or adding recognition streams (AddStream), enable translation with EnableTranslation and configure the vendor, source language, target language, and other parameters in Translation:

  • Room-level translation: Configure EnableTranslation and Translation at the task level, and all streams in the room share this translation configuration.
  • Stream-level translation: Configure EnableTranslation and Translation for each stream in StreamList (e.g., different target languages). When RecognitionRange is 1, the system reads the stream-level configuration first, and falls back to the outer EnableTranslation and Translation if the stream-level configuration is missing.

Translation Parameters

The translation-related parameters for creating a real-time speech recognition task are as follows:

ParameterTypeRequiredDescription
RecognitionRangeIntNoRecognition range. 0: entire room, 1: specified StreamList
StreamListarray of objectNoList of streams to recognize, effective when RecognitionRange is 1
EnableTranslationBoolNoWhether to enable translation
TranslationObjectNoTranslation LLM configuration item
SubtitleTypeIntNoSubtitle delivery type via room signaling, default is 0:
  • 0: No delivery
  • 1: Recognition results only (e.g., when a user says "你好" in Chinese, delivers "你好")
  • 2: Translation results only (e.g., when a user says "你好" in Chinese, delivers the translated "Hello")
  • 3: Both recognition and translation results (e.g., when a user says "你好" in Chinese, delivers both "你好" and "Hello")
If the client UI needs to display subtitles, it is recommended to set it to 1, 2, or 3

The translation-related parameters in StreamList are as follows:

ParameterTypeRequiredDescription
StreamIdStringYesStream ID to recognize
ASRObjectNoRefer to ASR Parameters
EnableTranslationBoolNoWhether to enable translation
TranslationObjectNoTranslation LLM configuration item

Translation

ParameterTypeRequiredDescription
VendorStringYesTranslation service vendor:
  • DoubaoSeedTranslation: Doubao translation
  • QwenMT: Tongyi Qianwen translation
  • GoogleTranslateV2: Google Translate
SourceLanguageStringNoSource language. The value must be an enum value of the corresponding translation vendor. For GoogleTranslateV2, it can be omitted or set to an empty string for automatic source language detection.
TargetLanguageStringYesTarget language
LLMObjectYesLLM parameters, see the table below
Note
SourceLanguage and TargetLanguage need to reference the enumeration values of the corresponding translation vendor. For sample configurations of each vendor, refer to the Using different translation vendors section.

LLM

ParameterTypeRequiredDescription
UrlStringDepends on vendorLLM endpoint, which varies by vendor:
  • DoubaoSeedTranslation: Required, e.g., https://ark.cn-beijing.volces.com/api/v3/responses
  • QwenMT: Required, e.g., https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions (China site) or https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 (International site)
  • GoogleTranslateV2: Optional. If not passed, the server default endpoint is used (https://translation.googleapis.com/language/translate/v2)
ApiKeyStringNoLLM verification API key. Default is empty. Make sure to fill in the corresponding API key in production environments.
ModelStringDepends on vendorModel to call, which varies by vendor:
  • DoubaoSeedTranslation: Fill in the corresponding translation model, e.g., doubao-seed-translation-250915
  • QwenMT: Fill in the corresponding translation model, e.g., qwen-mt-lite
  • GoogleTranslateV2: Optional. If not passed, nmt is used by default
ParamsObjectNoRequest parameters for the LLM or application platform. For supported parameters, refer to the official documentation of the corresponding model. GoogleTranslateV2 does not support passing through parameters.

AdvancedConfig

ParameterTypeRequiredDescription
TranslationRoomMessageModeIntNoRTC room message delivery mode for translated text:
  • 0: incremental text only, Cmd is 202 (default)
  • 1: complete text only, Cmd is 203
  • 2: both incremental and complete text
Takes effect only when SubtitleType is 2 or 3, and does not affect ASR subtitles or HTTP callbacks. For subtitle message formats, refer to Display Subtitles.

Usage Examples

Start a Recognition Task with Translation and Display Translation Results on the Client

Get Translation Results

Get Translation Results via the Server (Non-streaming)

Refer to the Receiving Callbacks documentation to get the Data result of the Event being TranslationResult.

(Optional) Display Subtitles on the Client

To display translation subtitles, refer to the Display Subtitles documentation.

Using different translation vendors

The detailed description and sample calls for each vendor are as follows (for supported translation languages, refer to each vendor's official documentation):

Previous

Display Subtitles

Next

Accessing Methods