Qwen-Audio Realtime API 的服務端事件參考。所有服務端事件均包含 event_id (服務端自動產生)和 type (事件類型)公用欄位。
使用者指南:即時語音對話(Qwen-Audio-Realtime)。如需瞭解事件互動時序,請參見WebSocket API。
說明:請求錯誤或服務異常時返回。用戶端錯誤(
說明:串連建立後服務端發送的首個事件,攜帶會話預設配置。
說明:收到
說明:VAD 檢測到語音開始(server_vad / smart_turn 模式)。
說明:VAD 檢測到語音結束(server_vad / smart_turn 模式)。
說明:音頻緩衝已提交為使用者訊息(push-to-talk 的 commit 或 VAD 自動認可)。
說明:音頻緩衝已清空(僅 push-to-talk 模式)。
說明:新的對話項建立成功。使用者音頻提交、用戶端手動建立或助手響應開始時觸發。
說明:對話項已刪除。用戶端發送
說明:查詢對話項成功返回。用戶端發送
說明:ASR 轉寫增量結果,在語音辨識過程中流式返回。包含情緒和語種檢測資訊。
說明:ASR 轉寫最終結果。轉寫文本會寫入對應 item 的
說明:ASR 轉寫失敗。
說明:僅 smart_turn 模式。環境音頻轉寫增量結果。當 VAD 檢測到語音活動但語義判定為非有效輪次(如雜訊、“嗯”、“啊”等無語義內容)時,將 ASR 識別結果以 ambient 事件透傳給用戶端。該事件不會關聯到對話上下文中的任何 item,
說明:僅 smart_turn 模式。環境音頻轉寫最終結果。與 delta 事件配對,表示一段環境音訊轉寫結束。該轉寫結果不會寫入對話上下文。
說明:一輪模型推理開始。
說明:響應中新增一個輸出項。普通回複的輸出項類型為
說明:輸出項中新增一個內容部分。
說明:純文字模式下的文本增量事件,流式返迴文本片段。
說明:純文字模式下的文本輸出完成事件。
說明:音頻模式下的文字字幕增量事件,流式返回字幕片段。
說明:音頻模式下的字幕輸出完成事件。
說明:音頻模式下的音頻資料增量事件。
說明:音頻模式下的音訊輸出完成事件,不包含音頻資料。
說明:輸出項中的內容部分輸出完成。
說明:響應中的輸出項輸出完成。
說明:Function Calling 參數增量。模型決定調用工具時,服務端會先發送
說明:Function Calling 參數輸出完成。收到該事件後,用戶端應執行對應工具,並通過
說明:一輪推理完成。
說明:聲紋註冊流程非同步進行中。
說明:聲紋註冊流程已完成。
說明:聲紋註冊失敗,不阻塞正常對話調用。
error
說明:請求錯誤或服務異常時返回。用戶端錯誤(invalid_request_error)不中斷串連;服務端錯誤(server_error)將終止串連。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 error。errorobject錯誤的詳細資料。
屬性 type string錯誤類型,如 invalid_request_error(用戶端錯誤)或 server_error(服務端錯誤)。codestring錯誤碼。messagestring錯誤資訊。paramstring與錯誤相關的參數。 |
session.created
說明:串連建立後服務端發送的首個事件,攜帶會話預設配置。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 session.created。sessionobject會話的配置資訊。
屬性 object string固定為 realtime.session。modelstring使用的模型名稱。modalitiesarray模型輸出模態設定。voicestring模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id。input_audio_transcriptionobject語音轉錄的配置。
屬性 model string語音轉錄模型,如 fun-asr。object輪次檢測(VAD)的配置。idstring會話唯一識別碼。 |
session.updated
說明:收到 session.update 請求後,若處理成功,則返回此事件,攜帶更新後的完整會話配置;若出錯,則返回 error 事件。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 session.updated。sessionobject更新後的完整會話配置資訊。結構與 session.created 中的 session 對象一致。 |
input_audio_buffer.speech_started
說明:VAD 檢測到語音開始(server_vad / smart_turn 模式)。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 input_audio_buffer.speech_started。audio_start_msinteger語音開始的時間戳記(毫秒)。item_idstring該段語音最終提交時將建立的 item 的 ID。 |
input_audio_buffer.speech_stopped
說明:VAD 檢測到語音結束(server_vad / smart_turn 模式)。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 input_audio_buffer.speech_stopped。audio_end_msinteger語音結束的時間戳記(毫秒)。item_idstring將建立的使用者訊息項的 ID。reasonstring僅 smart_turn 模式返回此欄位。取值為 turn_invalid 時表示當前 turn 被判定為無效輪(無語義內容),不會觸發推理。有效輪次時不返回此欄位。 |
input_audio_buffer.committed
說明:音頻緩衝已提交為使用者訊息(push-to-talk 的 commit 或 VAD 自動認可)。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 input_audio_buffer.committed。previous_item_idstring前一條對話項的 ID。item_idstring建立的使用者訊息項的 ID。 |
input_audio_buffer.cleared
說明:音頻緩衝已清空(僅 push-to-talk 模式)。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 input_audio_buffer.cleared。 |
conversation.item.created
說明:新的對話項建立成功。使用者音頻提交、用戶端手動建立或助手響應開始時觸發。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.created。previous_item_idstring前一條對話項的 ID。itemobject建立的對話項。
屬性 id string對話項的唯一識別碼。objectstring固定為 realtime.item。typestring對話項類型:message(普通訊息)或 function_call(函數調用)。statusstring對話項狀態,如 in_progress、completed。rolestring訊息角色,如 user、assistant。僅 message 類型包含。contentarray訊息內容列表。僅 message 類型包含。 |
conversation.item.deleted
說明:對話項已刪除。用戶端發送 conversation.item.delete 後返回此確認事件。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.deleted。item_idstring已刪除的對話項 ID。 |
conversation.item.retrieved
說明:查詢對話項成功返回。用戶端發送 conversation.item.retrieve 後返回此事件。音訊類型 content 僅包含轉寫文本,不返回原始音頻資料。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.retrieved。itemobject查詢到的對話項完整資訊。
屬性 id string對話項的唯一識別碼。objectstring固定為 realtime.item。typestring對話項類型:message(普通訊息)或 function_call(函數調用)。rolestring訊息角色,如 user、assistant。僅 message 類型包含。contentarray訊息內容列表。音訊類型 content 僅包含轉寫文本,不返回原始音頻資料。 |
conversation.item.input_audio_transcription.delta
說明:ASR 轉寫增量結果,在語音辨識過程中流式返回。包含情緒和語種檢測資訊。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.input_audio_transcription.delta。item_idstring關聯的對話項 ID。content_indexinteger內容部分的索引。textstring已確定的轉寫文本。stashstring尚未確定的暫存文本。 |
conversation.item.input_audio_transcription.completed
說明:ASR 轉寫最終結果。轉寫文本會寫入對應 item 的 transcript 欄位。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.input_audio_transcription.completed。item_idstring關聯的對話項 ID。content_indexinteger內容部分的索引。transcriptstring完整的轉寫文本。 |
conversation.item.input_audio_transcription.failed
說明:ASR 轉寫失敗。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.input_audio_transcription.failed。item_idstring關聯的對話項 ID。content_indexinteger內容部分的索引。errorobject錯誤的詳細資料。
屬性 type string錯誤類型,如 transcription_error。codestring錯誤碼,如 transcription_failed。messagestring錯誤資訊。 |
conversation.item.ambient_audio_transcription.delta
說明:僅 smart_turn 模式。環境音頻轉寫增量結果。當 VAD 檢測到語音活動但語義判定為非有效輪次(如雜訊、“嗯”、“啊”等無語義內容)時,將 ASR 識別結果以 ambient 事件透傳給用戶端。該事件不會關聯到對話上下文中的任何 item,item_id 為獨立產生的臨時 ID。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.ambient_audio_transcription.delta。item_idstring獨立產生的臨時 ID,不關聯到對話上下文中的任何 item。content_indexinteger內容部分的索引。textstring已確定的轉寫文本。stashstring尚未確定的暫存文本。 |
conversation.item.ambient_audio_transcription.completed
說明:僅 smart_turn 模式。環境音頻轉寫最終結果。與 delta 事件配對,表示一段環境音訊轉寫結束。該轉寫結果不會寫入對話上下文。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 conversation.item.ambient_audio_transcription.completed。item_idstring獨立產生的臨時 ID,不關聯到對話上下文。content_indexinteger內容部分的索引。transcriptstring完整的轉寫文本。 |
response.created
說明:一輪模型推理開始。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.created。responseobject響應對象。
屬性 id string響應的唯一識別碼。objectstring固定為 realtime.response。statusstring響應狀態,如 in_progress。modalitiesarray模型輸出模態設定。voicestring模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id。outputarray響應的輸出項列表,初始為空白數組。 |
response.output_item.added
說明:響應中新增一個輸出項。普通回複的輸出項類型為 message;Function Calling 的輸出項類型為 function_call。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.output_item.added。response_idstring關聯的響應 ID。output_indexinteger輸出項在響應中的索引。itemobject新增的輸出項。
屬性 id string輸出項的唯一識別碼。objectstring固定為 realtime.item。typestring輸出項類型:message(普通訊息)或 function_call(函數調用)。statusstring輸出項狀態,如 in_progress。rolestring訊息角色,固定為 assistant。僅 message 類型包含。contentarray訊息內容列表。僅 message 類型包含。 | response.output_item.added / conversation.item.created / response.output_item.done 中的 item 結構如下:一輪響應可包含多個 function_call,也可能同時包含普通 message 輸出和 function_call 輸出。Function Call 部分不會送入 TTS 播報。 |
response.content_part.added
說明:輸出項中新增一個內容部分。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.content_part.added。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。partobject新增的內容部分。
屬性 type string內容類型,如 audio、text。textstring常值內容,初始為空白字串。 |
response.text.delta
說明:純文字模式下的文本增量事件,流式返迴文本片段。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.text.delta。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。deltastring文本增量片段。 |
response.text.done
說明:純文字模式下的文本輸出完成事件。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.text.done。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。textstring完整的文本輸出。 |
response.audio_transcript.delta
說明:音頻模式下的文字字幕增量事件,流式返回字幕片段。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.audio_transcript.delta。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。deltastring字幕增量片段。 |
response.audio_transcript.done
說明:音頻模式下的字幕輸出完成事件。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.audio_transcript.done。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。transcriptstring完整的字幕文本。 |
response.audio.delta
說明:音頻模式下的音頻資料增量事件。delta 欄位為 Base 64 編碼的 PCM 音頻資料。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.audio.delta。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。deltastringBase 64 編碼的 PCM 音頻資料片段。 |
response.audio.done
說明:音頻模式下的音訊輸出完成事件,不包含音頻資料。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.audio.done。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。 |
response.content_part.done
說明:輸出項中的內容部分輸出完成。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.content_part.done。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。content_indexinteger內容部分在輸出項中的索引。partobject完成的內容部分。
屬性 type string內容類型,如 audio、text。textstring常值內容或音頻字幕文本。 |
response.output_item.done
說明:響應中的輸出項輸出完成。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.output_item.done。response_idstring關聯的響應 ID。output_indexinteger輸出項在響應中的索引。itemobject完成的輸出項完整資訊。
屬性 id string輸出項的唯一識別碼。objectstring固定為 realtime.item。typestring輸出項類型:message(普通訊息)或 function_call(函數調用)。statusstring輸出項狀態,如 completed。rolestring訊息角色,固定為 assistant。僅 message 類型包含。contentarray訊息內容列表。僅 message 類型包含。 |
response.function_call_arguments.delta
說明:Function Calling 參數增量。模型決定調用工具時,服務端會先發送 response.output_item.added(item.type=function_call)和對應的 conversation.item.created,隨後通過本事件流式輸出參數片段。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.function_call_arguments.delta。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。call_idstring函數調用的唯一識別碼。deltastring函數調用參數的增量片段(JSON 字串片段)。 |
response.function_call_arguments.done
說明:Function Calling 參數輸出完成。收到該事件後,用戶端應執行對應工具,並通過 conversation.item.create 寫入 function_call_output,隨後發送 response.create 觸發二輪推理。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.function_call_arguments.done。response_idstring關聯的響應 ID。item_idstring關聯的輸出項 ID。output_indexinteger輸出項在響應中的索引。call_idstring函數調用的唯一識別碼。namestring調用的函數名稱。argumentsstring完整的函數調用參數(JSON 字串)。 |
response.done
說明:一輪推理完成。status 表示結束原因。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 response.done。responseobject完整的響應對象。
屬性 id string響應的唯一識別碼。objectstring固定為 realtime.response。statusstring響應的結束狀態。可選值:
object狀態詳情,僅在 cancelled 或 failed 時存在。
屬性 type string狀態類型,如 cancelled。reasonstring取消原因:turn_detected(VAD 打斷)或 client_cancelled(用戶端取消)。array模型輸出模態設定。voicestring模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id。outputarray響應的輸出項列表,包含完整的 item 對象。usageobject本次響應的 Token 消耗資訊。僅在 status 為 completed 時返回。
屬性 total_tokens integer本次響應消耗的總 Token 數。input_tokensinteger輸入 Token 數。output_tokensinteger輸出 Token 數。input_tokens_detailsobject輸入 Token 的分項詳情,包含 text_tokens(文本 Token 數)和 audio_tokens(音頻 Token 數,僅在使用音頻模態時存在)。output_tokens_detailsobject輸出 Token 的分項詳情,包含 text_tokens(文本 Token 數)和 audio_tokens(音頻 Token 數,僅在使用音頻模態時存在)。pluginsobject(可選)外掛程式使用計量資訊。啟用連網搜尋(enable_search)時返回。
屬性 search object連網搜尋計量資訊。
屬性 count integer搜尋次數。strategystring搜尋策略。 |
voiceprint_audio_list.in_progress
說明:聲紋註冊流程非同步進行中。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 voiceprint_audio_list.in_progress。item_idstring聲紋註冊任務的唯一識別碼。 |
voiceprint_audio_list.completed
說明:聲紋註冊流程已完成。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 voiceprint_audio_list.completed。item_idstring聲紋註冊任務的唯一識別碼。 |
voiceprint_audio_list.failed
說明:聲紋註冊失敗,不阻塞正常對話調用。
event_idstring本次事件唯一識別碼。typestring事件類型,固定為 voiceprint_audio_list.failed。item_idstring聲紋註冊任務的唯一識別碼。reasonstring失敗原因描述。 |