All Products
Search
Document Center

Alibaba Cloud Model Studio:Qwen-Audio-ASR-Streaming server events

Last Updated:Nov 23, 2026

Server event reference for Qwen-Audio-ASR-Streaming: task startup, recognition results, completion, failure, and corresponding requests.

Event flow

  1. Send run-task. Wait for task-started before sending audio.
  2. Continue sending audio while receiving result-generated events.
  3. After sending all audio, send finish-task and receive results until task-finished arrives. A failed task returns task-failed.

Audio is not sent in run-task: WebSocket uses binary frames, and AOQ uses an Audio Track. For connection setup, authentication, and audio transport, see WebSocket API or AOQ access.

task-started

Indicates that the task has started successfully and the client can begin sending audio.

ImportantWait for task-started before sending audio. run-task only starts and configures the task; it does not carry audio data.

headerobject
task_idstring

The task ID generated by the client (in UUID format).

eventstring

The event type. This value is always task-started.

attributesobject

Additional attributes. This value is usually empty.

payloadobject

This value is always {}.

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "task_uuid": "f32fbf86736e4c279b5d133bff74b657",
    "event": "task-started",
    "attributes": {}
  },
  "payload": {}
}

result-generated

Returns recognition results, including sentence starts, intermediate results, final sentence results, and heartbeats.

Importantsentence_end=true marks the end of a sentence, not the task. You can skip heartbeat results (heartbeat=true). The task ends when task-finished arrives.

headerobject
task_idstring

The task ID generated by the client (in UUID format).

eventstring

The event type. This value is always result-generated.

payloadobject
outputobject
sentenceobject
sentence_idinteger

The sequence identifier of the sentence. In normal recognition results, sentence_id increments from 1. When heartbeat is true (that is, a heartbeat packet), sentence_id is always 0.

begin_timeinteger

The start time of the sentence, in milliseconds.

end_timeinteger | null

The end time of the sentence, in milliseconds. May be null in intermediate results or heartbeats.

textstring

The recognized text.

sentence_beginboolean

Indicates the start of a sentence.

sentence_endboolean

Whether the sentence has ended (true = final result, false = intermediate result).

heartbeatboolean

If this value is true, the result is a heartbeat packet and can be ignored.

wordsarray[object]

Word-level timestamp information.

begin_timeinteger

The start time of the word, in milliseconds.

end_timeinteger

The end time of the word, in milliseconds.

textstring

The recognized text.

punctuationstring

The punctuation mark.

usageobject

Cumulative usage for the current task.

Noteusage contains cumulative usage for the current task and may be absent from some intermediate results. Do not add usage values across events. qwen-audio-3.0-asr-flash-streaming is billed by duration, and qwen-audio-3.1-asr-flash-streaming by tokens. See the field descriptions for applicability.

durationinteger

Cumulative audio duration, in seconds.

NoteUsed for billing for qwen-audio-3.0-asr-flash-streaming.

input_tokensinteger

Cumulative input tokens.

NoteApplies to qwen-audio-3.1-asr-flash-streaming.

output_tokensinteger

Cumulative output tokens.

NoteApplies to qwen-audio-3.1-asr-flash-streaming.

total_tokensinteger

Total cumulative tokens, equal to the sum of input and output tokens.

NoteApplies to qwen-audio-3.1-asr-flash-streaming.

Sentence start

After receiving task-started, send audio. The example below is one subsequent result-generated event. Audio is sent as binary frames over WebSocket or through the Audio Track over AOQ.

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 0,
        "end_time": null,
        "text": "",
        "channel_id": 0,
        "sentence_end": false,
        "sentence_begin": true,
        "words": []
      },
      "text": "",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 0,
          "end_time": null,
          "text": "",
          "channel_id": 0,
          "sentence_end": false,
          "sentence_begin": true,
          "words": []
        },
        "text": "",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      }
    }
  }
}

Intermediate result

After receiving task-started, send audio. The example below is one subsequent result-generated event. Audio is sent as binary frames over WebSocket or through the Audio Track over AOQ.

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 0,
        "end_time": null,
        "text": "Please",
        "channel_id": 0,
        "sentence_end": false,
        "words": [
          {
            "begin_time": 0,
            "end_time": 320,
            "text": "Please",
            "punctuation": "",
            "fixed": false,
            "speaker_id": null
          }
        ]
      },
      "text": "Please",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 0,
          "end_time": null,
          "text": "Please",
          "channel_id": 0,
          "sentence_end": false,
          "words": [
            {
              "begin_time": 0,
              "end_time": 320,
              "text": "Please",
              "punctuation": "",
              "fixed": false,
              "speaker_id": null
            }
          ]
        },
        "text": "Please",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      }
    }
  }
}

Final sentence result

After receiving task-started, send audio. The example below is one subsequent result-generated event. Audio is sent as binary frames over WebSocket or through the Audio Track over AOQ.

{
  "header": {
    "action": "run-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 1,
        "begin_time": 120,
        "end_time": 3990,
        "text": "Please send the quarterly project report to Kellera before Friday. ",
        "channel_id": 0,
        "sentence_end": true,
        "words": [
          {
            "begin_time": 120,
            "end_time": 320,
            "text": "Please",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 320,
            "end_time": 560,
            "text": " send",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 560,
            "end_time": 760,
            "text": " the",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 760,
            "end_time": 1360,
            "text": " quarterly",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 1360,
            "end_time": 1800,
            "text": " project",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 1800,
            "end_time": 2120,
            "text": " report",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2120,
            "end_time": 2280,
            "text": " to",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2280,
            "end_time": 2336,
            "text": " ",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2336,
            "end_time": 2560,
            "text": "Kell",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2560,
            "end_time": 2800,
            "text": "era",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 2800,
            "end_time": 3160,
            "text": " before",
            "punctuation": "",
            "fixed": true,
            "speaker_id": null
          },
          {
            "begin_time": 3160,
            "end_time": 3990,
            "text": " Friday",
            "punctuation": ". ",
            "fixed": true,
            "speaker_id": null
          }
        ],
        "stash": {
          "sentence_id": 2,
          "text": "",
          "begin_time": 3990,
          "current_time": 3990,
          "words": []
        }
      },
      "text": "Please send the quarterly project report to Kellera before Friday. ",
      "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
      "output": {
        "sentence": {
          "sentence_id": 1,
          "begin_time": 120,
          "end_time": 3990,
          "text": "Please send the quarterly project report to Kellera before Friday. ",
          "channel_id": 0,
          "sentence_end": true,
          "words": [
            {
              "begin_time": 120,
              "end_time": 320,
              "text": "Please",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 320,
              "end_time": 560,
              "text": " send",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 560,
              "end_time": 760,
              "text": " the",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 760,
              "end_time": 1360,
              "text": " quarterly",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 1360,
              "end_time": 1800,
              "text": " project",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 1800,
              "end_time": 2120,
              "text": " report",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2120,
              "end_time": 2280,
              "text": " to",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2280,
              "end_time": 2336,
              "text": " ",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2336,
              "end_time": 2560,
              "text": "Kell",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2560,
              "end_time": 2800,
              "text": "era",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 2800,
              "end_time": 3160,
              "text": " before",
              "punctuation": "",
              "fixed": true,
              "speaker_id": null
            },
            {
              "begin_time": 3160,
              "end_time": 3990,
              "text": " Friday",
              "punctuation": ". ",
              "fixed": true,
              "speaker_id": null
            }
          ],
          "stash": {
            "sentence_id": 2,
            "text": "",
            "begin_time": 3990,
            "current_time": 3990,
            "words": []
          }
        },
        "text": "Please send the quarterly project report to Kellera before Friday. ",
        "request_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4"
      },
      "usage": {
        "duration": 4,
        "input_tokens": 50,
        "output_tokens": 13,
        "total_tokens": 63
      }
    },
    "usage": {
      "duration": 4,
      "input_tokens": 50,
      "output_tokens": 13,
      "total_tokens": 63
    }
  }
}

Heartbeat

Set heartbeat=true in run-task and continue sending silent audio. The example below shows a heartbeat event returned by the server.

{
  "header": {
    "action": "run-task",
    "task_id": "eac269a3-a31d-417a-979d-51066926d8a6",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "pcm",
      "sample_rate": 16000,
      "heartbeat": true
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "eac269a3-a31d-417a-979d-51066926d8a6",
    "event": "result-generated",
    "attributes": {}
  },
  "payload": {
    "output": {
      "sentence": {
        "sentence_id": 0,
        "begin_time": 0,
        "end_time": null,
        "text": "",
        "channel_id": 0,
        "speaker_id": null,
        "sentence_end": false,
        "heartbeat": true,
        "words": []
      },
      "text": "",
      "request_id": "eac269a3-a31d-417a-979d-51066926d8a6",
      "output": {
        "sentence": {
          "sentence_id": 0,
          "begin_time": 0,
          "end_time": null,
          "text": "",
          "channel_id": 0,
          "speaker_id": null,
          "sentence_end": false,
          "heartbeat": true,
          "words": []
        },
        "text": "",
        "request_id": "eac269a3-a31d-417a-979d-51066926d8a6"
      }
    },
    "usage": {
      "duration": 2
    }
  }
}

task-finished

Indicates that task processing is complete. All recognition results for the task have been returned.

headerobject
task_idstring

The task ID generated by the client (in UUID format).

eventstring

The event type. This value is always task-finished.

attributesobject

Additional attributes. This value is usually empty.

payloadobject
usageobject

Cumulative usage at the end of the task. The fields have the same meanings as in result-generated.usage.

{
  "header": {
    "action": "finish-task",
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "streaming": "duplex"
  },
  "payload": {
    "input": {}
  }
}
{
  "header": {
    "task_id": "3d30b8aa-8859-46ef-a65a-32cf5a9f0ca4",
    "event": "task-finished",
    "attributes": {}
  },
  "payload": {
    "output": {},
    "usage": {
      "duration": 4,
      "input_tokens": 50,
      "output_tokens": 13,
      "total_tokens": 63
    }
  }
}

task-failed

Indicates that the task failed. Check error_code and error_message for the cause. After a task fails, the WebSocket connection is closed and cannot be reused.

headerobject
task_idstring

The task ID generated by the client (in UUID format).

eventstring

The event type. This value is always task-failed.

error_codestring

A description of the error type.

error_messagestring

The specific cause of the error.

attributesobject

Additional attributes. This value is usually empty.

payloadobject

This value is always {}.

This request uses an unsupported audio format to demonstrate task-failed. The error code and message depend on the cause of failure.

{
  "header": {
    "action": "run-task",
    "task_id": "9272a5a2-8df4-4f2d-af0e-e544c17f3e42",
    "streaming": "duplex"
  },
  "payload": {
    "task_group": "audio",
    "task": "asr",
    "function": "recognition",
    "model": "qwen-audio-3.1-asr-flash-streaming",
    "parameters": {
      "format": "invalid-format",
      "sample_rate": 16000
    },
    "input": {}
  }
}
{
  "header": {
    "task_id": "9272a5a2-8df4-4f2d-af0e-e544c17f3e42",
    "event": "task-failed",
    "error_code": "UNSUPPORTED_FORMAT",
    "error_message": "UNSUPPORTED_FORMAT"
  },
  "payload": {}
}