task-started
After the client sends the run-task command, the server returns a task-started event to signal that the task has started. The client can send subsequent commands only after receiving this event.
header.task_id stringThe task ID generated by the client.header.event stringEvent type. Fixed value: task-started.payload objectEmpty object. |
result-generated
After the client sends text, the server continuously returns result-generated events. Each event carries sentence-level metadata.
header.task_id stringThe task ID generated by the client.header.event stringEvent type. Fixed value: result-generated.payload.output objectOutput information.
Properties type stringSub-event type. Valid values:
integerSentence index, starting from 0.sentence.words arrayWord-level timestamp array.
words element properties text stringText content of the word.begin_index integerStart character index of the word within the sentence. Starts at 0.end_index integerEnd character index of the word within the sentence. Starts at 1.begin_time integerStart time of the word's corresponding audio, in milliseconds.end_time integerEnd time of the word's corresponding audio, in milliseconds.stringText of the sentence as segmented for synthesis.objectBilling usage, returned in the sentence-end event.
Properties input_tokens integerInput token count for this request.Applies to qwen-audio-3.1-tts-flash.integerOutput token count for this request.Applies to qwen-audio-3.1-tts-flash.integerSum of input and output tokens.Applies to qwen-audio-3.1-tts-flash.integerCumulative number of billed characters.Applies to qwen-audio-3.0-tts-plus and qwen-audio-3.0-tts-flash. |
task-finished
The server returns a task-finished event when the task completes. The client can then close the WebSocket connection or reuse it to start a new task.
header.task_id stringThe task ID generated by the client.header.event stringEvent type. Fixed value: task-finished.payload.usage objectThe fields are the same as usage in result-generated. |
task-failed
The server returns a task-failed event when the task fails. On receiving this event, the client must close the WebSocket connection and handle the error.
header.task_id stringThe task ID generated by the client.header.event stringEvent type. Fixed value: task-failed.header.error_code stringError code.header.error_message stringDetailed error message. |