User guide: For model introduction and selection recommendations, see Speech synthesis.
When the client sends the
After the client sends text, the server streams
When the task is complete, the server returns a
When a task fails, the server returns a
task-started
When the client sends the run-task command, the server returns a task-started event to indicate the task has started.
header.task_idstringThe task ID generated by the client.header.eventstringThe event type. Fixed value: task-started.payloadobjectEmpty object with no content. |
result-generated
After the client sends text, the server streams result-generated events. Each event includes full timestamp data in output.sentence, with word-level and phoneme-level timestamps when the corresponding parameters are enabled.
header.task_idstringThe task ID generated by the client.header.eventstringThe event type. Fixed value: result-generated.payload.outputobjectThe synthesized audio output.
Properties sentence.begin_time integerThe begin timestamp of the sentence. Unit: milliseconds.sentence.end_timeintegerThe end timestamp of the sentence. Unit: milliseconds.sentence.wordsarrayWord-level timestamps for each word in the sentence.
Element properties of words text stringThe text content of the word.begin_timeintegerThe begin timestamp of the word in the audio. Unit: milliseconds.end_timeintegerThe end timestamp of the word in the audio. Unit: milliseconds.phonemesarray(requires phoneme_timestamp_enabled)Phoneme-level timestamps for each phoneme in the word.
Element properties of phonemes text stringThe phoneme text.toneintegerThe tone value.begin_timeintegerThe begin timestamp of the phoneme. Unit: milliseconds.end_timeintegerThe end timestamp of the phoneme. Unit: milliseconds.objectBilling usage for the current event.
Properties charactersintegerThe cumulative billed character count up to the current event. |
task-finished
When the task is complete, the server returns a task-finished event. The client can then close the WebSocket connection or reuse the connection for a new task.
header.task_idstringThe task ID generated by the client.header.eventstringThe event type. Fixed value: task-finished.payload.usage.charactersintegerThe cumulative billed character count up to the current event. |
task-failed
When a task fails, the server returns a task-failed event. Close the WebSocket connection and handle the error.
header.task_idstringThe task ID generated by the client.header.eventstringThe event type. Fixed value: task-failed.header.error_codestringThe error code.header.error_messagestringThe detailed error message. |