全部產品
Search
文件中心

Alibaba Cloud Model Studio:Qwen-Audio 即時語音對話服務端事件

更新時間:Jul 15, 2026

Qwen-Audio Realtime API 的服務端事件參考。所有服務端事件均包含 event_id(服務端自動產生)和 type(事件類型)公用欄位。

使用者指南即時語音對話(Qwen-Audio-Realtime)。如需瞭解事件互動時序,請參見WebSocket API

error

說明:請求錯誤或服務異常時返回。用戶端錯誤(invalid_request_error)不中斷串連;服務端錯誤(server_error)將終止串連。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "error",
    "error": {
        "type": "invalid_request_error",
        "code": "invalid_value",
        "message": "Cannot create response while another response is in progress.",
        "param": "response.create"
    }
}

type string

事件類型,固定為 error

error object

錯誤的詳細資料。

屬性

type string

錯誤類型,如 invalid_request_error(用戶端錯誤)或 server_error(服務端錯誤)。

code string

錯誤碼。

message string

錯誤資訊。

param string

與錯誤相關的參數。

session.created

說明:串連建立後服務端發送的首個事件,攜帶會話預設配置。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_KiKZC2zrhNsKFPZ5cTpyA",
    "type": "session.created",
    "session": {
        "object": "realtime.session",
        "model": "qwen-audio-3.0-realtime-plus",
        "modalities": ["text", "audio"],
        "voice": "longanqian",
        "input_audio_transcription": {
            "model": "fun-asr"
        },
        "turn_detection": {
            "type": "server_vad",
            "threshold": 0.5,
            "silence_duration_ms": 800
        },
        "id": "sess_A1LbG2D63WELBSawRbpq8"
    }
}

type string

事件類型,固定為 session.created

session object

會話的配置資訊。

屬性

object string

固定為 realtime.session

model string

使用的模型名稱。

modalities array

模型輸出模態設定。

voice string

模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id

input_audio_transcription object

語音轉錄的配置。

屬性

model string

語音轉錄模型,如 fun-asr

turn_detection object

輪次檢測(VAD)的配置。

id string

會話唯一識別碼。

session.updated

說明:收到 session.update 請求後,若處理成功,則返回此事件,攜帶更新後的完整會話配置;若出錯,則返回 error 事件。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_FMG6kiHbILCGiqXFPA98e",
    "type": "session.updated",
    "session": {
        "id": "sess_A1LbG2D63WELBSawRbpq8",
        "object": "realtime.session",
        "model": "pre-fun-realtime-audiochat-beta-3",
        "modalities": ["text", "audio"],
        "voice": "longanqian",
        "input_audio_transcription": {
            "model": "fun-asr"
        },
        "turn_detection": {
            "type": "smart_turn",
            "threshold": 0.1,
            "silence_duration_ms": 900
        }
    }
}

type string

事件類型,固定為 session.updated

session object

更新後的完整會話配置資訊。結構與 session.created 中的 session 對象一致。

input_audio_buffer.speech_started

說明:VAD 檢測到語音開始(server_vad / smart_turn 模式)。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.speech_started",
    "audio_start_ms": 1200,
    "item_id": "item_xxx"
}

type string

事件類型,固定為 input_audio_buffer.speech_started

audio_start_ms integer

語音開始的時間戳記(毫秒)。

item_id string

該段語音最終提交時將建立的 item 的 ID。

input_audio_buffer.speech_stopped

說明:VAD 檢測到語音結束(server_vad / smart_turn 模式)。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.speech_stopped",
    "audio_end_ms": 3400,
    "item_id": "item_xxx",
    "reason": "turn_invalid"
}

type string

事件類型,固定為 input_audio_buffer.speech_stopped

audio_end_ms integer

語音結束的時間戳記(毫秒)。

item_id string

將建立的使用者訊息項的 ID。

reason string

僅 smart_turn 模式返回此欄位。取值為 turn_invalid 時表示當前 turn 被判定為無效輪(無語義內容),不會觸發推理。有效輪次時不返回此欄位。

input_audio_buffer.committed

說明:音頻緩衝已提交為使用者訊息(push-to-talk 的 commit 或 VAD 自動認可)。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.committed",
    "previous_item_id": "item_xxx",
    "item_id": "item_xxx"
}

type string

事件類型,固定為 input_audio_buffer.committed

previous_item_id string

前一條對話項的 ID。

item_id string

建立的使用者訊息項的 ID。

input_audio_buffer.cleared

說明:音頻緩衝已清空(僅 push-to-talk 模式)。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.cleared"
}

type string

事件類型,固定為 input_audio_buffer.cleared

conversation.item.created

說明:新的對話項建立成功。使用者音頻提交、用戶端手動建立或助手響應開始時觸發。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.created",
    "previous_item_id": "item_xxx",
    "item": {
        "id": "item_xxx",
        "object": "realtime.item",
        "type": "message",
        "status": "in_progress",
        "role": "assistant",
        "content": []
    }
}

type string

事件類型,固定為 conversation.item.created

previous_item_id string

前一條對話項的 ID。

item object

建立的對話項。

屬性

id string

對話項的唯一識別碼。

object string

固定為 realtime.item

type string

對話項類型:message(普通訊息)或 function_call(函數調用)。

status string

對話項狀態,如 in_progresscompleted

role string

訊息角色,如 userassistant。僅 message 類型包含。

content array

訊息內容列表。僅 message 類型包含。

conversation.item.deleted

說明:對話項已刪除。用戶端發送 conversation.item.delete 後返回此確認事件。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.deleted",
    "item_id": "item_xxx"
}

type string

事件類型,固定為 conversation.item.deleted

item_id string

已刪除的對話項 ID。

conversation.item.retrieved

說明:查詢對話項成功返回。用戶端發送 conversation.item.retrieve 後返回此事件。音訊類型 content 僅包含轉寫文本,不返回原始音頻資料。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.retrieved",
    "item": {
        "id": "item_xxx",
        "object": "realtime.item",
        "type": "message",
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "transcript": "你好"
            }
        ]
    }
}

type string

事件類型,固定為 conversation.item.retrieved

item object

查詢到的對話項完整資訊。

屬性

id string

對話項的唯一識別碼。

object string

固定為 realtime.item

type string

對話項類型:message(普通訊息)或 function_call(函數調用)。

role string

訊息角色,如 userassistant。僅 message 類型包含。

content array

訊息內容列表。音訊類型 content 僅包含轉寫文本,不返回原始音頻資料。

conversation.item.input_audio_transcription.delta

說明:ASR 轉寫增量結果,在語音辨識過程中流式返回。包含情緒和語種檢測資訊。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.delta",
    "item_id": "item_xxx",
    "content_index": 0,
    "text": "你好",
    "stash": "世界"
}

type string

事件類型,固定為 conversation.item.input_audio_transcription.delta

item_id string

關聯的對話項 ID。

content_index integer

內容部分的索引。

text string

已確定的轉寫文本。

stash string

尚未確定的暫存文本。

conversation.item.input_audio_transcription.completed

說明:ASR 轉寫最終結果。轉寫文本會寫入對應 item 的 transcript 欄位。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.completed",
    "item_id": "item_xxx",
    "content_index": 0,
    "transcript": "你好世界"
}

type string

事件類型,固定為 conversation.item.input_audio_transcription.completed

item_id string

關聯的對話項 ID。

content_index integer

內容部分的索引。

transcript string

完整的轉寫文本。

conversation.item.input_audio_transcription.failed

說明:ASR 轉寫失敗。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.failed",
    "item_id": "item_xxx",
    "content_index": 0,
    "error": {
        "type": "transcription_error",
        "code": "transcription_failed",
        "message": "ASR transcription failed"
    }
}

type string

事件類型,固定為 conversation.item.input_audio_transcription.failed

item_id string

關聯的對話項 ID。

content_index integer

內容部分的索引。

error object

錯誤的詳細資料。

屬性

type string

錯誤類型,如 transcription_error

code string

錯誤碼,如 transcription_failed

message string

錯誤資訊。

conversation.item.ambient_audio_transcription.delta

說明僅 smart_turn 模式。環境音頻轉寫增量結果。當 VAD 檢測到語音活動但語義判定為非有效輪次(如雜訊、“嗯”、“啊”等無語義內容)時,將 ASR 識別結果以 ambient 事件透傳給用戶端。該事件不會關聯到對話上下文中的任何 item,item_id 為獨立產生的臨時 ID。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.ambient_audio_transcription.delta",
    "item_id": "item_xxx",
    "content_index": 0,
    "text": "嗯",
    "stash": ""
}

type string

事件類型,固定為 conversation.item.ambient_audio_transcription.delta

item_id string

獨立產生的臨時 ID,不關聯到對話上下文中的任何 item。

content_index integer

內容部分的索引。

text string

已確定的轉寫文本。

stash string

尚未確定的暫存文本。

conversation.item.ambient_audio_transcription.completed

說明僅 smart_turn 模式。環境音頻轉寫最終結果。與 delta 事件配對,表示一段環境音訊轉寫結束。該轉寫結果不會寫入對話上下文。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "conversation.item.ambient_audio_transcription.completed",
    "item_id": "item_xxx",
    "content_index": 0,
    "transcript": "嗯",
}

type string

事件類型,固定為 conversation.item.ambient_audio_transcription.completed

item_id string

獨立產生的臨時 ID,不關聯到對話上下文。

content_index integer

內容部分的索引。

transcript string

完整的轉寫文本。

response.created

說明:一輪模型推理開始。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.created",
    "response": {
        "id": "resp_xxx",
        "object": "realtime.response",
        "status": "in_progress",
        "modalities": ["text", "audio"],
        "voice": "longanqian",
        "output": []
    }
}

type string

事件類型,固定為 response.created

response object

響應對象。

屬性

id string

響應的唯一識別碼。

object string

固定為 realtime.response

status string

響應狀態,如 in_progress

modalities array

模型輸出模態設定。

voice string

模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id

output array

響應的輸出項列表,初始為空白數組。

response.output_item.added

說明:響應中新增一個輸出項。普通回複的輸出項類型為 message;Function Calling 的輸出項類型為 function_call

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.output_item.added",
    "response_id": "resp_xxx",
    "output_index": 0,
    "item": {
        "id": "item_xxx",
        "object": "realtime.item",
        "type": "message",
        "status": "in_progress",
        "role": "assistant",
        "content": []
    }
}

Function Call 輸出項樣本:

當輸出項為函數調用時,response.output_item.added / conversation.item.created / response.output_item.done 中的 item 結構如下:

{
    "id": "item_xxx",
    "object": "realtime.item",
    "type": "function_call",
    "status": "completed",
    "call_id": "call_xxx",
    "name": "get_weather",
    "arguments": "{\"city\":\"杭州\"}"
}
說明

一輪響應可包含多個 function_call,也可能同時包含普通 message 輸出和 function_call 輸出。Function Call 部分不會送入 TTS 播報。

type string

事件類型,固定為 response.output_item.added

response_id string

關聯的響應 ID。

output_index integer

輸出項在響應中的索引。

item object

新增的輸出項。

屬性

id string

輸出項的唯一識別碼。

object string

固定為 realtime.item

type string

輸出項類型:message(普通訊息)或 function_call(函數調用)。

status string

輸出項狀態,如 in_progress

role string

訊息角色,固定為 assistant。僅 message 類型包含。

content array

訊息內容列表。僅 message 類型包含。

response.content_part.added

說明:輸出項中新增一個內容部分。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.content_part.added",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "part": {
        "type": "audio",
        "text": ""
    }
}

type string

事件類型,固定為 response.content_part.added

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

part object

新增的內容部分。

屬性

type string

內容類型,如 audiotext

text string

常值內容,初始為空白字串。

response.text.delta

說明:純文字模式下的文本增量事件,流式返迴文本片段。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.text.delta",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "delta": "你好"
}

type string

事件類型,固定為 response.text.delta

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

delta string

文本增量片段。

response.text.done

說明:純文字模式下的文本輸出完成事件。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.text.done",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "text": "你好,有什麼可以協助你的嗎?"
}

type string

事件類型,固定為 response.text.done

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

text string

完整的文本輸出。

response.audio_transcript.delta

說明:音頻模式下的文字字幕增量事件,流式返回字幕片段。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.audio_transcript.delta",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "delta": "你好"
}

type string

事件類型,固定為 response.audio_transcript.delta

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

delta string

字幕增量片段。

response.audio_transcript.done

說明:音頻模式下的字幕輸出完成事件。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.audio_transcript.done",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "transcript": "你好,有什麼可以協助你的嗎?"
}

type string

事件類型,固定為 response.audio_transcript.done

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

transcript string

完整的字幕文本。

response.audio.delta

說明:音頻模式下的音頻資料增量事件。delta 欄位為 Base 64 編碼的 PCM 音頻資料。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.audio.delta",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "delta": "<base64 編碼的音頻資料>"
}

type string

事件類型,固定為 response.audio.delta

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

delta string

Base 64 編碼的 PCM 音頻資料片段。

response.audio.done

說明:音頻模式下的音訊輸出完成事件,不包含音頻資料。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.audio.done",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0
}

type string

事件類型,固定為 response.audio.done

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

response.content_part.done

說明:輸出項中的內容部分輸出完成。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.content_part.done",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "content_index": 0,
    "part": {
        "type": "audio",
        "text": "你好,有什麼可以協助你的嗎?"
    }
}

type string

事件類型,固定為 response.content_part.done

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

content_index integer

內容部分在輸出項中的索引。

part object

完成的內容部分。

屬性

type string

內容類型,如 audiotext

text string

常值內容或音頻字幕文本。

response.output_item.done

說明:響應中的輸出項輸出完成。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.output_item.done",
    "response_id": "resp_xxx",
    "output_index": 0,
    "item": {
        "id": "item_xxx",
        "object": "realtime.item",
        "type": "message",
        "status": "completed",
        "role": "assistant",
        "content": [
            {
                "type": "text",
                "text": "你好,有什麼可以協助你的嗎?"
            }
        ]
    }
}

type string

事件類型,固定為 response.output_item.done

response_id string

關聯的響應 ID。

output_index integer

輸出項在響應中的索引。

item object

完成的輸出項完整資訊。

屬性

id string

輸出項的唯一識別碼。

object string

固定為 realtime.item

type string

輸出項類型:message(普通訊息)或 function_call(函數調用)。

status string

輸出項狀態,如 completed

role string

訊息角色,固定為 assistant。僅 message 類型包含。

content array

訊息內容列表。僅 message 類型包含。

response.function_call_arguments.delta

說明:Function Calling 參數增量。模型決定調用工具時,服務端會先發送 response.output_item.addeditem.type=function_call)和對應的 conversation.item.created,隨後通過本事件流式輸出參數片段。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.function_call_arguments.delta",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "call_id": "call_xxx",
    "delta": "{\"city"
}

type string

事件類型,固定為 response.function_call_arguments.delta

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

call_id string

函數調用的唯一識別碼。

delta string

函數調用參數的增量片段(JSON 字串片段)。

response.function_call_arguments.done

說明:Function Calling 參數輸出完成。收到該事件後,用戶端應執行對應工具,並通過 conversation.item.create 寫入 function_call_output,隨後發送 response.create 觸發二輪推理。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_xxx",
    "type": "response.function_call_arguments.done",
    "response_id": "resp_xxx",
    "item_id": "item_xxx",
    "output_index": 0,
    "call_id": "call_xxx",
    "name": "get_weather",
    "arguments": "{\"city\":\"杭州\"}"
}

type string

事件類型,固定為 response.function_call_arguments.done

response_id string

關聯的響應 ID。

item_id string

關聯的輸出項 ID。

output_index integer

輸出項在響應中的索引。

call_id string

函數調用的唯一識別碼。

name string

調用的函數名稱。

arguments string

完整的函數調用參數(JSON 字串)。

response.done

說明:一輪推理完成。status 表示結束原因。

event_id string

本次事件唯一識別碼。

正常完成

{
    "event_id": "event_xxx",
    "type": "response.done",
    "response": {
        "id": "resp_xxx",
        "object": "realtime.response",
        "status": "completed",
        "modalities": ["text", "audio"],
        "voice": "longanqian",
        "output": [
            {
                "id": "item_xxx",
                "object": "realtime.item",
                "type": "message",
                "status": "completed",
                "role": "assistant",
                "content": [
                    {
                        "type": "audio",
                        "transcript": "你好,有什麼可以協助你的嗎?"
                    }
                ]
            }
        ]
    }
}

被打斷取消

{
    "event_id": "event_xxx",
    "type": "response.done",
    "response": {
        "id": "resp_xxx",
        "status": "cancelled",
        "status_details": {
            "type": "cancelled",
            "reason": "turn_detected"
        }
    }
}

type string

事件類型,固定為 response.done

response object

完整的響應對象。

屬性

id string

響應的唯一識別碼。

object string

固定為 realtime.response

status string

響應的結束狀態。可選值:

  • completed:正常完成。

  • cancelled:被打斷取消。status_details.reasonturn_detected(VAD 打斷)或 client_cancelled(用戶端取消)。

  • failed:LLM 或 TTS 錯誤。

status_details object

狀態詳情,僅在 cancelledfailed 時存在。

屬性

type string

狀態類型,如 cancelled

reason string

取消原因:turn_detected(VAD 打斷)或 client_cancelled(用戶端取消)。

modalities array

模型輸出模態設定。

voice string

模型產生音訊音色,為系統音色名稱或聲音複刻音色的 voice_id

output array

響應的輸出項列表,包含完整的 item 對象。

voiceprint_audio_list.in_progress

說明:聲紋註冊流程非同步進行中。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_PaEcN7CCrlhE8q4MM2yND",
    "type": "voiceprint_audio_list.in_progress",
    "item_id": "vp_Y12cA986j1KZ9O9YmAXOA"
}

type string

事件類型,固定為 voiceprint_audio_list.in_progress

item_id string

聲紋註冊任務的唯一識別碼。

voiceprint_audio_list.completed

說明:聲紋註冊流程已完成。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_PaEcN7CCrlhE8q4MM2yND",
    "type": "voiceprint_audio_list.completed",
    "item_id": "vp_Y12cA986j1KZ9O9YmAXOA"
}

type string

事件類型,固定為 voiceprint_audio_list.completed

item_id string

聲紋註冊任務的唯一識別碼。

voiceprint_audio_list.failed

說明:聲紋註冊失敗,不阻塞正常對話調用。

event_id string

本次事件唯一識別碼。

{
    "event_id": "event_PaEcN7CCrlhE8q4MM2yND",
    "type": "voiceprint_audio_list.failed",
    "item_id": "vp_Y12cA986j1KZ9O9YmAXOA",
    "reason": ""
}

type string

事件類型,固定為 voiceprint_audio_list.failed

item_id string

聲紋註冊任務的唯一識別碼。

reason string

失敗原因描述。