This topic describes the service endpoint, request headers, and interaction flow for accessing the Qwen-Audio-3.0-ASR-Flash-Streaming/Fun-ASR-Realtime real-time speech recognition service over a WebSocket connection.
Service endpoint
The WebSocket URL is fixed:
- Singapore
- China (Beijing)
wss://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api-ws/v1/inferenceReplace {WorkspaceId} with your actual Workspace ID.Request headers
Add the following information to the request header:
Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Authentication token in the format |
user-agent | string | No | Client identifier that helps the server track the request source. |
X-DashScope-WorkSpace | string | No | Model Studio workspace ID. |
X-DashScope-DataInspection | string | No | Whether to enable data compliance inspection. This parameter is omitted or set to |
Interaction flow
For details about client events and server events, see Client events and Server-side events.
- Establish the connection: The client establishes a WebSocket connection to the server.
- Start the task: The client sends a run-task instruction to start the task and receives a task-started event from the server. This event confirms that the task has started and that you can proceed to the subsequent steps.
- Send the audio stream: The client starts sending binary audio (which must be mono) and simultaneously receives a stream of result-generated events from the server. Each event contains a speech recognition result.
- Notify the server to end the task: The client sends a finish-task instruction to signal the server to end the task and continues to receive result-generated events from the server.
- End the task: The client receives a task-finished event from the server, which indicates that the task has ended.
- Close the connection: The client closes the WebSocket connection.