Real-time speech translation

Updated at:
B(Server recognizes and translates speech to target language text.); B-->C(Server returns translated text to client.); C-->D(Client receives translated text.); ]]-->

1. Product overview

The Real-time Speech Translation OpenAPI is a WebSocket-based API for real-time speech translation. It converts input audio into target-language text and synthesized speech, enabling you to quickly build applications for real-time, cross-lingual communication.

The API provides two modes: one-way specified language translation and two-way auto-detected translation. It supports real-time audio input and continuously returns transcription, translation, and synthesized speech based on your configuration. You can choose to receive text-only or text-plus-audio output for low-latency cross-lingual communication.

2. Scenarios

  • Cross-border e-commerce and live streaming: Enables real-time multilingual communication between cross-border merchants and their overseas consumers, suppliers, and partners. Use cases include cross-border e-commerce live streaming, product inquiries, communication about orders, and after-sales customer service. It also translates a host's commentary in real time during live streams to help overseas consumers understand product information, which improves transaction conversion and service efficiency.

  • Cross-language communication and intelligent interaction: Ideal for scenarios such as international travel, business meetings, cross-border customer service, and integration with smart hardware. It provides real-time, two-way voice translation to break down language barriers and make cross-language communication more efficient.

3. Features

The one-way mode lets you specify a target language, while the two-way mode supports Chinese-English, Chinese-Japanese, and Chinese-Korean language pairs. Both modes support real-time audio stream processing. These features support a range of business applications built on the API.

Feature

Description

One-way translation to a specified language

Transcribes and translates input speech into a specified target language in real time. This mode is ideal for scenarios where the source language is known and the translation direction is fixed.

Two-way auto-detected translation

Supports the Chinese-English, Chinese-Japanese, and Chinese-Korean language pairs. The system automatically detects the spoken language and translates in both directions, eliminating the need to manually switch the translation direction for each turn.

Real-time source transcription

Generates a source transcription of the input speech during translation, providing both real-time updates and a final, complete transcript.

Real-time translation output

Continuously returns translated text, enabling the display of interim results in real time, followed by the final translation.

Translated speech synthesis

Synthesizes the translated text into speech in the target language. You can configure the output to include text only, or both text and audio.

Real-time audio stream processing

Using WebSocket, you can continuously stream audio chunks and receive translation results in real time, which eliminates the need to wait for a full file upload.

Speech segmentation

In one-way mode, you can use VAD for automatic speech start/end detection or Manual mode, which lets the client control audio submission. In two-way mode, the server handles segmentation through speech detection.

Usage notification

Receive notifications about audio processing and related metrics to help you track usage and manage your business operations.

4. Integration essentials

How to use: Use the SDK to establish a WebSocket persistent connection to send audio in real time and continuously receive original text, translated text, translated audio, and usage notifications.

Applicable version: Action=RealtimeSpeechTranslation, Version=2026-04-28.

The SDK handles the signature, TLS, and WebSocket handshake. Do not use the backend internal path /v1/realtime/translations.

Item

Value

OpenAPI endpoint

aidge.cn-beijing.aliyuncs.com

WebSocket URL

wss://aidge.cn-beijing.aliyuncs.com/

SDK subprotocol

general (set by the SDK)

Message format

UTF-8 JSON text frames. Audio must be Base64-encoded. Do not send binary frames.

Authentication

The SDK uses an AccessKey signature. Do not implement the ACS3 signature yourself.

Connection successful

An HTTP 101 response confirms the WebSocket is connected, but you cannot send audio yet.

Ready to send audio

Upon receiving a SessionUpdated message.

5. Translation modes

Note: For bidirectional translation, the language pair must include Chinese, and the two languages must be different. For example, ['en', 'zh'] is valid, but ['en', 'ja'] is not.

Mode

Use case

Language support

Output organization

single

One-way simultaneous translation to a specified target language.

Supports 60 language codes, 29 of which support both translated text and translated audio.

The remaining languages support translated text output only.

response_id / item_id

bidirectional

Bidirectional translation for Chinese-English, Chinese-Japanese, and Chinese-Korean pairs without needing to specify a target language.

Only zh/en, zh/ja, and zh/ko are supported. The order can be reversed.

segment_id. Source transcriptions are identified separately using transcription_id.

6. Calling sequence

Establish WebSocket connection (HTTP 101)
    ↓
SessionCreate → SessionCreated
    ↓
SessionUpdate → SessionUpdated  ← Do not send audio before this
    ↓
Loop: InputAudioBufferAppend + consume downstream events
    ↓
Manual mode: InputAudioBufferCommit → InputAudioBufferCommitted
    ↓
SessionFinish → Receive final results and UsageReported
    ↓
SessionFinished (check usage_complete) → Close the connection

You must follow these rules:

  • Send SessionCreate and SessionUpdate only once per connection. To change the language, sample rate, or output method, create a new connection.

  • Upload audio and receive results in parallel. Do not wait for the entire audio upload to complete before reading downstream messages.

  • In VAD mode, do not send Commit or Clear. In Manual mode, the client sends Commit for each utterance.

  • After sending SessionFinish, stop all input but continue to receive data until you receive SessionFinished, the session times out, or the connection is lost.

  • An HTTP 101 response, a Done event, or a closed connection does not mean the entire session was successful.

  • Resumable transfer is not supported. After a reconnection, create and update the session again. Do not automatically replay all historical audio, as this may lead to duplicate output and duplicate billing.

7. SDK call method

7.1 SDK installation

For installation instructions, see SDK Installation.

image

7.2 Python example

"""python main.py single|bidirectional input.pcm output.pcm"""
import base64
import json
import os
from pathlib import Path
import queue
import sys
import time
import uuid

from alibabacloud_aidge20260428.client import Client
from alibabacloud_aidge20260428.models import RealtimeSpeechTranslationRequest
from alibabacloud_tea_openapi.utils_models import Config
from alibabacloud_tea_openapi.websocket_utils import GeneralWebSocketHandler
from darabonba.runtime import RuntimeOptions


class Handler(GeneralWebSocketHandler):
    def __init__(self):
        super().__init__()
        self.events = queue.Queue()

    def handle_general_message(self, session, message):
        self.events.put(message["body"])

    def handle_error(self, session, error):
        self.events.put(RuntimeError(str(error)))

    def after_connection_closed(self, session, code, reason):
        self.events.put(ConnectionError(f"WebSocket closed: {code} {reason}"))


def required_env(name):
    value = os.getenv(name)
    if not value or not value.strip():
        raise ValueError("Set " + name)
    return value


def main():
    mode, source, target = sys.argv[1:]
    if mode not in ("single", "bidirectional"):
        raise ValueError("mode must be single or bidirectional")
    pcm = Path(source).read_bytes()
    if not pcm or len(pcm) % 2:
        raise ValueError("input must be nonempty PCM16LE, mono, 16000Hz; no WAV header")
    handler = Handler()
    client = Client(Config(
        access_key_id=required_env("ALIBABA_CLOUD_ACCESS_KEY_ID"),
        access_key_secret=required_env("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
        endpoint="aidge.cn-beijing.aliyuncs.com"))
    runtime = RuntimeOptions(web_socket_handler=handler, web_socket_handshake_timeout=15000,
        web_socket_enable_reconnect=False, autoretry=False, max_attempts=1)
    ws = client.realtime_speech_translation_with_options(
        RealtimeSpeechTranslationRequest(), runtime).web_socket_client
    print("RequestId:", ws.get_response().headers.get("x-acs-request-id"), flush=True)
    seen, pending = set(), set()

    def send(kind, **fields):
        # Send the business event at the JSON root; the general helper adds a body wrapper.
        ws.ws_client.send_text(json.dumps({"type": kind, "event_id": str(uuid.uuid4()), **fields}))

    try:
        with open(target, "wb") as audio:
            def receive(timeout):
                event = handler.events.get(timeout=timeout)
                if isinstance(event, Exception):
                    raise event
                if isinstance(event, str):
                    event = json.loads(event)
                kind = event.get("type")
                if kind in ("RealtimeError", "Error", "error") or "Code" in event:
                    raise RuntimeError(json.dumps(event, ensure_ascii=False))
                if kind in ("ResponseAudioDelta", "TranslationAudioDelta"):
                    audio.write(base64.b64decode(event.get("delta") or event["audio"]))
                else:
                    print(json.dumps(event, ensure_ascii=False), flush=True)
                if kind == "ResponseCreated":
                    pending.add(event["response"]["id"])
                if kind == "ResponseDone":
                    if event["response"]["status"] != "completed":
                        raise RuntimeError("ResponseDone did not complete")
                    pending.discard(event["response"]["id"])
                if kind == "SessionFinished" and event.get("reason", "completed") != "completed":
                    raise RuntimeError("SessionFinished did not complete")
                seen.add(kind)

            def wait(kind):
                deadline = time.monotonic() + 60
                while kind not in seen or (kind == "ResponseDone" and pending):
                    remaining = deadline - time.monotonic()
                    if remaining <= 0:
                        raise TimeoutError("Timeout waiting for " + kind)
                    receive(remaining)

            send("SessionCreate", **({"mode": "single"} if mode == "single" else
                {"session": {"mode": mode, "language_pair": ["zh", "en"]}}))
            wait("SessionCreated")
            vad = {"type": "server_vad", "threshold": 0.2, "silence_duration_ms": 1000}
            config = ({"modalities": ["text", "audio"], "sample_rate": 16000,
                "input_audio_format": "pcm", "input_audio_transcription": {"model": None},
                "translation": {"language": "en"}, "output_audio_format": "pcm",
                "voice": "Tina", "enable_voice_clone": False, "turn_detection": vad}
                if mode == "single" else {
                "input_audio": {"format": "pcm_s16le", "sample_rate": 16000, "channels": 1},
                "output": {"modalities": ["text", "audio"], "audio": {"format": "pcm_s16le",
                    "sample_rate": 24000, "channels": 1, "voice": {"mode": "preset", "id": "Tina"}}},
                "transcription": {"enabled": True}, "turn_detection": vad})
            send("SessionUpdate", session=config)
            wait("SessionUpdated")
            pcm += bytes(16000 * 2 * 3 // 2)  # 1.5s tail silence lets VAD finish the last sentence.
            for offset in range(0, len(pcm), 3200):
                chunk = pcm[offset:offset + 3200]
                send("InputAudioBufferAppend", audio=base64.b64encode(chunk).decode())
                time.sleep(len(chunk) / 32000)
                while not handler.events.empty():
                    receive(0)
            if mode == "single":
                wait("ResponseDone")
            send("SessionFinish", reason="completed")
            wait("SessionFinished")
    finally:
        ws.close()


if __name__ == "__main__":
    main()

7.3 Java example

Synchronous call example

import com.aliyun.tea.TeaRequest;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.OutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

/** Self-contained synchronous example: Tea signing + JDK WebSocket. Requires JDK 17. */
public class TeaExample implements WebSocket.Listener {
    static final String ENDPOINT = "aidge.cn-beijing.aliyuncs.com";
    static final ObjectMapper JSON = new ObjectMapper();
    final BlockingQueue<Object> events = new LinkedBlockingQueue<>();
    final Set<String> seen = new HashSet<>(), pending = new HashSet<>();
    final StringBuilder fragments = new StringBuilder();
    WebSocket ws;
    OutputStream audio;

    static String env(String key) {
        String value = System.getenv(key);
        if (value == null || value.isBlank()) throw new IllegalArgumentException("Set " + key);
        return value;
    }

    static void sign(Map<String, String> headers) throws Exception {
        String algorithm = "ACS3-HMAC-SHA256";
        String hash = com.aliyun.openapiutil.Client.hexEncode(
                com.aliyun.openapiutil.Client.hash(new byte[0], algorithm));
        headers.put("x-acs-content-sha256", hash);
        TeaRequest request = TeaRequest.create();
        request.method = "GET";
        request.pathname = "/";
        request.query = Map.of();
        request.headers = headers;
        headers.put("authorization", com.aliyun.openapiutil.Client.getAuthorization(
                request, algorithm, hash, env("ALIBABA_CLOUD_ACCESS_KEY_ID"),
                env("ALIBABA_CLOUD_ACCESS_KEY_SECRET")));
    }

    public static void main(String[] args) throws Exception {
        if (args.length != 3 || !(args[0].equals("single") || args[0].equals("bidirectional")))
            throw new IllegalArgumentException("Usage: TeaExample single|bidirectional input.pcm output.pcm");
        byte[] pcm = Files.readAllBytes(Path.of(args[1]));
        if (pcm.length == 0 || pcm.length % 2 != 0)
            throw new IllegalArgumentException("Expected PCM16LE, mono, 16000Hz; no WAV header");
        boolean single = args[0].equals("single");
        Map<String, String> headers = new HashMap<>();
        headers.put("host", ENDPOINT);
        headers.put("x-acs-action", "RealtimeSpeechTranslation");
        headers.put("x-acs-version", "2026-04-28");
        headers.put("x-acs-date", Instant.now().truncatedTo(ChronoUnit.SECONDS).toString());
        headers.put("x-acs-signature-nonce", UUID.randomUUID().toString());
        sign(headers);
        TeaExample session = new TeaExample();
        try (OutputStream output = Files.newOutputStream(Path.of(args[2]))) {
            session.audio = output;
            var builder = HttpClient.newHttpClient().newWebSocketBuilder()
                    .connectTimeout(Duration.ofSeconds(15)).subprotocols("general");
            // Host/Connection/Upgrade/Sec-WebSocket-* are generated and validated by the JDK.
            headers.forEach((key, value) -> { if (!key.equals("host")) builder.header(key, value); });
            session.ws = builder.buildAsync(URI.create("wss://" + ENDPOINT + "/"), session)
                    .get(20, TimeUnit.SECONDS);
            session.send("SessionCreate", single ? "\"mode\":\"single\""
                    : "\"session\":{\"mode\":\"bidirectional\",\"language_pair\":[\"zh\",\"en\"]}");
            session.waitFor("SessionCreated");
            String config = single ? """
                    {"modalities":["text","audio"],"sample_rate":16000,"input_audio_format":"pcm",
                     "input_audio_transcription":{"model":null},"translation":{"language":"en"},
                     "output_audio_format":"pcm","voice":"Tina","enable_voice_clone":false,
                     "turn_detection":{"type":"server_vad","threshold":0.2,"silence_duration_ms":1000}}
                    """ : """
                    {"input_audio":{"format":"pcm_s16le","sample_rate":16000,"channels":1},
                     "output":{"modalities":["text","audio"],"audio":{"format":"pcm_s16le",
                        "sample_rate":24000,"channels":1,"voice":{"mode":"preset","id":"Tina"}}},
                     "transcription":{"enabled":true},
                     "turn_detection":{"type":"server_vad","threshold":0.2,"silence_duration_ms":1000}}
                    """;
            session.send("SessionUpdate", "\"session\":" + config);
            session.waitFor("SessionUpdated");
            pcm = Arrays.copyOf(pcm, pcm.length + 48000); // 1.5s VAD tail silence.
            for (int offset = 0; offset < pcm.length; offset += 3200) {
                byte[] chunk = Arrays.copyOfRange(pcm, offset, Math.min(offset + 3200, pcm.length));
                session.send("InputAudioBufferAppend", "\"audio\":\"" + Base64.getEncoder().encodeToString(chunk) + "\"");
                Thread.sleep(chunk.length * 1000L / 32000);
                while (!session.events.isEmpty()) session.receive(0);
            }
            if (single) session.waitFor("ResponseDone");
            session.send("SessionFinish", "\"reason\":\"completed\"");
            session.waitFor("SessionFinished");
        } finally {
            if (session.ws != null) {
                try { session.ws.sendClose(1000, "completed").get(2, TimeUnit.SECONDS); }
                finally { session.ws.abort(); }
            }
        }
    }

    void send(String type, String fields) {
        ws.sendText("{\"type\":\"" + type + "\",\"event_id\":\"" + UUID.randomUUID() + "\"," + fields + "}", true).join();
    }

    void waitFor(String type) throws Exception {
        long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(60);
        while (!seen.contains(type) || (type.equals("ResponseDone") && !pending.isEmpty())) {
            long remaining = deadline - System.nanoTime();
            if (remaining <= 0) throw new IllegalStateException("Timeout waiting for " + type);
            receive(Math.max(1, TimeUnit.NANOSECONDS.toMillis(remaining)));
        }
    }

    void receive(long timeout) throws Exception {
        Object message = events.poll(timeout, TimeUnit.MILLISECONDS);
        if (message == null) throw new IllegalStateException("Timeout waiting for event");
        if (message instanceof Exception error) throw error;
        JsonNode event = JSON.readTree((String) message);
        String type = event.path("type").asText();
        if (Set.of("RealtimeError", "Error", "error").contains(type) || event.has("Code"))
            throw new IllegalStateException(event.toString());
        if (type.equals("ResponseAudioDelta") || type.equals("TranslationAudioDelta"))
            audio.write(Base64.getDecoder().decode(event.path(type.equals("ResponseAudioDelta") ? "delta" : "audio").asText()));
        else System.out.println(event);
        if (type.equals("ResponseCreated")) pending.add(event.path("response").path("id").asText());
        if (type.equals("ResponseDone")) {
            if (!event.path("response").path("status").asText().equals("completed"))
                throw new IllegalStateException("ResponseDone did not complete");
            pending.remove(event.path("response").path("id").asText());
        }
        if (type.equals("SessionFinished") && !event.path("reason").asText("completed").equals("completed"))
            throw new IllegalStateException("SessionFinished did not complete");
        seen.add(type);
    }

    @Override public void onOpen(WebSocket socket) { socket.request(1); }
    @Override public CompletionStage<?> onText(WebSocket socket, CharSequence text, boolean last) {
        fragments.append(text);
        if (last) { events.add(fragments.toString()); fragments.setLength(0); }
        socket.request(1);
        return null;
    }
    @Override public CompletionStage<?> onClose(WebSocket socket, int code, String reason) {
        events.add(new IllegalStateException("WebSocket closed: " + code + " " + reason));
        return null;
    }
    @Override public void onError(WebSocket socket, Throwable error) { events.add(new RuntimeException(error)); }
}

Asynchronous call example

import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.signature.SignerParams;
import com.aliyun.core.http.HttpMethod;
import com.aliyun.sdk.gateway.pop.auth.SignatureAlgorithm;
import com.aliyun.sdk.gateway.pop.auth.SignatureComposer;
import com.aliyun.sdk.gateway.pop.auth.signer.PopV3Signer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.OutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.HashSet;
import java.util.HexFormat;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;

/** Java Async SDK signing + asynchronous JDK WebSocket; the generated HTTP API has no WS support. */
public class AsyncExample {
    static final String ENDPOINT = "aidge.cn-beijing.aliyuncs.com";
    static final ObjectMapper JSON = new ObjectMapper();

    public static void main(String[] args) {
        if (args.length != 3) throw new IllegalArgumentException(
                "Usage: AsyncExample single|bidirectional input.pcm output.pcm");
        // Only the CLI waits here to stay alive. Applications can attach callbacks to translate().
        translate(args[0], Path.of(args[1]), Path.of(args[2])).join();
    }

    public static CompletableFuture<Void> translate(String mode, Path input, Path output) {
        if (!Set.of("single", "bidirectional").contains(mode))
            return CompletableFuture.failedFuture(new IllegalArgumentException("Invalid mode"));
        return new Session(mode.equals("single"), input, output).start();
    }

    static Map<String, String> signedHeaders() {
        Map<String, String> headers = new HashMap<>();
        headers.put("host", ENDPOINT);
        headers.put("x-acs-action", "RealtimeSpeechTranslation");
        headers.put("x-acs-version", "2026-04-28");
        headers.put("x-acs-date", Instant.now().truncatedTo(ChronoUnit.SECONDS).toString());
        headers.put("x-acs-signature-nonce", UUID.randomUUID().toString());
        String ak = env("ALIBABA_CLOUD_ACCESS_KEY_ID");
        PopV3Signer signer = new PopV3Signer(SignatureAlgorithm.ACS3_HMAC_SHA256);
        String hash = HexFormat.of().formatHex(signer.hash(new byte[0]));
        headers.put("x-acs-content-sha256", hash);
        String canonical = SignatureComposer.composeStringToSign(HttpMethod.GET, Map.of(), headers, "/", hash);
        String toSign = signer.getSignerName() + "\n" + HexFormat.of().formatHex(
                signer.hash(canonical.getBytes(StandardCharsets.UTF_8)));
        SignerParams params = SignerParams.create();
        params.setCredentials(Credential.builder().accessKeyId(ak)
                .accessKeySecret(env("ALIBABA_CLOUD_ACCESS_KEY_SECRET")).build());
        headers.put("authorization", signer.getSignerName() + " Credential=" + ak
                + ",SignedHeaders=" + SignatureComposer.buildSignedHeaders(headers)
                + ",Signature=" + signer.signString(toSign, params));
        return headers;
    }

    static String env(String key) {
        String value = System.getenv(key);
        if (value == null || value.isBlank()) throw new IllegalArgumentException("Set " + key);
        return value;
    }

    static class Session implements WebSocket.Listener {
        final boolean single;
        final Path source, target;
        final CompletableFuture<Void> created = new CompletableFuture<>(), updated = new CompletableFuture<>(),
                responsesDone = new CompletableFuture<>(), finished = new CompletableFuture<>(),
                failure = new CompletableFuture<>(), result = new CompletableFuture<>();
        final Set<String> pending = new HashSet<>();
        final StringBuilder fragments = new StringBuilder();
        CompletableFuture<Void> incoming = CompletableFuture.completedFuture(null);
        volatile WebSocket ws;
        volatile boolean closing;
        OutputStream audio;
        byte[] pcm;
        boolean inputEnded, finishSent, textReceived, audioDone;
        int completedResponses;

        Session(boolean single, Path source, Path target) {
            this.single = single; this.source = source; this.target = target;
        }

        CompletableFuture<Void> start() {
            // File preparation runs off the caller thread; network operations stay asynchronous.
            CompletableFuture<Void> flow = CompletableFuture.runAsync(this::prepare)
                    .thenCompose(v -> connect())
                    .thenCompose(v -> send("SessionCreate", single ? "\"mode\":\"single\""
                            : "\"session\":{\"mode\":\"bidirectional\",\"language_pair\":[\"zh\",\"en\"]}"))
                    .thenCompose(v -> created.orTimeout(60, TimeUnit.SECONDS))
                    .thenCompose(v -> send("SessionUpdate", "\"session\":" + configuration()))
                    .thenCompose(v -> updated.orTimeout(60, TimeUnit.SECONDS))
                    .thenCompose(v -> stream(0))
                    .thenCompose(v -> single ? awaitResponses() : CompletableFuture.completedFuture(null))
                    .thenCompose(v -> finish())
                    .thenCompose(v -> finished.orTimeout(60, TimeUnit.SECONDS));
            CompletableFuture.anyOf(flow, failure).whenComplete((v, error) -> cleanup(error));
            result.whenComplete((v, error) -> {
                if (result.isCancelled()) fail(new CancellationException("Translation cancelled"));
            });
            return result;
        }

        void prepare() {
            try {
                byte[] input = Files.readAllBytes(source);
                if (input.length == 0 || input.length % 2 != 0)
                    throw new IllegalArgumentException("Expected PCM16LE, mono, 16000Hz; no WAV header");
                synchronized (this) {
                    if (closing) throw new CancellationException("Session closed");
                    audio = Files.newOutputStream(target);
                    pcm = Arrays.copyOf(input, input.length + 48000); // 1.5s VAD tail silence.
                }
            } catch (Exception error) { throw new CompletionException(error); }
        }

        CompletableFuture<Void> connect() {
            if (closing) return CompletableFuture.failedFuture(new CancellationException("Session closed"));
            var builder = HttpClient.newHttpClient().newWebSocketBuilder()
                    .connectTimeout(Duration.ofSeconds(15)).subprotocols("general");
            signedHeaders().forEach((key, value) -> { if (!key.equals("host")) builder.header(key, value); });
            return builder.buildAsync(URI.create("wss://" + ENDPOINT + "/"), this).thenAccept(socket -> {
                synchronized (this) { if (closing) socket.abort(); else ws = socket; }
            });
        }

        synchronized CompletableFuture<Void> send(String type, String fields) {
            if (closing) return CompletableFuture.failedFuture(new CancellationException("Session closed"));
            String event = "{\"type\":\"" + type + "\",\"event_id\":\"" + UUID.randomUUID() + "\"," + fields + "}";
            return ws.sendText(event, true).orTimeout(15, TimeUnit.SECONDS).thenApply(socket -> null);
        }

        CompletableFuture<Void> stream(int offset) {
            if (closing) return CompletableFuture.failedFuture(new CancellationException("Session closed"));
            if (offset >= pcm.length) return CompletableFuture.completedFuture(null);
            byte[] chunk = Arrays.copyOfRange(pcm, offset, Math.min(offset + 3200, pcm.length));
            return send("InputAudioBufferAppend", "\"audio\":\"" + Base64.getEncoder().encodeToString(chunk) + "\"")
                    .thenCompose(v -> CompletableFuture.runAsync(() -> {},
                            CompletableFuture.delayedExecutor(chunk.length * 1000L / 32000, TimeUnit.MILLISECONDS)))
                    .thenCompose(v -> stream(offset + chunk.length));
        }

        synchronized CompletableFuture<Void> awaitResponses() {
            inputEnded = true;
            checkResponses();
            return responsesDone.orTimeout(60, TimeUnit.SECONDS);
        }

        void checkResponses() {
            if (inputEnded && completedResponses > 0 && pending.isEmpty() && textReceived && audioDone)
                responsesDone.complete(null);
        }

        synchronized CompletableFuture<Void> finish() {
            finishSent = true;
            return send("SessionFinish", "\"reason\":\"completed\"");
        }

        String configuration() {
            return single ? """
                    {"modalities":["text","audio"],"sample_rate":16000,"input_audio_format":"pcm",
                     "input_audio_transcription":{"model":null},"translation":{"language":"en"},
                     "output_audio_format":"pcm","voice":"Tina","enable_voice_clone":false,
                     "turn_detection":{"type":"server_vad","threshold":0.2,"silence_duration_ms":1000}}
                    """ : """
                    {"input_audio":{"format":"pcm_s16le","sample_rate":16000,"channels":1},
                     "output":{"modalities":["text","audio"],"audio":{"format":"pcm_s16le",
                       "sample_rate":24000,"channels":1,"voice":{"mode":"preset","id":"Tina"}}},
                     "transcription":{"enabled":true},
                     "turn_detection":{"type":"server_vad","threshold":0.2,"silence_duration_ms":1000}}
                    """;
        }

        synchronized void receive(String message) throws Exception {
            if (closing) return;
            JsonNode event = JSON.readTree(message);
            String type = event.path("type").asText();
            if (Set.of("RealtimeError", "Error", "error").contains(type) || event.has("Code"))
                throw new IllegalStateException(event.toString());
            if (type.equals("ResponseAudioDelta") || type.equals("TranslationAudioDelta"))
                audio.write(Base64.getDecoder().decode(event.path(type.equals("ResponseAudioDelta") ? "delta" : "audio").asText()));
            else System.out.println(event);
            switch (type) {
                case "SessionCreated" -> created.complete(null);
                case "SessionUpdated" -> updated.complete(null);
                case "ResponseCreated" -> pending.add(event.path("response").path("id").asText());
                case "ResponseAudioTranscriptDone", "ResponseTextDone" -> textReceived |=
                        !event.path("text").asText(event.path("transcript").asText()).isBlank();
                case "ResponseAudioDone" -> audioDone = true;
                case "ResponseDone" -> {
                    if (!event.path("response").path("status").asText().equals("completed"))
                        throw new IllegalStateException("ResponseDone did not complete");
                    completedResponses++;
                    pending.remove(event.path("response").path("id").asText());
                }
                case "SessionFinished" -> {
                    if (!finishSent || !event.path("reason").asText("completed").equals("completed"))
                        throw new IllegalStateException("SessionFinished did not complete");
                    finished.complete(null);
                }
                default -> { }
            }
            checkResponses();
        }

        void fail(Throwable error) {
            failure.completeExceptionally(error);
            for (var waiter : new CompletableFuture<?>[]{created, updated, responsesDone, finished})
                waiter.completeExceptionally(error);
        }

        synchronized void cleanup(Throwable error) {
            if (closing) return;
            closing = true;
            CompletableFuture<?> close;
            if (ws == null) close = CompletableFuture.completedFuture(null);
            else if (error != null) { ws.abort(); close = CompletableFuture.completedFuture(null); }
            else close = ws.sendClose(1000, "completed").orTimeout(2, TimeUnit.SECONDS);
            close.whenComplete((v, closeError) -> {
                if (ws != null) ws.abort();
                Throwable cause = error != null ? error : closeError;
                try { if (audio != null) audio.close(); }
                catch (Exception fileError) { if (cause == null) cause = fileError; else cause.addSuppressed(fileError); }
                if (cause == null) result.complete(null); else result.completeExceptionally(cause);
            });
        }

        @Override public void onOpen(WebSocket socket) { socket.request(1); }
        @Override public synchronized CompletionStage<?> onText(WebSocket socket, CharSequence text, boolean last) {
            fragments.append(text);
            if (last) {
                String message = fragments.toString();
                fragments.setLength(0);
                // Preserve event order, and keep JSON/file handling off the network callback thread.
                incoming = incoming.thenRunAsync(() -> {
                    try { receive(message); } catch (Exception error) { throw new CompletionException(error); }
                });
                incoming.whenComplete((v, error) -> { if (error != null) fail(error); });
            }
            socket.request(1);
            return incoming;
        }
        @Override public CompletionStage<?> onClose(WebSocket socket, int code, String reason) {
            if (!closing) fail(new IllegalStateException("WebSocket closed: " + code + " " + reason));
            return null;
        }
        @Override public void onError(WebSocket socket, Throwable error) { fail(error); }
    }
}

7.4 Node.js example

// node main.cjs single|bidirectional input.pcm output.pcm
const fs = require('node:fs');
const { randomUUID } = require('node:crypto');
const { setTimeout: sleep } = require('node:timers/promises');
const Aidge = require('@alicloud/aidge20260428');
const OpenApi = require('@alicloud/openapi-core');
const dara = require('@darabonba/typescript');

// The online gateway does not negotiate a WebSocket subprotocol.
// This override prevents the 'ws' client from offering a subprotocol, which would cause the handshake to fail.
class Client extends Aidge.default {
  doRequest(params, request, runtime) {
    request.headers = new Proxy(request.headers || {}, {
      set(headers, key, value) {
        if (key !== 'sec-websocket-protocol') headers[key] = value;
        return true;
      },
    });
    return super.doRequest(params, request, runtime);
  }
}

function requiredEnv(name) {
  const value = process.env[name];
  if (!value || !value.trim()) throw new Error('Set ' + name);
  return value;
}

async function main() {
  const [mode, source, target] = process.argv.slice(2);
  if (!['single', 'bidirectional'].includes(mode) || !source || !target)
    throw new Error('Usage: node main.cjs single|bidirectional input.pcm output.pcm');
  let pcm = fs.readFileSync(source);
  if (!pcm.length || pcm.length % 2) throw new Error('Expected PCM16LE, mono, 16000Hz; no WAV header');
  const events = [], seen = new Set(), pending = new Set();
  class Handler extends OpenApi.$WebSocketUtils.AbstractGeneralWebSocketHandler {
    handleGeneralMessage(session, message) { events.push(message.body); }
    handleError(session, error) { events.push(error); }
    afterConnectionClosed(session, code, reason) { events.push(new Error(`WebSocket closed: ${code} ${reason}`)); }
  }
  const client = new Client(new OpenApi.$OpenApiUtil.Config({
    accessKeyId: requiredEnv('ALIBABA_CLOUD_ACCESS_KEY_ID'),
    accessKeySecret: requiredEnv('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
    endpoint: 'aidge.cn-beijing.aliyuncs.com',
  }));
  const response = await client.realtimeSpeechTranslationWithOptions(
    new Aidge.RealtimeSpeechTranslationRequest({}), new dara.RuntimeOptions({
      webSocketHandler: new Handler(), webSocketHandshakeTimeout: 15000,
      webSocketEnableReconnect: false, autoretry: false, maxAttempts: 1,
    }));
  const ws = response.webSocketClient;
  // Save the session ID returned by the gateway. This helps Alibaba Cloud Support troubleshoot issues.
  console.log('RequestId:', ws.getResponse().headers['x-acs-request-id']);
  // This SDK's general helper wraps {body: ...}; the gateway requires $.type at the root.
  const send = (type, fields = {}) => ws.wsClient.sendText(JSON.stringify({ type, event_id: randomUUID(), ...fields }));
  let output;
  try {
    output = fs.openSync(target, 'w');
    function receive(event) {
      if (event instanceof Error) throw event;
      if (typeof event === 'string') event = JSON.parse(event);
      const type = event.type;
      if (['RealtimeError', 'Error', 'error'].includes(type) || event.Code)
        throw new Error(JSON.stringify(event));
      if (['ResponseAudioDelta', 'TranslationAudioDelta'].includes(type))
        fs.writeSync(output, Buffer.from(event.delta || event.audio, 'base64'));
      else console.log(JSON.stringify(event));
      if (type === 'ResponseCreated') pending.add(event.response.id);
      if (type === 'ResponseDone') {
        if (event.response.status !== 'completed') throw new Error('ResponseDone did not complete');
        pending.delete(event.response.id);
      }
      if (type === 'SessionFinished' && event.reason && event.reason !== 'completed')
        throw new Error('SessionFinished did not complete');
      seen.add(type);
    }
    function drain() { while (events.length) receive(events.shift()); }
    async function wait(type) {
      const deadline = Date.now() + 60000;
      while (!seen.has(type) || (type === 'ResponseDone' && pending.size)) {
        if (Date.now() > deadline) throw new Error(`Timeout waiting for ${type}`);
        if (events.length) receive(events.shift()); else await sleep(10);
      }
    }
    await send('SessionCreate', mode === 'single' ? {mode} : {session: {mode, language_pair: ['zh', 'en']}});
    await wait('SessionCreated');
    const vad = {type: 'server_vad', threshold: 0.2, silence_duration_ms: 1000};
    const session = mode === 'single' ? {
      modalities: ['text', 'audio'], sample_rate: 16000, input_audio_format: 'pcm',
      input_audio_transcription: {model: null}, translation: {language: 'en'},
      output_audio_format: 'pcm', voice: 'Tina', enable_voice_clone: false, turn_detection: vad,
    } : {
      input_audio: {format: 'pcm_s16le', sample_rate: 16000, channels: 1},
      output: {modalities: ['text', 'audio'], audio: {format: 'pcm_s16le', sample_rate: 24000,
        channels: 1, voice: {mode: 'preset', 'id': 'Tina'}}},
      transcription: {enabled: true}, turn_detection: vad,
    };
    await send('SessionUpdate', {session});
    await wait('SessionUpdated');
    pcm = Buffer.concat([pcm, Buffer.alloc(48000)]); // 1.5s VAD tail silence.
    for (let offset = 0; offset < pcm.length; offset += 3200) {
      const chunk = pcm.subarray(offset, offset + 3200);
      await send('InputAudioBufferAppend', {audio: chunk.toString('base64')});
      await sleep(chunk.length / 32);
      drain();
    }
    if (mode === 'single') await wait('ResponseDone');
    await send('SessionFinish', {reason: 'completed'});
    await wait('SessionFinished');
  } finally {
    if (output !== undefined) fs.closeSync(output);
    await ws.close();
  }
}

main().catch(error => { console.error(error.message); process.exitCode = 1; });

8. Developer guide

8.1 Connecting

WebSocket URL

After you configure the endpoint, connect to aidge.cn-beijing.aliyuncs.com.

Successful connection

After a successful WebSocket handshake, the server returns a 101 status code.

8.2 General conventions

Language code

Use BCP 47 short codes, such as zh, ko, and ja.

Audio requirements and chunking recommendations

Note: When streaming a VAD file, append approximately 1.5 seconds of silence to the end to help trigger the default 1000 ms endpointing. This is an example strategy, and any appended silence is counted as sent audio.

Item

Requirement

PCM input

PCM16LE, mono, with a sampling rate of 8000 Hz or 16000 Hz.

Bidirectional input format

Only pcm_s16le is supported.

Unidirectional input format

pcm or opus. Opus packaging and chunking require integration testing with the service provider.

Translated audio output

PCM16LE, 24 kHz, mono.

Chunk size limit

Chunks must not be empty after Base64 decoding and must not exceed 10,240 bytes. The byte count for PCM data must be even.

Recommended chunk size

100 ms: 3,200 bytes for 16 kHz audio or 1,600 bytes for 8 kHz audio. For best performance, send chunks in real time.

WAV file

Send only the PCM data section. Do not send the WAV file header.

8.3 Common event fields

Field

Type

Upstream required

Downstream required

Default

Description

type

String

Yes

Yes

None

The event type. This field is case-sensitive and uses PascalCase, such as SessionCreate, SessionCreated, and TranslationTextDelta.

event_id

String

No

Returned for standard events

No fixed value

The event ID. For an upstream event, the client generates this ID. If provided, it must be a non-empty, non-whitespace-only string. We recommend using a new UUID for each event. If this field is omitted, the server does not populate it. For a downstream event, the server or model generates a new ID that does not match the event_id of the corresponding upstream event.

session_id

String

No

Yes

No fixed value

The current session ID. The server populates this field with the value of the gateway's x-acs-ws-session-id. The ID remains the same for a single connection. The client should treat this value as an opaque string.

8.4 Client events

Event name

Name

Applicable mode

Description

SessionCreate

Create session

one-way, two-way

Creates a WebSocket simultaneous interpretation session and sets the mode and language pair.

SessionUpdate

Update session configuration

one-way, two-way

Configures the translation language, audio format, sample rate, output method, timbre, and sentence segmentation mode.

InputAudioBufferAppend

Append input audio

one-way, two-way

Continuously sends Base64-encoded audio data to the server.

InputAudioBufferCommit

Commit audio buffer

one-way, two-way (Manual)

Manually commits the current audio buffer to trigger recognition and interpretation.

InputAudioBufferClear

Clear audio buffer

one-way, two-way (Manual)

Clears any unprocessed input audio.

SessionFinish

Finish session

one-way, two-way

Instructs the server to stop accepting new input audio, process any remaining audio, and finish the session.

Event SessionCreate

Send this once the connection is established. As a best practice, put all configuration in the session. After receiving SessionCreated, send SessionUpdate.

Field

Type

Required

Default

Description

type

String

Yes

None

The value must be SessionCreate. This field is case-sensitive.

event_id

String

No

None. Not auto-generated.

A client-generated event ID. If provided, it must be a non-empty, non-whitespace-only string. We recommend using a unique value for each event.

session

Object

Yes

None

Creates a parameter object. For one-way creation, only mode is supported internally. The parameter must be an object.

session.mode

String

Yes

single

The value must be single or bidirectional.

session.language_pair

Array<String>

Required when mode is bidirectional.

None

The language pair for bidirectional translation. This pair must include Chinese (zh), and the two languages must be different. For example: ["zh", "en"], ["zh", "ja"], or ["zh", "ko"]. The order of languages in the array does not matter.

{
  "type": "SessionCreate",
  "event_id": "evt_single_create_001",
  "session": {
    "mode": "single"
  }
}
{
  "type": "SessionCreate",
  "event_id": "evt_bidirectional_create_001",
  "session": {
    "mode": "bidirectional",
    "language_pair": ["zh", "en"]
  }
}

Event: SessionUpdate

Writable unidirectional session fields

Field

Type

Required

Default

Description

session.mode

String

No

The current value.

If provided, the value must be single. The mode cannot be changed.

session.translation

Object

Yes

None

The translation configuration.

session.translation.language

String

Yes

None

The target language code. For a list of supported languages, see "5. Supported Languages". This field is required and cannot be auto.

session.modalities

Array

No

["text"]

["text","audio"]

Valid values are ["text"] or ["text", "audio"]. The array cannot contain duplicate values or be set to ["audio"]. If the target language supports only text output, you must explicitly set this field to ["text"]; otherwise, the SessionUpdate request fails.

session.sample_rate

Integer

No

16000

The input sample rate. Only 8000 or 16000 Hz is supported.

session.input_audio_format

String

No

pcm

The input format. Valid values are pcm and opus. The PCM audio must be mono, 16-bit, signed, little-endian raw audio.

session.output_audio_format

String

No

pcm

The output audio format. Only pcm is supported. The output is 24000 Hz, mono, PCM16LE audio.

session.voice

String

No

Tina

The voice name. The value must be a non-empty string of up to 128 characters and cannot contain control characters. For a list of available voices, see "6. Voices and Voice Cloning". For voice clone constraints, see the description below.

session.input_audio_transcription

Object

No

The configuration for transcription of the source audio. This object supports the enabled and language fields.

session.input_audio_transcription.enabled

Boolean

No

True

Defaults to true. Set to false to disable transcription.

session.input_audio_transcription.language

String

No

auto

Specifies the source language. The value cannot be the same as the target language. To enable automatic detection, set this field to auto.

session.turn_detection

Object

No

session.turn_detection.type

String

No

server_vad

Valid values are server_vad and manual. If type is manual, do not specify the threshold or silence_duration_ms fields.

session.turn_detection.threshold

Number

No

0.2

A VAD parameter. The value must be a finite number from -1 to 1. Do not provide this field if type is manual.

session.turn_detection.silence_duration_ms

Integer

No

1000

The VAD silence duration threshold, in milliseconds. The value must be an integer from 200 to 6000. Do not provide this field if type is manual.

session.enable_voice_clone

Boolean

No

false

Specifies whether to enable voice clone. If this field is set to true, the modalities field must include audio.

session.voice_clone_options

Object

Yes, if enable_voice_clone is true

None

Specifies the configuration for voice clone. This field is required only if enable_voice_clone is true.

session.voice_clone_options.frequency

String

Yes, if enable_voice_clone is true

None

Valid values are: once: Clones the voice once during the session. always: Continuously clones the voice. never: Uses an existing cloned voice. If you set this field to once or always, the voice field must be set to default. If you set this field to never, the voice field must be set to the ID of an available, non-default voice.

{
  "type": "SessionUpdate",
  "event_id": "evt_update_single_001",
  "session": {
    "translation": {
      "language": "en"
    },
    "modalities": [
      "text",
      "audio"
    ],
    "input_audio_format": "pcm",
    "sample_rate": 16000,
    "output_audio_format": "pcm",
    "voice": "Tina",
    "turn_detection": {
      "type": "server_vad",
      "threshold": 0.2,
      "silence_duration_ms": 1000
    }
  }
}
```

Bidirectional session: Writable fields

Field

Type

Required

Default

Description

session.mode

String

No

The mode set at creation.

If provided, the value must be bidirectional. The mode cannot be changed after creation.

session.language_pair

Array

No

The language pair set at creation.

If provided, the value must be identical to the one specified in the SessionCreate event. The language pair cannot be changed after creation.

session.input_audio

Object

No

See the defaults for sub-fields.

Configures the input audio. This object accepts only the format, sample_rate, and channels fields.

session.input_audio.format

String

No

pcm_s16le

Only pcm_s16le is supported, which represents raw PCM16LE audio.

session.input_audio.sample_rate

Integer

No

16000

Only 8000 or 16000 Hz is supported.

session.input_audio.channels

Integer

No

1

Only 1 is supported, which represents a mono channel.

session.output

Object

No

See the defaults for sub-fields.

Configures the output. This object accepts only the modalities and audio fields.

session.output.modalities

Array

No

["text","audio"]

Valid values are ["text"] or ["text", "audio"]. Arrays that contain only audio, duplicate values, or other modalities are not supported.

session.output.audio

Object

No

See the defaults for sub-fields.

Configures the audio output. Omit this object if you only require text output.

session.output.audio.format

String

No

pcm_s16le

Only pcm_s16le is supported.

session.output.audio.sample_rate

Integer

No

24000

Only 24000 Hz is supported.

session.output.audio.channels

Integer

No

1

Only 1 (a mono channel) is supported.

session.output.audio.voice

Object

No

See the defaults for sub-fields.

Bidirectional mode only supports preset voices.

session.output.audio.voice.mode

String

No

preset

Only preset is supported. Voice cloning is not supported.

session.output.audio.voice.id

String

No

default, which resolves to Tina

The voice name. default maps to Tina. The value must be a non-empty string of up to 128 characters and cannot contain control characters.

session.transcription

Object

No

{"enabled":true}

Enables or disables source audio transcription.

session.transcription.enabled

Boolean

No

true

If false, the service does not return TranscriptionTextDelta and TranscriptionDone events. This setting does not affect the translation.

session.turn_detection

Object

No

server_vad configuration

Configures settings for turn detection. This object supports only the type, threshold, and silence_duration_ms fields.

session.turn_detection.type

String

No

server_vad

server_vad: Enables automatic turn detection. manual: The client must explicitly commit turns.

session.turn_detection.threshold

Number

No

0.2

The VAD detection threshold. The value must be a finite number between -1 and 1.

session.turn_detection.silence_duration_ms

Integer

No

1000

The silence duration, in milliseconds, that triggers endpointing. The value must be between 200 and 6000. A duration of 800 ms is recommended.

{
  "type": "SessionUpdate",
  "event_id": "evt_update_bi_001",
  "session": {
    "input_audio": {
      "format": "pcm_s16le",
      "sample_rate": 16000,
      "channels": 1
    },
    "output": {
      "modalities": [
        "text",
        "audio"
      ],
      "audio": {
        "format": "pcm_s16le",
        "sample_rate": 24000,
        "channels": 1,
        "voice": {
          "mode": "preset",
          "id": "Tina"
        }
      }
    },
    "transcription": {
      "enabled": true
    },
    "turn_detection": {
      "type": "server_vad",
      "threshold": 0.2,
      "silence_duration_ms": 1000
    }
  }
}

event InputAudioBufferAppend

Append a chunk of input audio. The client should send this event continuously.

Field

Type

Required

Default

Description

type

String

Yes

None

Specifies the event type. You must pass the event name defined in this section.

event_id

String

No

None. An ID is not automatically generated if this field is omitted.

The event ID for the client event. If provided, it must be a non-empty, non-whitespace-only string. We recommend generating a new UUID for each event.

audio

String

Yes

None

A Base64 string containing the audio bytes. This is not a URL and must not include a WAV file header. Send it in a JSON text frame. After Base64 decoding, each block must be non-empty and no larger than 10,240 bytes. For PCM16, the byte count must be even.

sequence

Integer (64-bit)

No

None

If provided, the sequence starts at 0 and increments with each accepted block. We recommend including this field in every block. The sequence number is not reset after a clear operation. In one-way mode, the count advances for each accepted block. In bidirectional mode, the count advances only for accepted blocks that explicitly include sequence. Do not mix these two approaches.

{
  "type": "InputAudioBufferAppend",
  "event_id": "evt_InputAudioBufferAppend_001",
  "audio": "AAA=",
  "sequence": 0
}

Event InputAudioBufferCommit

In manual segmentation mode, submit the current buffer for recognition and translation.

Field

Type

Required

Default

Description

type

String

Yes

N/A

The event type. Must be an event name specified in this section.

event_id

String

No

N/A

A unique, client-side ID for the event. This value is not auto-generated. If provided, it must be a non-empty string that does not consist only of whitespace. We recommend generating a new UUID for each event.

{
  "type": "InputAudioBufferCommit",
  "event_id": "evt_InputAudioBufferCommit_001"
}

Event: InputAudioBufferClear

Clears the unprocessed input audio.

Field

Type

Required

Default

Description

type

String

Yes

None

The event type. You must explicitly provide the event name defined in this section.

event_id

String

No

None. This value is not automatically generated.

The client event ID. If provided, this field must be a non-empty string that does not contain only whitespace. We recommend generating a new UUID for each event.

{
  "type": "InputAudioBufferClear",
  "event_id": "evt_InputAudioBufferClear_001"
}

Event: SessionFinish

Instructs the server to stop accepting new audio and to finish processing any remaining content before ending the session. After you send this event, you may still receive final text and audio segments. The client must wait for the SessionFinished event before closing the connection.

Field

Type

Required

Default

Description

type

string

Yes

None

The event type. Set this field to the event name defined for this section.

event_id

string

No

None. This ID is not automatically generated.

The client event ID. If provided, it must be a non-empty, non-whitespace-only string. We recommend generating a new UUID for each event.

reason

string

No (bidirectional only)

completed (bidirectional)

In bidirectional mode, valid values are completed and cancelled. Use completed to flush all pending results. Use cancelled to drop any pending results. For unidirectional sessions, omit this parameter for a normal completion. Do not use this parameter to cancel a unidirectional session.

{
  "type": "SessionFinish",
  "event_id": "evt_SessionFinish_001",
  "reason": "completed"
}

8.5 Server-side events

Events: Session creation, update, and termination

Event name

Description

Applicable mode

Function

SessionCreated

Session created successfully

Unidirectional, bidirectional

Returns the session creation result and related information.

SessionUpdated

Session configuration applied

Unidirectional, bidirectional

Returns the configuration application result. You must wait for this event before sending audio.

InputAudioBufferCommitted

Audio submission successful

Unidirectional, bidirectional manual

Confirms that the current audio buffer has been submitted. This does not mean the translation is complete.

InputAudioBufferCleared

Audio buffer cleared successfully

Unidirectional, bidirectional manual

Confirms that the clear operation is complete.

SessionFinished

Session ended

Unidirectional, bidirectional

Notifies the client that the session has ended and indicates if the usage notification is complete.

Event: SessionCreated

Indicates that the WebSocket session was created successfully. This event applies to both unidirectional and bidirectional modes. For unidirectional sessions, this event returns the default session configuration. For bidirectional sessions, it returns the creation and expiration times; the full configuration is provided in the subsequent SessionUpdated event.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to SessionCreated.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Only read this value from the event that returns it. Other events are associated through the WebSocket connection and their respective response_id/item_id.

caused_by

String

No

None

The ID of the upstream event that triggered this response. This field is returned only if a correlation can be established and the upstream event included an event_id. It can be omitted for native receipts in unidirectional mode.

created_at

Integer (64-bit)

Yes for bidirectional; not returned for unidirectional

None

The Unix timestamp (in milliseconds) when the server created the session. Returned only for bidirectional sessions.

expires_at

Integer (64-bit)

Yes for bidirectional; not returned for unidirectional

None

The server-declared expiration time as a Unix timestamp (in milliseconds). Returned only for bidirectional sessions. This returned value is authoritative.

session

Object

Yes for unidirectional; not returned in the creation response for bidirectional

None

The session configuration object. See "Unidirectional session response object" for unidirectional mode and "Bidirectional session response object" for bidirectional SessionUpdated events.

// Bidirectional
{
  "event_id": "evt_e24f9e92-8aca-406c-aebf-0a55cfabb345",
  "expires_at": 1794559604065,
  "caused_by": "23e3bedb-6350-4991-942c-20fec2aeb512",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "created_at": 1794552404065,
  "type": "SessionCreated"
}

// Unidirectional
{
  "event_id": "event_HEE8YgXlXFvLLA6OFzUW8",
  "session": {
    "voice": "Tina",
    "input_audio_format": "pcm",
    "modalities": [
      "text",
      "audio"
    ],
    "sample_rate": 16000,
    "output_audio_format": "pcm",
    "translation": {
      "language": "en"
    },
    "turn_detection": {
      "type": "server_vad",
      "threshold": 0.2,
      "silence_duration_ms": 1000
    },
    "id": "01A1D3A8-BE24-1EC7-B5F7-1CC0971BEB65",
    "object": "realtime.session"
  },
  "session_id": "01A1D3A8-BE24-1EC7-B5F7-1CC0971BEB65",
  "type": "SessionCreated"
}

Event: SessionUpdated

This event indicates the session configuration is active. You must wait for this event before sending audio. The session object's structure differs between the two modes.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to SessionUpdated.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Only read this value from the event that returns it. Other events are associated through the WebSocket connection and their respective response_id/item_id.

caused_by

String

No

None

The ID of the upstream event that triggered this response. This field is returned only if a correlation can be established and the upstream event included an event_id. It can be omitted for native receipts in unidirectional mode.

warnings

Array

No

None

A list of configuration warnings. For bidirectional mode, a successful response returns an empty array. This field may be omitted in unidirectional mode.

session

Object

Yes

None

The session configuration object. See "Unidirectional session response object" for unidirectional mode and "Bidirectional session response object" for bidirectional SessionUpdated events.

{
  "session_id": "01A1D396-1E6C-1EB4-9976-C43141CB3CE7",
  "event_id": "event_Nijhd4RzSD56wgsf3iwRF",
  "type": "SessionUpdated",
  "session": {
    "voice": "Tina",
    "input_audio_format": "pcm",
    "input_audio_transcription": {
      "enabled": "true/false",
      "language": "zh"
    },
    "turn_detection": {
      "threshold": 0.2,
      "silence_duration_ms": 1000,
      "create_response": true,
      "type": "server_vad",
      "interrupt_response": true
    },
    "enable_voice_clone": false,
    "modalities": [
      "text",
      "audio"
    ],
    "sample_rate": 16000,
    "output_audio_format": "pcm",
    "translation": {
      "language": "en"
    },
    "id": "01A1D396-1E6C-1EB4-9976-C43141CB3CE7",
    "object": "realtime.session"
  }
}
{
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "event_id": "evt_0ed6ab10-f38e-4dec-be51-6e57b047381b",
  "type": "SessionUpdated",
  "caused_by": "a7957f17-bb91-4853-8132-f6841bcf510e",
  "session": {
    "transcription": {
      "enabled": true
    },
    "turn_detection": {
      "type": "manual"
    },
    "language_pair": [
      "zh",
      "en"
    ],
    "mode": "bidirectional",
    "output": {
      "modalities": [
        "text",
        "audio"
      ],
      "audio": {
        "format": "pcm_s16le",
        "voice": {
          "mode": "preset",
          "id": "Tina"
        },
        "sample_rate": 24000,
        "channels": 1
      }
    },
    "input_audio": {
      "format": "pcm_s16le",
      "sample_rate": 16000,
      "channels": 1
    }
  },
  "warnings": []
}

Event: InputAudioBufferCommitted

Confirms that the audio buffer has been submitted in manual mode. This event applies to both unidirectional and bidirectional manual modes. A successful submission confirmation does not mean the translation is complete. Continue to listen for translation results and completion events.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to InputAudioBufferCommitted.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Only read this value from the event that returns it. Other events are associated through the WebSocket connection and their respective response_id/item_id.

segment_id

String

Yes for bidirectional; not returned for unidirectional

None

The segment ID for bidirectional translation. The direction, translated text, and audio for a given segment share the same ID.

caused_by

String

No

None

The ID of the upstream event that triggered this response. This field is returned only if a correlation can be established and the upstream event included an event_id. It can be omitted for native receipts in unidirectional mode.

audio_duration_ms

Integer (64-bit)

Yes for bidirectional; not returned for unidirectional

None

The duration of the submitted audio, in milliseconds. Returned for bidirectional manual mode.

item_id

String

Returned for unidirectional; not returned for bidirectional

None

The input or output item ID, which is distinct from the session_id and response_id.

previous_item_id

String

Returned for unidirectional; not returned for bidirectional

None

The ID of the previous item. This field is omitted if there is no preceding item.

// Bidirectional
{
  "event_id": "evt_9cfc91d9-5e43-453d-9d75-d0af85835984",
  "caused_by": "39467001-eb51-4d6e-951b-395af7ab2aa9",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "audio_duration_ms": 3247,
  "type": "InputAudioBufferCommitted",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73"
}


// Unidirectional
{
  "event_id": "event_KaJwLNHtXflNtERcQr1Fz",
  "item_id": "item_GC3L2t7u9PURAnogZLiWj",
  "session_id": "01A1D3A1-A044-18C1-9CE3-456CF7F3CFD0",
  "type": "InputAudioBufferCommitted",
  "previous_item_id": "item_GC3L2t7u9PURAnogZLiWj"
}

Event: InputAudioBufferCleared

Applies to unidirectional and bidirectional manual modes. Indicates that the clear operation is complete. Do not send new audio until you receive this confirmation. This event does not cancel already-delivered translations or their associated usage.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to InputAudioBufferCleared.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Only read this value from the event that returns it. Other events are associated through the WebSocket connection and their respective response_id/item_id.

caused_by

String

No

None

The ID of the upstream event that triggered this response. This field is returned only if a correlation can be established and the upstream event included an event_id. It can be omitted for native receipts in unidirectional mode.

// Bidirectional
{
  "session_id": "01A1D3A2-52B5-14DF-8CD0-CD46CD3D6C02",
  "event_id": "evt_e59e593b-ada8-49d7-b585-7dcd6ed372a1",
  "type": "InputAudioBufferCleared",
  "caused_by": "7cd31c3c-23cd-43b7-a626-295666db63fb"
}

// Unidirectional
{
  "session_id": "01A1D3A1-A044-18C1-9CE3-456CF7F3CFD0",
  "event_id": "event_Pr5lCgS2bcRi4zCZLE1vg",
  "type": "InputAudioBufferCleared"
}

Event: SessionFinished

Applies to unidirectional and bidirectional modes. Indicates that the session has ended. The client must continue to listen for any final translated text, audio, and usage events that may arrive before this one. Do not disconnect immediately after sending the SessionFinish event; wait for this SessionFinished confirmation.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to SessionFinished.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Only read this value from the event that returns it. Other events are associated through the WebSocket connection and their respective response_id/item_id.

caused_by

String

No

None

The ID of the upstream event that triggered this response. This field is returned only if a correlation can be established and the upstream event included an event_id. It can be omitted for native receipts in unidirectional mode.

reason

String

Yes for bidirectional; no for unidirectional

None

The reason the bidirectional session ended. Possible values are completed, cancelled, or error. This field might be omitted for a normal termination in unidirectional mode.

usage_complete

Boolean

Yes

None

Indicates if all usage metrics for this session were successfully accepted and reported by the message queue (MQ). A value of false means the usage data is incomplete. This value does not indicate translation success or reflect the final billing result.

{
  "session_id": "01A1D396-1E6C-1EB4-9976-C43141CB3CE7",
  "event_id": "event_QrJXliSAtZrMLYU52hj9X",
  "type": "SessionFinished",
  "usage_complete": true
}
{
  "session_id": "01A1D3A1-F91D-1B77-8DB0-51A24BDE7FAC",
  "reason": "completed",
  "event_id": "evt_ebbbd437-cbc2-4f3f-803f-6d240d7ca094",
  "type": "SessionFinished",
  "caused_by": "2d539e47-da04-41ca-ac55-87a342a93d1e",
  "usage_complete": true
}

Transcription-related events

Mode

Event name

Description

Key fields

One-way

ConversationItemInputAudioTranscriptionText

For one-way translation, this event provides a real-time transcription snapshot containing both confirmed and temporary text.

item_id + content_index

One-way

ConversationItemInputAudioTranscriptionCompleted

Returns the complete transcription result for the current input item.

item_id + content_index

One-way

ConversationItemInputAudioTranscriptionFailed

Indicates that the transcription for the current input item has failed.

item_id + content_index

Two-way

TranscriptionTextDelta

For two-way translation, this event provides a real-time transcription snapshot that subsequent events can revise.

transcription_id

Two-way

TranscriptionDone

Returns the final result for the current transcription segment. It can also indicate a transcription failure.

transcription_id

One-way Translation ConversationItemInputAudioTranscriptionText

  • Uses item_id + content_index as the unique identifier.

  • Each new event overwrites the corresponding record.

  • The displayed content is text + stash.

  • Different events are not combined to prevent duplicate displays.

  • Subsequent events can revise both text and stash.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed value: ConversationItemInputAudioTranscriptionText.

event_id

String

Yes

None

A server-generated ID for the downstream event.

item_id

String

Yes

None

The conversation item ID, which identifies the current audio segment.

content_index

Integer (64-bit)

Yes

None

The content index, starting from 0.

text

String

Yes

None

The confirmed text from the transcription. Can be an empty string.

stash

String

Yes

None

The temporary, unconfirmed text from the transcription. Can be an empty string.

language

String

No

None

The detected source language code, such as zh.

emotion

String

No

None

The emotion tag for the source audio, such as neutral, happy, sad, or angry.

{
  "event_id": "event_VNgTEmLwnw9O1G3fTFWrG",
  "emotion": "neutral",
  "item_id": "item_DUMYUTNy14dEh2jn3gFeC",
  "content_index": 0,
  "language": "zh",
  "text": "",
  "type": "ConversationItemInputAudioTranscriptionText",
  "stash": "你"
}

One-way Translation ConversationItemInputAudioTranscriptionCompleted

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed value: ConversationItemInputAudioTranscriptionCompleted.

event_id

String

Yes

None

A server-generated ID for the downstream event.

item_id

String

Yes

None

The input or output conversation item ID. This is not the same as session_id or response_id.

content_index

Integer (64-bit)

Yes

None

The content index, starting from 0. This value is typically 0.

transcript

String

Yes

None

The complete text. For transcription events, this is the source-language transcription. For a ResponseAudioTranscriptDone event, this is the target-language translation.

language

String

No

None

The detected source language code. This value is definitive.

emotion

String

No

None

The emotion tag detected in the source audio. Possible values include neutral, happy, sad, angry, surprised, disgusted, and fearful.

{
  "event_id": "event_GJmQXTrfmRovqz8RIdtZ9",
  "transcript": "你好,欢迎来到北京。",
  "emotion": "neutral",
  "item_id": "item_DUMYUTNy14dEh2jn3gFeC",
  "content_index": 0,
  "language": "zh",
  "type": "ConversationItemInputAudioTranscriptionCompleted"
}

One-way Translation ConversationItemInputAudioTranscriptionFailed

Indicates that the transcription for the current input item has failed. This event is distinct from a RealtimeError.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed value: ConversationItemInputAudioTranscriptionFailed.

event_id

String

Yes

None

A server-generated ID for the downstream event.

item_id

String

Yes

None

The input or output conversation item ID. This is not the same as session_id or response_id.

content_index

Integer (64-bit)

Yes

None

The index of the content within item.content, starting from 0. This value is typically 0.

error

Object

Yes

None

An object that contains error details. Its sub-fields are described below.

error.code

String

Yes

None

The error code for the transcription. This value is definitive.

error.message

String

Yes

None

The error message for the transcription.

error.param

String

No

None

The parameter related to the error. This field can be empty.

{
  "type": "ConversationItemInputAudioTranscriptionFailed",
  "event_id": "event_example",
  "item_id": "item_example",
  "content_index": 0,
  "error": {
    "code": "transcription_failed",
    "message": "Transcription failed"
  }
}

Two-way Translation TranscriptionTextDelta

A complete, revisable snapshot of the transcription, not an incremental fragment.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed value: TranscriptionTextDelta.

event_id

String

Yes

None

A server-generated ID for the downstream event. It is not required to match the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the current WebSocket connection and their respective response_id or item_id.

transcription_id

String

Yes

None

The independent transcription segment ID is associated with TranscriptionTextDelta and TranscriptionDone. It does not have a one-to-one correspondence with the translation segment_id.

revision

Integer (64-bit)

Yes

None

The revision number for the snapshot with the same transcription_id. It is an integer that starts at 1 and increments. It may skip values, so do not assume it is sequential.

text

String

Yes

None

The text content. Can be an empty string.

stash

String

Yes

None

Unconfirmed temporary text that can be an empty string. text + stash is used for display and may be revised by subsequent events.

start_ms

Integer (64-bit)

No

None

The start offset in milliseconds, relative to the beginning of the cumulative audio input for this session. Can be omitted if the transcription boundaries are not yet determined.

end_ms

Integer (64-bit)

No

None

The end offset in milliseconds, relative to the beginning of the cumulative audio input for this session. Can be omitted if the transcription boundaries are not yet determined.

{
  "event_id": "evt_66ec3921-453a-4d99-a5e8-5b2ae27fb5b9",
  "transcription_id": "tr_87e31a0f-7189-4851-a56d-41eb727ff91c",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "text": "",
  "type": "TranscriptionTextDelta",
  "end_ms": 3247,
  "start_ms": 0,
  "revision": 6,
  "stash": "你好,欢迎来到北京。"
}

Two-way Translation TranscriptionDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed value: TranscriptionDone.

event_id

String

Yes

None

A server-generated ID for the downstream event. It is not required to match the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the current WebSocket connection and their respective response_id or item_id.

text

String

Yes

None

The text content. This is the final text for this transcription segment. Can be an empty string.

start_ms

Integer (64-bit)

No

None

The start offset in milliseconds, relative to the beginning of the cumulative audio input for this session. Can be omitted if the transcription boundaries are not yet determined.

end_ms

Integer (64-bit)

No

None

The end offset in milliseconds, relative to the beginning of the cumulative audio input for this session. Can be omitted if the transcription boundaries are not yet determined.

transcription_id

String

Yes

None

The independent transcription segment ID associates TranscriptionTextDelta and TranscriptionDone. It does not have a one-to-one correspondence with the translation segment_id.

revision

Integer (64-bit)

Yes

None

The revision number for the snapshot with the same transcription_id. It is an integer that starts at 1 and increments. It may skip values, so do not assume it is sequential.

error

Object

No

None

This field is present if the transcription fails and is omitted on success. If an error occurs, the text field contains only the partial transcription obtained before the failure.

error.code

String

Yes, if transcription fails

None

The error code for a transcription failure. Example: transcription_failed.

{
  "event_id": "evt_27693dc8-14fc-4136-acda-c3220d696896",
  "transcription_id": "tr_87e31a0f-7189-4851-a56d-41eb727ff91c",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "text": "你好,欢迎来到北京。",
  "type": "TranscriptionDone",
  "end_ms": 3247,
  "revision": 7,
  "start_ms": 0
}

Translation events

Mode

Output type

Sub-event name

Event description

Associated fields

unidirectional

text-only

ResponseTextText

Returns a real-time snapshot of the translated text, which includes both confirmed text and interim text.

response_id + item_id + content_index

unidirectional

text-only

ResponseTextDelta

Returns a new fragment of the translated text.

response_id + item_id + content_index

unidirectional

text-only

ResponseTextDone

Returns the final translated text for the current content part.

response_id + item_id + content_index

unidirectional

text and audio

ResponseAudioTranscriptText

Returns a real-time snapshot of the translated text that corresponds to the synthesized speech.

response_id + item_id + content_index

unidirectional

text and audio

ResponseAudioTranscriptDelta

Returns a new fragment of the translated text corresponding to the synthesized speech.

response_id + item_id + content_index

unidirectional

text and audio

ResponseAudioTranscriptDone

Returns the final translated text that corresponds to the synthesized speech.

response_id + item_id + content_index

bidirectional

text and audio / text-only

TranslationTextDelta

Returns a real-time snapshot of the translated text for the current segment.

segment_id

bidirectional

text and audio / text-only

TranslationTextDone

Returns the final translated text for the current segment.

segment_id

One-way - text onlyResponseTextText

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseTextText.

event_id

String

Yes

None

The server-generated ID of this downstream event. It does not need to match the event_id of the upstream event.

response_id

String

Yes

None

The translation response ID. This corresponds to response.id in ResponseCreated and ResponseDone.

item_id

String

Yes

None

The ID of the input or output dialogue item. It is not equal to session_id or response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output, starting at 0. The most common value is currently 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content, starting at 0. The most common value is currently 0.

text

String

Yes

None

The text content. An empty string is allowed.

stash

String

Yes

None

Unconfirmed temporary text that can be an empty string. The expression text + stash is used for display and may be revised by subsequent events.

{
  "event_id": "event_AGS9lSNPHeF3ig3Mxs3wZ",
  "item_id": "item_FHouYW9kECnKF6je6gF9I",
  "content_index": 0,
  "response_id": "resp_Y3eSdnNX3CDIl4mErQ4Bk",
  "text": "Hello,",
  "type": "ResponseTextText",
  "output_index": 0,
  "stash": " welcome"
}

Unidirectional, text-onlyResponseTextDelta

Field

Type

Required

Default

Description

type

String

Yes

None

Always ResponseTextDelta.

event_id

String

Yes

None

This downstream event ID is generated by the server and is not required to be the same as the upstream event_id.

response_id

String

Yes

None

The translation response ID. This corresponds to response.id in the ResponseCreated and ResponseDone events.

item_id

String

Yes

None

The ID of the input or output conversation item. This ID is distinct from session_id and response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output. The index is 0-based. The most common value is currently 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content. The index is 0-based. The most common value is currently 0.

delta

String

Yes

None

A new text fragment. Append these fragments in the order you receive them.

{
  "type": "ResponseTextDelta",
  "event_id": "event_example",
  "response_id": "resp_example",
  "item_id": "item_example",
  "output_index": 0,
  "content_index": 0,
  "delta": "Hello"
}

One-way text onlyResponseTextDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseTextDone.

event_id

String

Yes

None

The downstream event ID is generated by the server and is not required to be the same as the upstream event_id.

response_id

String

Yes

None

The translation response ID. This corresponds to response.id in ResponseCreated / ResponseDone.

item_id

String

Yes

None

The ID of an input or output conversation item. This ID is distinct from session_id and response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output, starting from 0. This value is typically 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content, starting from 0. This value is typically 0.

text

String

Yes

None

The final text for the current content part. An empty string is allowed.

{
  "event_id": "event_B37Vtn7BosbJX6uBNSDfT",
  "item_id": "item_FHouYW9kECnKF6je6gF9I",
  "content_index": 0,
  "response_id": "resp_Y3eSdnNX3CDIl4mErQ4Bk",
  "text": "Hello, welcome to Beijing.  ",
  "type": "ResponseTextDone",
  "output_index": 0
}

Unidirectional - Text and audioResponseAudioTranscriptText

Parameter

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseAudioTranscriptText.

event_id

String

Yes

None

The server-generated ID for the downstream event. This ID does not need to match the upstream event_id.

response_id

String

Yes

None

The translation response ID. This corresponds to response.id in the ResponseCreated and ResponseDone events.

item_id

String

Yes

None

The ID of an input or output item, which cannot be session_id or response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output, starting at 0. The most common value is 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content, starting at 0. The most common value is 0.

text

String

Yes

None

The text content. An empty string is allowed.

stash

String

Yes

None

Unconfirmed temporary text that can be an empty string. The text + stash is for display and may be revised by subsequent events.

Unidirectional - Text and audioResponseAudioTranscriptDelta

{ "version": "2.0.0", "nodes": [ { "id": "node_1", "label": "Client sends a request with text and audio." }, { "id": "node_2", "label": "Server returns a response with processed audio and text." } ], "edges": [ { "source": "node_1", "target": "node_2", "label": "Recognize speech & generate text" } ] }

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseAudioTranscriptDelta.

event_id

String

Yes

None

The downstream event ID is generated by the server and is not required to be the same as the upstream event_id.

response_id

String

Yes

None

The translation response ID, corresponding to response.id in ResponseCreated / ResponseDone.

item_id

String

Yes

None

The ID for an input or output item. This ID is distinct from session_id and response_id.

output_index

Integer (64-bit)

Yes

None

The 0-based index of the output item in response.output. The value is typically 0.

content_index

Integer (64-bit)

Yes

None

The 0-based index of the content in item.content. The value is typically 0.

delta

String

Yes

None

A new segment of the translated text. Append segments sequentially to build the complete translation.

{
  "type": "ResponseAudioTranscriptDelta",
  "event_id": "event_example",
  "response_id": "resp_example",
  "item_id": "item_example",
  "output_index": 0,
  "content_index": 0,
  "delta": "Hello"
}

One-way - text+audioResponseAudioTranscriptDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseAudioTranscriptDone.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

response_id

String

Yes

None

The translation response ID. This corresponds to response.id in ResponseCreated / ResponseDone.

item_id

String

Yes

None

The ID of the input or output item. This is different from the session_id or response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output, starting at 0. The most common value is 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content, starting at 0. The most common value is 0.

transcript

String

Yes

None

The complete text of the translation in the target language. This is not the transcription of the source language.

{
  "event_id": "event_UUZTs96FIetCsmtEDOpI2",
  "transcript": "Hello, welcome to Beijing.  ",
  "item_id": "item_EanOTJJQrQaYauWcbKmvj",
  "content_index": 0,
  "response_id": "resp_I2hBBB1Rze5KBqlg2EpiY",
  "type": "ResponseAudioTranscriptDone",
  "output_index": 0
}

Bidirectional TranslationTextDelta

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationTextDelta.

event_id

String

Yes

None

The ID for this downstream event, generated by the server. It is not required to match the event_id of the corresponding upstream event.

session_id

String

Yes

None

The session ID. This field is returned only in certain events. Other events are associated through the WebSocket connection and their respective response_id or item_id.

segment_id

String

Yes

None

The ID for a bidirectional translation segment. The direction, translation, and audio for a single segment all share this ID.

direction

String

Yes

None

The translation direction (e.g., zh->en or en->zh). This value corresponds to the source_language and target_language fields.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

text

String

Yes

None

The text content. An empty string is allowed.

stash

String

Yes

None

Unconfirmed temporary text. An empty string is allowed. text + stash is used for display and may be revised by subsequent events.

{
  "event_id": "evt_21012360-2246-41d7-9425-4ae7bdd99d7c",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "text": "Hello,",
  "type": "TranslationTextDelta",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en",
  "stash": " welcome"
}

BidirectionalTranslationTextDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationTextDone.

event_id

String

Yes

None

This downstream event ID is generated by the server and is not required to be the same as the upstream event_id.

session_id

String

Yes

None

Session ID. Read this field only when it is returned by this event. Other events are associated through the current WebSocket connection and their response_id/item_id.

segment_id

String

Yes

None

The segment ID for bidirectional translation. The direction, translation, and audio for the same segment share the same ID.

direction

String

Yes

None

The translation direction string, for example, zh->en or en->zh. It must be consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

text

String

Yes

None

The text content. An empty string is allowed. This is the complete final translation for the current segment, overwriting any previous interim results.

{
  "event_id": "evt_8f5c9541-deb1-4e7f-b218-0807253a6fd7",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "text": "Hello, welcome to Beijing.  ",
  "type": "TranslationTextDone",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en"
}

Translation audio events

Mode

Sub-event name

Description

Associated fields

Unidirectional

TranslationAudioDelta

Returns a Base64-encoded PCM16LE translation audio chunk. Play the chunks in sequence order.

segment_id + sequence

Unidirectional

TranslationAudioDone

Indicates that the current translation audio segment has ended. This event may include a finish_reason.

segment_id

Bidirectional

TranslationAudioDelta

Returns a Base64-encoded translation audio chunk for the current translation segment. Play the chunks in sequence order.

segment_id + sequence

Bidirectional

TranslationAudioDone

Indicates that the audio output for the current translation segment is complete.

segment_id

UnidirectionalTranslationAudioDelta

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationAudioDelta.

event_id

String

Yes

None

The ID of the downstream event is generated by the server and is not required to be the same as the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the WebSocket connection and their response_id or item_id.

segment_id

String

Yes

None

The ID of the translation segment. The direction, translation, and audio for the same segment share the same ID.

direction

String

Yes

None

The translation direction string, such as zh->en or en->zh. Consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

audio

String

Yes

None

Base64-encoded PCM16LE synthesized speech, 24,000 Hz, mono channel—after decoding, play the audio in the order of the sequence.

sequence

Integer (64-bit)

Yes

None

The sequence number of the translation audio chunk. For each segment_id, the sequence starts at 0 and increments.

{
  "type": "TranslationAudioDelta",
  "event_id": "evt_44f88800-c538-4eda-931d-8394daf21737",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en",
  "source_language": "zh",
  "target_language": "en",
  "audio": "<Base64 audio payload omitted, see full JSON for complete value>",
  "sequence": 0
}

UnidirectionalTranslationAudioDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationAudioDone.

event_id

String

Yes

None

This downstream event ID is generated by the server; it is not required to be the same as the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the WebSocket connection and their response_id or item_id.

segment_id

String

Yes

None

The ID of the translation segment. The direction, translation, and audio for the same segment share the same ID.

direction

String

Yes

None

The translation direction string, such as zh->en or en->zh. Consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

finish_reason

String

No

None

The reason for segment interruption or termination. This can be omitted for normal completion. For example, direction_changed or direction_unconfirmed. Do not treat the default value as an explicitly returned completed value.

{
  "event_id": "evt_ec217ccc-9f46-4284-a946-8aafe8a0c7a7",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "type": "TranslationAudioDone",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en"
}

BidirectionalTranslationAudioDelta

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationAudioDelta.

event_id

String

Yes

None

The downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the WebSocket connection and their response_id or item_id.

segment_id

String

Yes

None

The ID of the translation segment. The direction, translation, and audio for the same segment share the same ID.

direction

String

Yes

None

The translation direction string, such as zh->en or en->zh. Consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

audio

String

Yes

None

Play the Base64-encoded PCM16LE synthesized speech (24,000 Hz, mono) in the order of the sequence after decoding.

sequence

Integer (64-bit)

Yes

None

The sequence number of the translation audio chunk. For each segment_id, the sequence starts at 0 and increments.

{
  "type": "TranslationAudioDelta",
  "event_id": "evt_44f88800-c538-4eda-931d-8394daf21737",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en",
  "source_language": "zh",
  "target_language": "en",
  "audio": "<Base64 audio payload omitted, see full JSON for complete value>",
  "sequence": 0
}

BidirectionalTranslationAudioDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to TranslationAudioDone.

event_id

String

Yes

None

The downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

session_id

String

Yes

None

The session identifier. Use this field only when this event returns it. Other events are associated through the WebSocket connection and their response_id or item_id.

segment_id

String

Yes

None

The ID of the translation segment. The direction, translation, and audio for the same segment share the same ID.

direction

String

Yes

None

The translation direction string, such as zh->en or en->zh. Consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

finish_reason

String

No

None

The reason why a segment is interrupted or ends. This can be omitted for normal completion. For example, direction_changed or direction_unconfirmed. Do not treat the default value as an explicitly returned completed.

{
  "event_id": "evt_ec217ccc-9f46-4284-a946-8aafe8a0c7a7",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "type": "TranslationAudioDone",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en"
}

Event: Usage statistics UsageReported

This downstream event applies to one-way and two-way modes. It indicates that the Metering MQ has received the metering data for a billing segment. Metering data is submitted only after a full translation segment is successfully processed and its results are written. A billing segment is a unit of input for metering and differs from the individual audio chunks uploaded through InputAudioBufferAppend. The service does not acknowledge the metering of each audio chunk. Use the usage_id to deduplicate events before aggregating usage. This event neither confirms final billing success nor guarantees a one-to-one correspondence with output segments.

Field

Type

Required

Default

Description

type

String

Yes

None

The value is fixed to UsageReported.

event_id

String

Yes

None

The ID of the downstream event is generated by the server. It is not required to be the same as the upstream event_id.

session_id

String

Yes

None

The session identifier. Read this field only when it is returned in this event. Other events are associated through the current WebSocket connection and their respective response_id or item_id.

usage_id

String

Yes

None

The unique ID of the billing segment. Deduplicate records based on this field and then accumulate the usage. You cannot use event_id instead.

status

String

Yes

None

Fixed to MQ_ACCEPTED, which indicates that Metering MQ has accepted the segment.

usageMap

Object

Yes

None

The usage object for this billing segment, not the cumulative value for the entire session. See the table below for sub-fields.

usageMap.InputAudioSeconds

String

Yes

None

The duration of the input audio for this billing segment, represented as a string of integer seconds. The value for each segment is rounded independently and can be "0".

usageMap.VoiceTranslationType

String

Yes

None

TEXT indicates text-only output. AUDIO_TEXT indicates text and speech output.

{
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "event_id": "evt_fe1c0de5-4172-4256-9070-66cc199ffdd2",
  "type": "UsageReported",
  "usageMap": {
    "InputAudioSeconds": "3",
    "VoiceTranslationType": "AUDIO_TEXT"
  },
  "usage_id": "rtu_fe50748b-6200-4358-9f4d-dc62831fb745",
  "status": "MQ_ACCEPTED"
}
{
  "session_id": "01A1D396-1E6C-1EB4-9976-C43141CB3CE7",
  "event_id": "evt_5151d5a9-3c66-4f4c-a048-b66c230a5bbb",
  "type": "UsageReported",
  "usageMap": {
    "InputAudioSeconds": "3",
    "VoiceTranslationType": "AUDIO_TEXT"
  },
  "usage_id": "rtu_4cba66b1-7a55-41e8-9bf4-b25a14482dea",
  "status": "MQ_ACCEPTED"
}

Event: RealtimeError and error.code error codes

Applicable to both unidirectional and bidirectional modes. This event indicates an error in the real-time translation service. If fatal is true, the session cannot continue. The retryable field indicates whether you should create a new session to retry the operation. It does not mean you can replay audio in the existing session.

Field

Type

Required

Default value

Description

type

String

Yes

None

The value is always RealtimeError.

event_id

String

Yes

None

The ID of this downstream event, generated by the server. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. Rely on this field only when it appears in this event. Associate other events using the current WebSocket connection and their response_id/item_id.

error

Object

Yes

None

An object containing error details. Its subfields are described below.

error.code

String

Yes

None

The error code. Use this for programmatic error handling instead of relying on the text of the message.

error.message

String

Yes

None

A human-readable description of the error.

error.fatal

Boolean

Conditional

None

A value of true indicates that the session cannot continue. This field may not be present in some native errors. If omitted, do not assume the value is false.

error.retryable

Boolean

Conditional

None

Indicates whether to create a new session to retry the operation. If omitted, do not assume the value is true.

error.caused_by

String

No

None

The event_id of the upstream event that caused the error. Returned when a correlation can be established.

error.event_id

String

No

None

Some native errors use this field to correlate the error with the upstream event.

error.type

String

No

None

The native error category, such as invalid_request_error.

error.param

String

No

None

The path of the parameter that caused the error. This field can be empty.

{
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "event_id": "evt_700fb70e-bb9a-40c1-94f3-17218b6cf42b",
  "type": "RealtimeError",
  "error": {
    "retryable": true,
    "code": "upstream_unavailable",
    "message": "Translation upstream failed",
    "fatal": true
  }
}
{
  "session_id": "01A1D3A2-9BEF-1046-A830-065BCCCEB943",
  "event_id": "evt_5365e33e-774b-4e05-9a4b-a1754b9f5951",
  "type": "RealtimeError",
  "error": {
    "retryable": false,
    "code": "empty_audio_buffer",
    "caused_by": "bfbac2c5-934f-4512-a7e8-cd8182748ce7",
    "message": "No audio to commit",
    "fatal": false
  }
}

Handle connection failures and post-connection errors separately. If the HTTP connection is not upgraded to 101 Switching Protocols, check for an SDK or HTTP error. After a successful connection, handle any RealtimeError events. Standard gateway rejections and SDK transport exceptions are not guaranteed to follow the RealtimeError event structure. Do not attempt to parse them as such.

Error code

Meaning and handling

invalid_event

The JSON, event name, or event structure is invalid. Check the type and message format.

invalid_session_config

The mode, language pair, or a configuration field is invalid. Create a new connection with the corrected settings.

session_immutable

This error occurs if you attempt to create a duplicate session, reconfigure a session, or change the mode or language pair. Create a new connection.

session_not_ready

The session has not been created or configured. Wait for the corresponding acknowledgement event.

invalid_audio_format

The Base64 encoding or audio format is invalid, the audio chunk is empty, or a PCM16 sample is incomplete.

audio_payload_too_large

The decoded audio chunk exceeds 10,240 bytes, or the message exceeds the server's text message limit.

invalid_sequence

The input chunk sequence number is out of order. Check for skipped numbers or a sequence that was incorrectly reset to zero after a clear operation.

empty_audio_buffer

You submitted an empty buffer in Manual mode.

duplicate_event

You reused a previously processed event_id in bidirectional mode. Use a unique ID for each event.

commit_in_progress

The previous commit has not been acknowledged. Wait for the InputAudioBufferCommitted event.

buffer_operation_in_progress

A buffer operation, such as clearing the buffer, is still in progress. Wait for the acknowledgement.

session_finishing

The session is already in the process of closing. Stop sending audio.

buffer_limit_exceeded

The session or segment buffer limit has been exceeded. Reduce the backlog, lower the concurrency, or create a new session.

language_detection_failed

Language detection failed in bidirectional mode. Check that the input audio belongs to the language pair specified at creation.

transcription_failed

A transcription error occurred. Check the specific transcription completion or failure event for more details.

upstream_unavailable

The translation service is temporarily unavailable. Handle the error based on the fatal and retryable flags and save the event_id for troubleshooting.

service_shutting_down

The service is shutting down. Establish a new connection.

internal_error

An internal service error occurred. Save the gateway request ID for troubleshooting.

unauthorized / resource_not_opened

Authentication failed or you do not have permission to use this product. The request may be rejected during the HTTP handshake stage.

Handshake failure and troubleshooting

After the handshake, the platform returns a session-id header. Record this ID on the client to aid in troubleshooting.

8.6 Server-Side - Other Events

Event name

Description

Applicable mode

InputAudioBufferSpeechStarted

Indicates that the start of speech is detected.

Unidirectional VAD

InputAudioBufferSpeechStopped

Indicates that the end of speech is detected.

Unidirectional VAD

ConversationItemCreated

A conversation item is created.

Unidirectional

ResponseOutputItemAdded

An output item is added.

Unidirectional

ResponseOutputItemDone

The output item is completed.

Unidirectional

ResponseContentPartAdded

A content part is added.

Unidirectional

ResponseContentPartDone

The content part is completed.

Unidirectional

ResponseCreated

The translation response starts.

Unidirectional

ResponseDone

The translation response is completed.

Unidirectional

SegmentStarted

A translation segment starts.

Bidirectional

LanguageDetected

The translation direction is determined.

Bidirectional

SegmentDone

The translation segment is completed.

Bidirectional

Event InputAudioBufferSpeechStarted

This event applies to unidirectional VAD. Upon detecting the start of speech, item_id is used to identify the input. In bidirectional mode, this event is not used for business segmentation.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to InputAudioBufferSpeechStarted.

event_id

String

Yes

None

The downstream event ID generated by the server. This ID does not need to match the upstream event_id.

audio_start_ms

Integer (64-bit)

Yes

None

The time in milliseconds from the start of the input audio for this session to the start of speech.

item_id

String

Yes

None

The ID of the input or output conversation item. This ID is different from session_id or response_id.

{
  "event_id": "event_CSdy5Pp96dT8AEXszRAsG",
  "audio_start_ms": 312,
  "type": "InputAudioBufferSpeechStarted",
  "item_id": "item_DUMYUTNy14dEh2jn3gFeC"
}

Event InputAudioBufferSpeechStopped

For unidirectional VAD, when the end of speech is detected, the server automatically processes the audio segment, so the client no longer needs to send an explicit commit.

Parameter

Type

Required

Default

Description

type

String

Yes

None

Fixed to InputAudioBufferSpeechStopped.

event_id

String

Yes

None

The ID of this downstream event, generated by the server. It does not need to match the upstream event_id.

audio_end_ms

Integer (64-bit)

Yes

None

The speech end offset in milliseconds, measured from the beginning of the session input audio.

item_id

String

Yes

None

The ID of an input or output dialog item; not equal to session_id or response_id.

{
  "event_id": "event_SZJdd8dDRomc1JDWx1BwE",
  "type": "InputAudioBufferSpeechStopped",
  "audio_end_ms": 3400,
  "item_id": "item_DUMYUTNy14dEh2jn3gFeC"
}

Message and content block events (one-way only)

Category

Event name

Mode

Function

Conversation item

ConversationItemCreated

unidirectional

Notifies the client when a new conversation item is added. The event provides the new conversation item object and the ID of the previous item.

Output item

ResponseOutputItemAdded

unidirectional

Notifies the client when a new output item is added. The event provides the output item and its index.

Output item

ResponseOutputItemDone

unidirectional

Notifies the client that an output item is complete. The event provides the conversation item object containing the final content.

Content part

ResponseContentPartAdded

unidirectional

Notifies the client when a new content part is added to an output item. The event provides the content part object.

Content part

ResponseContentPartDone

unidirectional

Notifies the client that the current content part is complete. The event provides the final content for that part.

ConversationItemCreated

Parameter

Type

Required

Default

Description

type

String

Yes

None

Always ConversationItemCreated.

event_id

String

Yes

None

A unique ID for this downstream event, generated by the server. It does not need to match the upstream event_id.

previous_item_id

String

No

None

The ID of the previous conversation item. Omit this field if no previous item exists.

item

Object

Yes

None

The conversation item object. For the full schema, see "Conversation item and content objects".

{
  "item": {
    "id": "item_EanOTJJQrQaYauWcbKmvj",
    "role": "assistant",
    "type": "message",
    "content": [],
    "object": "realtime.item",
    "status": "in_progress"
  },
  "event_id": "event_EcIZJGK6JduM6YdXgcNZc",
  "type": "ConversationItemCreated",
  "previous_item_id": "item_DUMYUTNy14dEh2jn3gFeC"
}

ResponseOutputItemAdded

Field

Type

Required

Default

Description

type

String

Yes

None

The value must be ResponseOutputItemAdded.

event_id

String

Yes

None

The downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

response_id

String

Yes

None

The translation response ID corresponds to the response.id of ResponseCreated and ResponseDone.

output_index

Integer (64-bit)

Yes

None

The 0-based index of the output item in response.output. The current common value is 0.

item

Object

Yes

None

The dialogue item object. For the full schema, see Dialogue item and content objects.

{
  "item": {
    "id": "item_EanOTJJQrQaYauWcbKmvj",
    "role": "assistant",
    "type": "message",
    "content": [],
    "object": "realtime.item",
    "status": "in_progress"
  },
  "event_id": "event_TRn8fE6b1d711InHxmth3",
  "type": "ResponseOutputItemAdded",
  "output_index": 0,
  "response_id": "resp_I2hBBB1Rze5KBqlg2EpiY"
}

ResponseOutputItemDone

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseOutputItemDone.

event_id

String

Yes

None

The server-generated ID for the downstream event. This ID does not need to match the upstream event_id.

response_id

String

Yes

None

The translation response ID corresponds to the response.id of ResponseCreated or ResponseDone.

output_index

Integer (64-bit)

Yes

None

The 0-indexed index of the output item in response.output. The typical value is 0.

item

Object

Yes

None

The dialog item object containing the final content for this output item. See "Dialog Item and Content Object" for the complete schema.

{
  "item": {
    "id": "item_EanOTJJQrQaYauWcbKmvj",
    "role": "assistant",
    "type": "message",
    "content": [
      {
        "type": "audio",
        "text": "Hello, welcome to Beijing.  "
      }
    ],
    "object": "realtime.item",
    "status": "completed"
  },
  "event_id": "event_FWVBT82xDoFtRpjxBq1sj",
  "type": "ResponseOutputItemDone",
  "output_index": 0,
  "response_id": "resp_I2hBBB1Rze5KBqlg2EpiY"
}

ResponseContentPartAdded

Add a content block to an output item

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseContentPartAdded.

event_id

String

Yes

None

This downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

response_id

String

Yes

None

The translation response ID corresponds to the response.id of ResponseCreated/ResponseDone.

item_id

String

Yes

None

The ID of the input or output dialog item. It is not the session_id or response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output. The index starts from 0, and a common value is 0.

content_index

Integer (64-bit)

Yes

None

The 0-based index of the content in item.content. The current common value is 0.

part

Object

Yes

None

The content part object. For the full schema, see Content in Dialog item and content objects.

{
  "event_id": "event_TWVGNTXOB1OiQbwfbiPKL",
  "item_id": "item_EanOTJJQrQaYauWcbKmvj",
  "content_index": 0,
  "response_id": "resp_I2hBBB1Rze5KBqlg2EpiY",
  "part": {
    "type": "audio",
    "text": ""
  },
  "type": "ResponseContentPartAdded",
  "output_index": 0
}

ResponseContentPartDone

graph TD A[User requests business server] --> B{Business server calls Dashscope Generation API}; B --> C[Dashscope returns streaming response]; C --> D[Business server processes stream and returns to client]; D --> E[Client renders stream in real time]; subgraph Dashscope C end

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseContentPartDone.

event_id

String

Yes

None

The ID of the downstream event, generated by the server. It does not need to match the upstream event_id.

response_id

String

Yes

None

The ID of the translation response. It corresponds to response.id in ResponseCreated and ResponseDone.

item_id

String

Yes

None

The ID of the input or output dialogue item. This ID is not the same as session_id or response_id.

output_index

Integer (64-bit)

Yes

None

The index of the output item in response.output, starting from 0. The most common value is 0.

content_index

Integer (64-bit)

Yes

None

The index of the content in item.content, starting from 0. The most common value is 0.

part

Object

Yes

None

The content part object. For the complete schema, see "Content" in the "Dialogue Item and Content Objects" section.

{
  "event_id": "event_V7g8WV1YyDZmh5XM6SErr",
  "item_id": "item_EanOTJJQrQaYauWcbKmvj",
  "content_index": 0,
  "response_id": "resp_I2hBBB1Rze5KBqlg2EpiY",
  "part": {
    "type": "audio",
    "text": "Hello, welcome to Beijing."
  },
  "type": "ResponseContentPartDone",
  "output_index": 0
}

Event: LanguageDetected

The service is bi-directional, with a fixed direction for each segment. The segment_id links subsequent translations and transliterations. The language pair is fixed at creation time.

Parameter

Type

Required

Default

Description

type

String

Yes

None

The value is fixed to LanguageDetected.

event_id

String

Yes

None

This downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

session_id

String

Yes

None

Session ID. Read this field only when it is returned in this event; other events are associated through the current WebSocket connection and its response_id/item_id.

segment_id

String

Yes

None

The ID for a bidirectional translation segment. The direction, translation, and audio components for the same segment share this ID.

direction

String

Yes

None

A translation direction string, for example, zh->en or en->zh. It is consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

{
  "event_id": "evt_0afdbdd9-9064-4d5d-ba01-5f8a42469134",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "type": "LanguageDetected",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "direction": "zh->en"
}
{ "styles": { "nodes": { "g1": { "label": { "textAlign": "left" } } } }, "nodes": [ { "id": "node1", "label": "Short or real-time recognition?", "shape": "diamond", "style": "g1" }, { "id": "node2", "label": "Perform short speech recognition.", "shape": "rect", "style": "g1" }, { "id": "node3", "label": "Perform real-time speech recognition.", "shape": "rect", "style": "g1" }, { "id": "node4", "label": "Return final recognition result.", "shape": "rect", "style": "g1" }, { "id": "node5", "label": "Return intermediate and final results.", "shape": "rect", "style": "g1" } ], "edges": [ { "source": "node1", "target": "node2", "label": "Short speech recognition" }, { "source": "node1", "target": "node3", "label": "Real-time speech recognition" }, { "source": "node2", "target": "node4" }, { "source": "node3", "target": "node5" } ], "layout": { "type": "dagre", "direction": "TB" } }

Mode

Event name

Name

Event description

Key associated fields

unidirectional

ResponseCreated

Translation response start

Indicates the start of a translation response. This event returns the translation response object and response.id. This ID is used to correlate subsequent events for translated text, audio, and response completion.

event_id + response.id

unidirectional

ResponseDone

Translation response end

Indicates that a translation response has ended. This event returns the final response content and model usage. Only a status of response.status=completed indicates successful completion.

event_id + response.id

bidirectional

SegmentStarted

Translation segment start

Notifies the client that a translation output segment has started. At this stage, the translation direction may not yet be determined.

event_id + session_id + segment_id

bidirectional

SegmentDone

Translation segment end

Notifies the client that processing for the current translation segment has ended. This event returns the translation direction, source language, target language, and audio time range. In case of an error or interruption, this event may also return a finish_reason.

event_id + session_id + segment_id

One-way ResponseCreated

This unidirectional event marks the start of a translation response. response.id is the correlation key for the translation, transliteration, and response completion.

Parameter

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseCreated.

event_id

String

Yes

None

This downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

response

Object

Yes

None

The translation response object. See one-way response object for the full schema.

{
  "type": "ResponseCreated",
  "response": {
    "voice": "Tina",
    "output": [],
    "modalities": [
      "text",
      "audio"
    ],
    "conversation_id": "",
    "output_audio_format": "pcm",
    "id": "resp_I2hBBB1Rze5KBqlg2EpiY",
    "object": "realtime.response",
    "status": "in_progress"
  },
  "event_id": "event_EaGtCiWUI2tZTGA5rOXo3"
}

One-way ResponseDone

Direction: One-way. This event signals the completion of a translation response. Only response.status=completed indicates successful completion. The usage field indicates model usage, not an Aidge billing notification.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to ResponseDone.

event_id

String

Yes

None

The server-side ID of the downstream event. This ID does not need to match the upstream event_id.

response

Object

Yes

None

The translation response object. For a full list of fields, see "one-way response object".

{
  "type": "ResponseDone",
  "response": {
    "voice": "Tina",
    "output": [
      {
        "id": "item_EanOTJJQrQaYauWcbKmvj",
        "role": "assistant",
        "type": "message",
        "content": [
          {
            "type": "audio",
            "transcript": "Hello, welcome to Beijing."
          }
        ],
        "object": "realtime.item",
        "status": "completed"
      }
    ],
    "modalities": [
      "text",
      "audio"
    ],
    "conversation_id": "conv_JTEzDvuRkaVzD8QIHIEGW",
    "usage": {
      "total_tokens": 141,
      "output_tokens": 44,
      "input_tokens_details": {
        "audio_tokens": 28,
        "text_tokens": 69
      },
      "input_tokens": 97,
      "output_tokens_details": {
        "audio_tokens": 27,
        "text_tokens": 17
      }
    },
    "output_audio_format": "pcm",
    "id": "resp_I2hBBB1Rze5KBqlg2EpiY",
    "object": "realtime.response",
    "status": "completed"
  },
  "event_id": "event_KJKD7heEF8D6dKlySKdBN"
}

BidirectionalSegmentStarted

Applies to: bidirectional. This event signals the start of an output translation segment. Because the direction may not be determined yet, this event might not contain the direction field.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to SegmentStarted.

event_id

String

Yes

None

The server-generated ID for this downstream event. It does not need to match the upstream event_id.

session_id

String

Yes

None

The session ID. This field is returned only in this event. Other events are associated via the current WebSocket connection and their respective response_id/item_id.

segment_id

String

Yes

None

The ID for a segment of bidirectional translation. The direction, translation output, and audio for the same segment share the same ID.

start_ms

Integer (64-bit)

Yes

None

The start offset in milliseconds, relative to the beginning of the session's accumulated input audio. This field may be omitted if the source text boundaries have not yet been determined.

{
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "event_id": "evt_aacce721-f708-499c-b564-34def622d8cc",
  "type": "SegmentStarted",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "start_ms": 0
}

bidirectional SegmentDone

This event applies to bidirectional mode and indicates that a segment has finished processing. The finish_reason field can be omitted for a normal completion. A segment can also be terminated by a direction correction or a processing exception, in which case you must check the reason and the error event to determine the cause.

Field

Type

Required

Default

Description

type

String

Yes

None

Fixed to SegmentDone.

event_id

String

Yes

None

This downstream event ID is generated by the server. It is not required to be the same as the upstream event_id.

session_id

String

Yes

None

Session ID. Read this field only when it is returned in this event. Other events are associated through the current WebSocket connection and their response_id/item_id.

segment_id

String

Yes

None

The direction, translation, and audio for the same segment share this ID.

direction

String

Yes

None

A string that specifies the translation direction, for example, zh->en and en->zh. The value must be consistent with source_language and target_language.

source_language

String

Yes

None

The source language code for the current segment.

target_language

String

Yes

None

The target language code for the current segment.

start_ms

Integer (64-bit)

No

None

The start offset in milliseconds, measured from the beginning of the session's input audio. The service may omit this field if it has not determined the segment's start boundary.

end_ms

Integer (64-bit)

No

None

The end offset in milliseconds, measured from the beginning of the session's input audio. The service may omit this field if it has not determined the segment's end boundary.

finish_reason

String

No

None

The reason a segment finished. This field is omitted for normal completions. Example values: direction_changed and direction_unconfirmed. An omitted value should not be interpreted as an explicit completed value.

{
  "event_id": "evt_89347f01-c333-46c5-927b-07effe60b8c3",
  "source_language": "zh",
  "target_language": "en",
  "session_id": "01A1D3A8-9669-1750-89EF-79B9E5E8A900",
  "type": "SegmentDone",
  "segment_id": "seg_e67cdfe3-2969-4fab-a000-1f25c1c31c73",
  "end_ms": 3247,
  "direction": "zh->en",
  "start_ms": 0
}

9. Supported languages

Unidirectional translation - Languages supporting text and audio output (29):

No.

Language name

Language code

Supported output modality

1

Chinese (Simplified)

zh

Text + Audio

2

English

en

Text + Audio

3

Arabic

ar

Text + Audio

4

German

de

Text + Audio

5

French

fr

Text + Audio

6

Spanish

es

Text + Audio

7

Portuguese (Brazil)

pt

Text + Audio

8

Indonesian

id

Text + Audio

9

Italian

it

Text + Audio

10

Korean

ko

Text + Audio

11

Russian

ru

Text + Audio

12

Thai

th

Text + Audio

13

Vietnamese

vi

Text + Audio

14

Japanese

ja

Text + Audio

15

Turkish

tr

Text + Audio

16

Hindi

hi

Text + Audio

17

Malay

ms

Text + Audio

18

Dutch

nl

Text + Audio

19

Urdu

ur

Text + Audio

20

Norwegian Bokmål

nb

Text + Audio

21

Swedish

sv

Text + Audio

22

Danish

da

Text + Audio

23

Hebrew

he

Text + Audio

24

Finnish

fi

Text + Audio

25

Polish

pl

Text + Audio

26

Icelandic

is

Text + Audio

27

Czech

cs

Text + Audio

28

Filipino

fil

Text + Audio

29

Persian

fa

Text + Audio

Unidirectional translation - Languages supporting text-only output (31):

  • Note: For target languages that support only text output, you must explicitly set modalities: ['text']. Otherwise, the system rejects the configuration because the default setting includes audio.

No.

Language name

Language code

Supported output modality

1

Cantonese

yue

Text

2

Greek

el

Text

3

Afrikaans

af

Text

4

Asturian

ast

Text

5

Belarusian

be

Text

6

Bulgarian

bg

Text

7

Bengali

bn

Text

8

Bosnian

bs

Text

9

Catalan

ca

Text

10

Cebuano

ceb

Text

11

Estonian

et

Text

12

Galician

gl

Text

13

Gujarati

gu

Text

14

Croatian

hr

Text

15

Hungarian

hu

Text

16

Javanese

jv

Text

17

Kazakh

kk

Text

18

Kannada

kn

Text

19

Kyrgyz

ky

Text

20

Latvian

lv

Text

21

Macedonian

mk

Text

22

Malayalam

ml

Text

23

Marathi

mr

Text

24

Punjabi

pa

Text

25

Romanian

ro

Text

26

Slovak

sk

Text

27

Slovenian

sl

Text

28

Swahili

sw

Text

29

Tajik

tg

Text

30

Azerbaijani

az

Text

31

Ukrainian

uk

Text

Bidirectional translation

  • This feature supports the zh/en, zh/ja, and zh/ko language pairs. The translation direction can be reversed, and both text and audio output are supported.

No.

Language name

Language code

1

Chinese (Simplified)

zh

2

English

en

3

Japanese

ja

4

Korean

ko

10. Voices and voice cloning

Supported voices: You can select a system preset voice or use real-time cloning during translation to make the translation playback sound like your own voice speaking a foreign language.

The default voice is: Tina

voice parameter

Description

Supported languages

Tina

voice name: Sweet Tina Description: My voice is like warm milk tea—sweet and cozy. But when it comes to solving problems, I don’t mess around.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Cindy

voice name: Lin Xinyi Cindy Description: A sweet, cutesy young woman with a Taiwanese accent.

Chinese (Taiwanese Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Liora Mira

voice name: Qinghuan Liora Mira Description: Weaving everyday warmth and tenderness through sound.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Sunnybobi

voice name: Zhizhi Sunnybobi Description: A carefree, shy, girl-next-door type.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Raymond

voice name: Lin Chuanye Raymond Description: A clear and bright voice; a homebody who loves ordering takeout.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Ethan

voice name: Chenxu Ethan Description: Standard Mandarin with a slight northern accent. Sunny, warm, energetic, and full of life.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Theo Calm

voice name: Yuan’an Theo Calm Description: Sharing understanding in silence and healing hearts through words.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Serena

voice name: Su Yao Serena Description: A gentle young woman.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Harvey

voice name: Hou Harvey Description: My voice comes from time itself—deep and gentle, with hints of coffee and old books.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Maia

voice name: Siyue Maia Description: Where intelligence meets tenderness.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Evan

voice name: Jiang Chen Evan Description: A male college student with a younger, puppy-like vibe.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Qiao

voice name: Xiao Qiaomei Qiao Description: She’s not just cute; she’s sweet on the outside, bold on the inside.

Chinese (Taiwanese Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Momo

voice name: Motu Momo Description: Playful and silly, here to make you smile.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Wil

voice name: Weilen Wil Description: A guy with a Hong Kong/Taiwanese accent who grew up in Shenzhen.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Angel

voice name: Taiwan-accented Mandarin - Angel Description: She has a slight Taiwanese accent and is very sweet!

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Li Cassian

voice name: Eastern Depot - Eunuch Li Li Cassian Description: Subtle and perceptive, he understands more than he says.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Mia

voice name: Gentle lifestyle blogger - Shuran Mia Description: A lifestyle artist who delivers slow-living aesthetics and everyday healing with a delicate voice.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Joyner

voice name: Comedy lead - Adou Joyner Description: Funny, exaggerated, and down-to-earth.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Gold

voice name: Jin Ye Gold Description: A Black rapper from the West Coast.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Katerina

voice name: Katerina Description: A strong, mature female voice with a rich rhythm and lingering resonance.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Ryan

voice name: Sweet Tea Ryan Description: Full-on rhythm, explosive drama, where truth and tension dance together.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Jennifer

voice name: Jennifer Description: A brand-grade American English female voice with a cinematic feel.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Aiden

voice name: Aiden Description: A young American man who is great at cooking.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Mione

voice name: Min’er Mione Description: Mature and intelligent, like a British girl-next-door.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Sohee

voice name: Sohee Description: Gentle and bright, an expressive Korean "unni" (older sister).

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Lenn

voice name: Lai’en Lenn Description: Rational at the core, rebellious in the details—a German youth who wears a suit but listens to post-punk.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Ono Anna

voice name: Ono Anna Description: A mischievous childhood friend.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Sonrisa

voice name: Sonrisa Description: A warm and upbeat Latina.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Bodega

voice name: Bodega Description: A passionate Spanish man.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Emilien

voice name: Emilien Description: A romantic French man.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Andre

voice name: Andre Description: A magnetic, natural, soothing, and steady male voice.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Radio Gol

voice name: Rádio Gol Description: Soccer poet Rádio Gol! Here to call the game for you!

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Alek

voice name: Alek Description: From the first word, you hear the chill of a tough nation—and the warmth under a wool coat.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Rizky

voice name: Ali Rizky Description: A young Indonesian man with a distinctive voice.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Roya

voice name: Roya Description: A sporty girl with a free spirit.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Arda

voice name: Arda Description: Neither loud nor low, but clean and crisp, with a warm quality.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Hana

voice name: Axing Hana Description: A mature Vietnamese woman who loves dogs.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Dolce

voice name: Dolce Description: A laid-back Italian man.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Jakub

voice name: Jakub Description: An artsy young man from a small Polish town with a magnetic, sexy voice.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Griet

voice name: Griet Description: A mature and artistic Dutch woman.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Eliška

voice name: Eliška Description: Each word carries Central European craftsmanship and warmth.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Marina

voice name: Marina Description: A girl who grew up in a multicultural city.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Siiri

voice name: Siiri Description: Reserved and gentle, with a pace as calm as ripples on a lake.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Ingrid

voice name: Ingrid Description: A Norwegian country girl.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Sigga

voice name: Sigga Description: An intelligent young woman from a small Icelandic town.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Bea

voice name: Bea Description: A sweet Filipina who loves coffee.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

Chloe

voice name: Siyi Chloe Description: A Malaysian white-collar professional.

Chinese (Mandarin), English, French, German, Russian, Italian, Spanish, Portuguese, Japanese, Korean, Thai, Indonesian, Arabic, Vietnamese, Turkish, Finnish, Polish, Hindi, Dutch, Czech, Urdu, Filipino, Swedish, Danish, Hebrew, Icelandic, Malay, Norwegian, Persian

11. Billing method

Per-minute billing

  • Speech-to-text: ¥0.15/minute

  • Speech-to-speech: ¥0.48/minute