WebSocket 服务端事件参考
qwen3.5-livetranslate-flash-realtime API 的服务端事件。
服务端返回的错误。
连接建立时发送,包含默认会话配置。
所有翻译完成后发送。
仅在您发送 session.finish 后触发。收到此事件后可以断开连接。
服务端检测到音频流中出现语音活动时发送。
服务端检测到语音片段结束时发送。
服务端开始生成新响应时发送。
响应生成完成时发送。
纯文本模式下,模型增量生成文本时发送。
纯文本输出完成时发送。
模型增量生成音频数据时发送。
音频生成完成时发送。
流式返回源语言的语音识别结果。需要设置
语音识别完成时发送,包含最终识别结果。需要设置
输出包含音频时,实时流式返回翻译文本。
音频输出的翻译文本生成完成时发送。
响应生成过程中创建新输出项时发送。
输出项完成时发送。
新的内容部分开始时发送。
内容部分完成时发送。
参考:语音翻译。
error
服务端返回的错误。
Example
string
body
事件 ID。
string
body
固定为
error。object
body
错误详情。
session.created
连接建立时发送,包含默认会话配置。
Example
string
body
事件 ID。
string
body
固定为
session.created。object
body
会话配置。
session.updated
session.update 请求成功后发送。如果出错,服务端会返回 error 事件。
Example
string
body
事件 ID。
string
body
固定为
session.updated。object
body
会话配置。
session.finished
所有翻译完成后发送。
仅在您发送 session.finish 后触发。收到此事件后可以断开连接。
Example
string
body
事件 ID。
string
body
固定为
session.finished。input_audio_buffer.speech_started
服务端检测到音频流中出现语音活动时发送。
Example
string
body
事件 ID。
string
body
固定为
input_audio_buffer.speech_started。integer
body
检测到语音起始位置的时间偏移(毫秒)。
input_audio_buffer.speech_stopped
服务端检测到语音片段结束时发送。
Example
string
body
事件 ID。
string
body
固定为
input_audio_buffer.speech_stopped。integer
body
检测到语音结束位置的时间偏移(毫秒)。
response.created
服务端开始生成新响应时发送。
Example
string
body
事件 ID。
string
body
固定为
response.created。object
body
响应对象。
response.done
响应生成完成时发送。response 对象包含所有输出项,但不包含原始音频数据。
Example
string
body
事件 ID。
string
body
固定为
response.done。object
body
响应对象。
response.text.text
纯文本模式下,模型增量生成文本时发送。
Example
string
body
事件 ID。
string
body
固定为
response.text.text。string
body
增量文本片段。
string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
response.text.done
纯文本输出完成时发送。
响应被中断、未完成或取消时也会发送此事件。
Example
string
body
事件 ID。
string
body
固定为
response.text.done。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
string
body
完整文本输出。
response.audio.delta
模型增量生成音频数据时发送。
Example
string
body
事件 ID。
string
body
固定为
response.audio.delta。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
string
body
Base64 编码的音频数据片段。
response.audio.done
音频生成完成时发送。
响应被中断、未完成或取消时也会发送此事件。此事件不包含完整音频数据。
Example
string
body
事件 ID。
string
body
固定为
response.audio.done。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
conversation.item.input_audio_transcription.text
流式返回源语言的语音识别结果。需要设置 input_audio_transcription.model。
Example
string
body
事件 ID。
string
body
固定为
conversation.item.input_audio_transcription.text。string
body
消息项 ID。
integer
body
固定为 0。
string
body
已确认的识别文本。
string
body
待确认的识别文本,可能被后续事件修正。
string
body
检测到的源语言。
conversation.item.input_audio_transcription.completed
语音识别完成时发送,包含最终识别结果。需要设置 input_audio_transcription.model。
Example
string
body
事件 ID。
string
body
固定为
conversation.item.input_audio_transcription.completed。string
body
消息项 ID。
integer
body
固定为 0。
string
body
源语言的最终识别结果。
string
body
检测到的源语言。
response.audio_transcript.text
输出包含音频时,实时流式返回翻译文本。
Example
string
body
事件 ID。
string
body
固定为
response.audio_transcript.text。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
string
body
已确认的翻译片段。
string
body
追加在
text 之后的临时文本,构成部分翻译结果。服务端通过 response.audio_transcript.text 事件持续更新 text 和 stash,直到 response.audio_transcript.done 事件返回最终翻译结果(transcript 字段)。response.audio_transcript.done
音频输出的翻译文本生成完成时发送。
Example
string
body
事件 ID。
string
body
固定为
response.audio_transcript.done。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
string
body
最终翻译文本。
response.output_item.added
响应生成过程中创建新输出项时发送。
Example
string
body
事件 ID。
string
body
固定为
response.output_item.added。string
body
响应 ID。
integer
body
固定为 0。
object
body
输出项。
response.output_item.done
输出项完成时发送。
Example
string
body
事件 ID。
string
body
固定为
response.output_item.done。string
body
响应 ID。
integer
body
固定为 0。
object
body
输出项。
response.content_part.added
新的内容部分开始时发送。
Example
string
body
事件 ID。
string
body
固定为
response.content_part.added。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
object
body
内容部分。
response.content_part.done
内容部分完成时发送。
Example
string
body
事件 ID。
string
body
固定为
response.content_part.done。string
body
响应 ID。
string
body
消息项 ID。
integer
body
固定为 0。
integer
body
固定为 0。
object
body
内容部分。

