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_idstringThe task ID generated by the client.header.eventstringEvent type. Fixed value: task-started.payloadobjectEmpty object.
After the client sends text, the server continuously returns result-generated events. Each event carries sentence-level metadata.
header.task_idstringThe task ID generated by the client.header.eventstringEvent type. Fixed value: result-generated.payload.outputobjectOutput information.
Properties
typestringSub-event type. Valid values:
sentence-begin: Sentence start. Returns the text to be synthesized.
sentence-synthesis: Marks an audio frame. One audio frame is transmitted over the WebSocket binary channel immediately after each event.
sentence-end: Sentence end. Returns the text content and cumulative character count.
sentence.indexintegerSentence index, starting from 0.sentence.wordsarrayWord-level timestamp array.
words element properties
textstringText content of the word.begin_indexintegerStart character index of the word within the sentence. Starts at 0.end_indexintegerEnd character index of the word within the sentence. Starts at 1.begin_timeintegerStart time of the word's corresponding audio, in milliseconds.end_timeintegerEnd time of the word's corresponding audio, in milliseconds.
original_textstringText of the sentence as segmented for synthesis.
payload.usageobjectBilling information, returned in the sentence-end event.
Properties
charactersintegerCumulative number of billed characters.
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_idstringThe task ID generated by the client.header.eventstringEvent type. Fixed value: task-finished.payload.usage.charactersintegerCumulative number of billed characters.
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_idstringThe task ID generated by the client.header.eventstringEvent type. Fixed value: task-failed.header.error_codestringError code.header.error_messagestringDetailed error message.