Realtime API overview

Updated at:

Explore supported Realtime API models, access methods, authentication, and existing tutorials and demos.

The Realtime API supports real-time multimodal interaction, speech recognition, speech synthesis, voice conversation, and audio and video translation. Find the access methods supported by your model, then choose one for your application and open the corresponding access documentation.

Model and protocol support

The following table lists the protocols supported by each model and application. Click "Supported" to open the corresponding access documentation.

Model/application typeModelWebSocketWebRTCAOQ

Real-time multimodal

qwen3.8-omni-flash-realtime, qwen3.5-omni-plus-realtime, qwen3.5-omni-flash-realtime

Supported

Supported

Supported

Real-time speech synthesis

qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash, qwen-audio-3.0-tts-flash, qwen-audio-3.0-tts-plus

Supported

Unsupported

Supported

CosyVoice series models

Supported

Unsupported

Supported

Real-time speech recognition

qwen-audio-3.1-asr-flash-message, qwen-audio-3.1-asr-flash-streaming, qwen-audio-3.0-asr-flash-streaming, Fun-ASR-Realtime series models

Qwen-Audio-ASR-Message

Qwen-Audio-ASR-Streaming

Fun-ASR-Realtime

Unsupported

Qwen-Audio-ASR-Message

Qwen-Audio-ASR-Streaming

Fun-ASR-Realtime

Real-time voice conversation

qwen-audio-3.1-realtime-plus, qwen-audio-3.1-realtime-flash, qwen-audio-3.0-realtime-plus, qwen-audio-3.0-realtime-flash

Supported

Supported

Supported

Qwen-Audio-Live

qwen-audio-3.1-live

Supported

Supported

Supported

Real-time speech translation

Qwen-Livetranslate-Realtime series models

Supported

Supported

Supported

Multimodal development kit

multimodal-dialog

Supported

Supported

Supported

NoteFor information such as model names, context windows, prices, and snapshot versions, see the Alibaba Cloud Model Studio console. For rate limits, see Rate limiting.

WebSocket SDKs by model

ModelLanguages and platforms
Qwen-Omni-RealtimePython · Java · C#
Qwen-Audio-ASR-StreamingPython · Java · Node.js · C# · Android · iOS · HarmonyOS · Flutter
Qwen-Audio-ASR-MessagePython · Java · Node.js · C# · Android · iOS · HarmonyOS · Flutter
Fun-ASR-RealtimePython · Java · C# · Android · iOS · HarmonyOS · Flutter
Qwen-ASR-RealtimePython · Java
ParaformerPython · Java · C# · Android · iOS · HarmonyOS · Flutter
Qwen-Audio-TTSPython · Java · Node.js · C# · Android · iOS · HarmonyOS · Flutter
CosyVoicePython · Java · C# · Android · iOS · HarmonyOS · Flutter
Qwen-TTS-RealtimePython · Java
SambertPython · Java · C# · Android · iOS · HarmonyOS · Flutter
Qwen-Audio-RealtimeNode.js · C# · Android · iOS · HarmonyOS · Flutter
Qwen-LiveTranslate-RealtimePython · Java · C# · Flutter

C# reference SDK overview · Methods and events

Choose an access method

The Realtime API supports WebSocket, WebRTC, and AOQ (AI over QUIC). Available access methods and input and output capabilities depend on the selected model. Refer to its access documentation.

DimensionWebSocketWebRTCAOQ

Use cases

Real-time voice and multimodal interaction, server-side integration, rapid prototyping

Real-time browser audio and video interaction, applications with existing WebRTC infrastructure

Native applications that need weak-network optimization and coordinated transmission of audio, video, and model events

Browser compatibility

Natively supported; the API authentication requirements still apply

Natively supported

The current AOQ SDK does not provide browser access

Echo cancellation and noise suppression

Provided by the audio capture and processing components used by the client

Provided by the browser or WebRTC client, depending on the platform and configuration

Depends on the AOQ SDK audio configuration for the selected platform

Client platform support

All platforms (any environment that supports WebSocket)

Browsers, mobile clients

Mobile, desktop, and Linux. For details, see AOQ SDK downloads.

Token Plan

Supported

Supported

Supported

  • WebSocket: For real-time voice and multimodal interaction, server-side integration, and prototyping. The DashScope SDK provides a quick way to implement real-time voice conversations.
  • WebRTC: For real-time audio and video interaction that requires native browser support or uses existing WebRTC infrastructure.
  • AOQ: Based on QUIC, AOQ is optimized for real-time interaction under weak-network conditions. It transports audio, video, and model events on separate tracks and suits native applications that need integrated media capture, codecs, and playback.

Prepare for access

Confirm the region and endpoint, and obtain the API Key for that region and workspace.

NoteFor first-time use, follow the console prompts to activate the service. Copy and securely store the API key immediately after creation. Manage it through environment variables; do not embed it in client code or commit it to a code repository.

For AOQ, download the AOQ SDK for the client platform.

Authentication methods

The Realtime API uses API keys for authentication. Whether you connect over AOQ, WebRTC, or WebSocket, you pass a bearer token in the Authorization HTTP request header.

WebRTC and WebSocket authenticate during connection setup. With AOQ, the AppServer authenticates with an API key when requesting connection credentials, and the client then connects with a temporary token. Data transmission over an established connection does not require re-authentication.

Connection authentication details

WebSocket

WebSocket authenticates the connection using an API Key in the HTTP request headers. Refer to the access documentation for the selected model for specific requirements.

WebRTC

Qwen-Audio-Live sends the Offer SDP over the control WebSocket and authenticates when that connection opens. See Qwen-Audio-Live WebRTC access.

For the models below, WebRTC completes the SDP exchange over an HTTP POST request, and authentication happens at this stage. The client sends the Offer SDP to the server, and the server returns the Answer SDP.

AOQ

AOQ uses a server-side proxy authentication model: the API key is used only on the business AppServer. The client connects with a temporary token returned by the gateway, which keeps the API key off the client.

Obtain connection credentials

When a media connection is needed, the AppServer requests credentials and returns them to the client, which immediately calls connect(config).

To obtain credentials in advance, the AppServer can set tokenExpiresInSecs in the request body. The client must connect within that interval or obtain new credentials. If the parameter is omitted, connect immediately after obtaining the credentials. It does not limit the duration of an established session.

AOQ on-demand authentication and media connection sequence

Request paths

Model seriesConnection request path
Qwen-Omni-Realtime, Qwen-Audio-Realtime, Qwen-Livetranslate-Realtime/api/v1/webrtc/realtime
Qwen-Audio-TTS, CosyVoice, Qwen-Audio-ASR-Streaming, Qwen-Audio-ASR-Message, Fun-ASR-Realtime/api/v1/webrtc/inference

Request details

ParameterLocation / typeDescription

{endpoint}

URL · string

Required. Use the endpoint for the selected region and workspace. With Token Plan, WorkspaceId in the domain is fixed to token-plan.

model

Query · string

Required. The model ID to call. Select its connection path using the model family table above.

Authorization

Header · string

Required. Use Bearer <API_KEY> with an API key that matches the endpoint.

Content-Type

Header · string

Required. Fixed to application/json.

x-dashscope-rtc-transport

Header · string

Required. Use moq for the native AOQ SDK or webtransport for the Web SDK over browser WebTransport.

clientIp

Body · string

Optional. The client’s actual public IP address, used to select a Relay endpoint. If omitted, the request source IP address is used.

tokenExpiresInSecs

Body · integer

Optional. Connection token lifetime in seconds, as an integer from 1 to 1800. Set it only to obtain credentials in advance. Requests with the wrong type or an out-of-range value fail.

Send the request from the AppServer using the appropriate {endpoint} and the DASHSCOPE_API_KEY environment variable. The examples use qwen3.8-omni-flash-realtime. For models that use the Inference path, switch to /api/v1/webrtc/inference and set model accordingly.

curl -X POST \
  "https://{endpoint}/api/v1/webrtc/realtime?model=qwen3.8-omni-flash-realtime" \
  -H "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "x-dashscope-rtc-transport: moq" \
  -d '{}'
curl -X POST \
  "https://{endpoint}/api/v1/webrtc/realtime?model=qwen3.8-omni-flash-realtime" \
  -H "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "x-dashscope-rtc-transport: moq" \
  -d '{"tokenExpiresInSecs": 600}'
curl -X POST \
  "https://{endpoint}/api/v1/webrtc/realtime?model=qwen3.8-omni-flash-realtime" \
  -H "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "x-dashscope-rtc-transport: webtransport" \
  -d '{}'
curl -X POST \
  "https://{endpoint}/api/v1/webrtc/realtime?model=qwen3.8-omni-flash-realtime" \
  -H "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "x-dashscope-rtc-transport: webtransport" \
  -d '{"tokenExpiresInSecs": 600}'

Response details

FieldTypeDescription and SDK mapping

sid

string

Unique session ID. Set AoqConnectConfig.sid in the native SDK. The Web SDK uses this ID to configure the connection.

aoqTokenForClient

string

Temporary token for establishing the client connection. Set AoqConnectConfig.token in the native SDK. The Web SDK uses the token to connect.

clientRelayEndpoints

array

Array of relay endpoints. Each entry contains endpoint, port, and route_index. In the native SDK, populate relayEndpoints and map route_index to routeIndex, using the array index if route_index is absent. Web SDK responses also include certHashes in each entry.

clientRelayEndpoints[].certHashes

array<string>

Returned only for Web SDK requests. A list of SHA-256 fingerprints of this endpoint’s WebTransport server certificate. Each fingerprint is a 64-character lowercase hexadecimal string.

clientRelayCertFingerprint

string

Returned only for native SDK requests. Set AoqConnectConfig.certFingerprint to this relay TLS certificate fingerprint. The Web SDK uses certHashes from each endpoint instead.

sidExpiresInSecs

integer

Connection token lifetime in seconds. Returned only when the request specifies tokenExpiresInSecs, with the same value. Otherwise, the field is absent.

extraInfo.workspaceIdHash

string

Hash of the workspace ID. Set AoqConnectConfig.workspaceIdHash in the native SDK. For the Web SDK, follow its connection guide.

The endpoints, ports, and certificate fingerprints in the sample responses are illustrative. Use the values returned by the API.

{
  "sid": "<session_id>",
  "aoqTokenForClient": "<token>",
  "clientRelayEndpoints": [
    {"endpoint": "192.0.2.1", "port": 8443, "route_index": 0}
  ],
  "clientRelayCertFingerprint": "sha256/<fingerprint>",
  "extraInfo": {"workspaceIdHash": "<workspace_id_hash>"}
}
{
  "sid": "<session_id>",
  "aoqTokenForClient": "<token>",
  "clientRelayEndpoints": [
    {"endpoint": "192.0.2.1", "port": 8443, "route_index": 0}
  ],
  "clientRelayCertFingerprint": "sha256/<fingerprint>",
  "sidExpiresInSecs": 600,
  "extraInfo": {"workspaceIdHash": "<workspace_id_hash>"}
}
{
  "sid": "<session_id>",
  "aoqTokenForClient": "<token>",
  "clientRelayEndpoints": [
    {
      "endpoint": "192.0.2.1",
      "port": 4443,
      "route_index": 0,
      "certHashes": [
        "7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069"
      ]
    }
  ],
  "sidExpiresInSecs": 600,
  "extraInfo": {
    "workspaceIdHash": "<workspace_id_hash>"
  }
}

If a Web SDK request omits tokenExpiresInSecs, the response also omits sidExpiresInSecs. The remaining fields have the same structure.

Developer resources

WebRTC tutorials

AOQ tutorials and Demo

Use the Android Demo to try AOQ access. Scan the QR code to download the APK, then install it and configure the API Key and workspaceId. You can then try the subset of models supported by the Demo.

AOQ Android Demo APK download QR code