This topic describes the server events and fields of Qwen-Audio-ASR-Message.
task-started
The task has started successfully. The client can begin sending audio data.
| Parameter | Type | Description |
|---|---|---|
| header | object | |
| header.task_id | string | The task ID generated by the client (in UUID format). |
| header.event | string | The event type. This value is always task-started. |
| header.attributes | object | Additional attributes. This value is usually empty. |
| payload | object | This value is always {}. |
result-generated
Recognition results. By default, final sentence text is returned (sentence_end=true). Set intermediate_result_enabled=true to also receive intermediate text (sentence_end=false). Intermediate text may be revised: update the displayed text by sentence_id instead of concatenating it. A sentence-start event may contain sentence_begin=true and empty text.
Sentence-start result:
| Parameter | Type | Description |
|---|---|---|
| header | object | |
| header.task_id | string | The task ID generated by the client (in UUID format). |
| header.event | string | The event type. This value is always result-generated. |
| payload | object | |
| payload.output | object | |
| payload.output.sentence | object | |
| payload.output.sentence.begin_time | integer | The start time of the sentence, in milliseconds. |
| payload.output.sentence.end_time | integer | The end time of the sentence, in milliseconds. |
| payload.output.sentence.text | string | The recognized text. |
| payload.output.sentence.heartbeat | boolean | If this value is true, the result is a heartbeat packet and can be ignored. |
| payload.output.sentence.sentence_begin | boolean | Indicates the start of a sentence. |
| payload.output.sentence.sentence_end | boolean | Whether the sentence has ended (true = final result, false = intermediate result). |
| payload.output.sentence.sentence_id | integer | 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. |
| payload.output.sentence.words | array[object] | Word-level timestamp information. |
| payload.output.sentence.words.begin_time | integer | The start time of the word, in milliseconds. |
| payload.output.sentence.words.end_time | integer | The end time of the word, in milliseconds. |
| payload.output.sentence.words.text | string | The recognized text. |
| payload.output.sentence.words.punctuation | string | The punctuation mark. |
| payload.usage | object | Cumulative usage for the current task as of this event. |
| payload.usage.duration | integer | Cumulative audio duration in seconds, retained for compatibility. |
| payload.usage.input_tokens | integer | Cumulative number of input tokens. |
| payload.usage.output_tokens | integer | Cumulative number of output tokens. |
| payload.usage.total_tokens | integer | Cumulative total number of tokens: the sum of input_tokens and output_tokens. |
task-finished
The task has ended normally. You can close the connection or reuse it.
| Parameter | Type | Description |
|---|---|---|
| header | object | |
| header.task_id | string | The task ID generated by the client (in UUID format). |
| header.event | string | The event type. This value is always task-finished. |
| header.attributes | object | Additional attributes. This value is usually empty. |
| payload | object | Contains output (an empty object) and usage (the final cumulative usage for this task). The usage fields have the same definitions as in result-generated. |
task-failed
The task has failed. The connection is closed and cannot be reused.
| Parameter | Type | Description |
|---|---|---|
| header | object | |
| header.task_id | string | The task ID generated by the client (in UUID format). |
| header.event | string | The event type. This value is always task-failed. |
| header.error_code | string | A description of the error type. |
| header.error_message | string | The specific cause of the error. |
| header.attributes | object | Additional attributes. This value is usually empty. |
| payload | object | This value is always {}. |