Reference for the server-sent events that the Paraformer real-time speech recognition service pushes to clients over WebSocket. This topic documents the data structure and field semantics of the four event types: task-started, result-generated, task-finished, and task-failed.
User guide: For model details and selection guidance, see Speech-to-text.
Event interaction flow: For the event sequence diagram, see WebSocket API.
Description: The task has started successfully. The client can begin sending audio data.
Description: Recognition result. Includes intermediate results (sentence_end=false) and final results (sentence_end=true).
Description: The task ended normally. You can close the connection or reuse it.
Description: The task failed. The connection is closed and cannot be reused.
task-started
Description: The task has started successfully. The client can begin sending audio data.
headerobject
Properties task_id stringClient-generated task ID (UUID format).eventstringEvent type. Always task-started.attributesobjectAdditional attributes. Typically empty.objectAlways {}. |
result-generated
Description: Recognition result. Includes intermediate results (sentence_end=false) and final results (sentence_end=true).
headerobject
Properties task_id stringClient-generated task ID (UUID format).eventstringEvent type. Always result-generated.object
Properties output object
Properties usage objectWhen payload.output.sentence.sentence_end is false (the current sentence has not ended), usage is null.When payload.output.sentence.sentence_end is true (the current sentence has ended), usage.duration indicates the billable duration of the current task.
Properties duration integerBillable task duration, in seconds.
Properties sentence object
Properties begin_time integerSentence start time, in milliseconds.end_timeintegerSentence end time, in milliseconds.textstringRecognized text.heartbeatbooleanIf true, you can skip this result (heartbeat packet).sentence_endbooleanWhether the sentence has ended (true=final result, false=intermediate result).emo_tagstringSentiment of the current sentence:
floatEmotion confidence score in the range [0.0, 1.0]. A higher value indicates greater confidence.wordsarray[object]Word-level timestamp information.
Properties begin_time integerWord start time, in milliseconds.end_timeintegerWord end time, in milliseconds.textstringRecognized text.punctuationstringPunctuation mark. |
task-finished
Description: The task ended normally. You can close the connection or reuse it.
headerobject
Properties task_id stringClient-generated task ID (UUID format).eventstringEvent type. Always task-finished.attributesobjectAdditional attributes. Typically empty.objectThe contents can be ignored. Typically {}. |
task-failed
Description: The task failed. The connection is closed and cannot be reused.
headerobject
Properties task_id stringClient-generated task ID (UUID format).eventstringEvent type. Always task-failed.error_codestringDescription of the error type.error_messagestringSpecific cause of the error.attributesobjectAdditional attributes. Typically empty.objectAlways {}. |