全部产品
Search
文档中心

大模型服务平台百炼:服务端事件

更新时间:Sep 21, 2026

本文介绍千问实时语音/音视频翻译 API 的服务端事件,包括事件类型、参数和示例。

相关文档:实时语音/音视频翻译-千问。

error

服务端返回的错误信息。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为error。

errorobject

错误的详细信息。

属性

typestring

错误类型。

codestring

错误码。

messagestring

错误信息。

paramstring

与错误相关的参数,如session.modalities。

{
  "event_id": "event_RoUu4T8yExPMI37GKwaOC",
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_value",
    "message": "Invalid modalities: ['audio']. Supported combinations are: ['text'] and ['audio', 'text'].",
    "param": "session.modalities"
  }
}

session.created

客户端连接后,服务端返回的第一个事件,包含本次连接的默认配置信息。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为session.created。

sessionobject

会话的配置。

属性

idstring

会话的唯一标识符。

objectstring

固定为realtime.session。

modelstring

使用的模型。

input_modalitiesarray

适用于 qwen3.8-livetranslate-flash-realtime。输入模态,例如 ["audio"]。

output_modalitiesarray

适用于 qwen3.8-livetranslate-flash-realtime。输出模态:["text"] 或 ["text", "audio"]。

audioobject

适用于 qwen3.8-livetranslate-flash-realtime。音频输入与输出配置。

属性

input.formatobject

输入格式。type 默认值为 pcm,sample_rate 默认值为 16000(Hz)。

input.turn_detectionobject

断句配置。默认 type 为 speaker_detection,threshold 为 0.5,silence_duration_ms 为 1000。

output.formatobject

输出格式。type 默认值为 pcm,sample_rate 默认值为 24000(Hz)。

output.voicestring

输出音色,默认值为 Tina。

modalitiesarray

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

模型输出模态设置。

voicestring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

模型生成音频的音色。

input_audio_formatstring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输入音频的格式,默认为pcm。

sample_rateinteger

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输入音频的采样率,单位为Hz。

output_audio_formatstring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输出音频的格式,默认为pcm。

turn_detectionobject

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

VAD(语音活动检测)配置。

translationobject(可选)

翻译配置。

属性

languagestring(可选)

设置的翻译目标语种。

corpusobject (可选)

热词配置,用于提升特定词汇的翻译准确性。

属性

corpus.phrasesobject (可选)

热词映射表。key 为源语言词汇,value 为目标语言对应翻译,参见支持的语种 。

适用于 qwen3.8-livetranslate-flash-realtime。

{
  "event_id": "event_example",
  "type": "session.created",
  "session": {
    "id": "sess_example",
    "object": "realtime.session",
    "model": "qwen3.8-livetranslate-flash-realtime",
    "input_modalities": [
      "audio"
    ],
    "output_modalities": [
      "text",
      "audio"
    ],
    "audio": {
      "input": {
        "format": {
          "type": "pcm",
          "sample_rate": 16000
        },
        "turn_detection": {
          "type": "speaker_detection",
          "threshold": 0.5,
          "silence_duration_ms": 1000
        }
      },
      "output": {
        "format": {
          "type": "pcm",
          "sample_rate": 24000
        },
        "voice": "Tina"
      }
    },
    "translation": {
      "language": "en"
    }
  }
}

qwen3.5-livetranslate-flash-realtime 示例:

{
    "event_id": "event_QxBGpjBDmDDQQWDtrqBKB",
    "type": "session.created",
    "session": {
        "id": "sess_OozZ1vtbPt2muDflHODIH",
        "object": "realtime.session",
        "model": "qwen3.5-livetranslate-flash-realtime",
        "modalities": [
            "text",
            "audio"
        ],
        "voice": "Cherry",
        "input_audio_format": "pcm",
        "sample_rate": 16000,
        "output_audio_format": "pcm",
        "turn_detection": {
            "type": "server_vad",
            "threshold": 0.2,
            "silence_duration_ms": 1000
        },
        "translation": {
           "language": "en",
           "corpus": {
               "phrases": {
                   "人工智能": "Artificial Intelligence",
                   "机器学习": "Machine Learning"
               }
           }
        }
    }
}

session.updated

收到用户的 session.update 请求后,若处理成功,则返回此事件;若出错,则返回 error 事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为session.updated。

sessionobject

会话的配置。

属性

idstring

会话的唯一标识符。

objectstring

固定为realtime.session。

modelstring

使用的模型。

input_modalitiesarray

适用于 qwen3.8-livetranslate-flash-realtime。输入模态,例如 ["audio"]。

output_modalitiesarray

适用于 qwen3.8-livetranslate-flash-realtime。输出模态:["text"] 或 ["text", "audio"]。

audioobject

适用于 qwen3.8-livetranslate-flash-realtime。音频输入与输出配置。

属性

input.formatobject

输入格式。type 默认值为 pcm,sample_rate 默认值为 16000(Hz)。

input.turn_detectionobject

断句配置。默认 type 为 speaker_detection,threshold 为 0.5,silence_duration_ms 为 1000。

output.formatobject

输出格式。type 默认值为 pcm,sample_rate 默认值为 24000(Hz)。

output.voicestring

输出音色,默认值为 Tina。

modalitiesarray

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

模型输出模态设置。

voicestring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

模型生成音频的音色。

sample_rateinteger(可选)

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输入音频的采样率。

input_audio_formatstring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输入音频的格式,固定为pcm。

output_audio_formatstring

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输出音频的格式,固定为pcm。

input_audio_transcriptionobject

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

输入音频转录配置。仅在会话配置了input_audio_transcription.model参数时返回。

属性

modelstring

语音识别模型。

languagestring

设置的语音识别语种。

turn_detectionobject

适用于 qwen3.5-livetranslate-flash-realtime 等模型。

VAD(语音活动检测)配置。Manual 模式下(客户端在session.update中将该参数设为null)不返回此字段。

属性

typestring

VAD 类型,固定为server_vad。

thresholdfloat

VAD 检测灵敏度。

prefix_padding_msinteger

语音开始前保留的音频时长(毫秒),避免丢失语音起始部分。

silence_duration_msinteger

语音结束后需保持静音的最短时长(毫秒),超过该时长即判定语音结束。

create_responseboolean

VAD 检测到语音结束后,是否自动触发翻译响应。

interrupt_responseboolean

VAD 检测到新一轮语音开始时,是否打断当前正在生成的翻译响应。

translationobject(可选)

翻译配置。

属性

languagestring(可选)

设置的翻译目标语种。

corpusobject(可选)

热词配置,用于提升特定词汇的翻译准确性。

属性

corpus.phrasesobject(可选)

热词映射表。key 为源语言词汇,value 为目标语言对应翻译。

enable_voice_cloneboolean

是否启用声音复刻。

voice_clone_optionsobject

声音复刻控制参数,仅在enable_voice_clone为true时返回。

属性

frequencystring

音色复刻频率。

适用于 qwen3.8-livetranslate-flash-realtime。

{
  "event_id": "event_example",
  "type": "session.updated",
  "session": {
    "id": "sess_example",
    "object": "realtime.session",
    "model": "qwen3.8-livetranslate-flash-realtime",
    "input_modalities": [
      "audio"
    ],
    "output_modalities": [
      "text",
      "audio"
    ],
    "audio": {
      "input": {
        "format": {
          "type": "pcm",
          "sample_rate": 16000
        },
        "turn_detection": {
          "type": "speaker_detection",
          "threshold": 0.5,
          "silence_duration_ms": 1000
        }
      },
      "output": {
        "format": {
          "type": "pcm",
          "sample_rate": 24000
        },
        "voice": "Tina"
      }
    },
    "translation": {
      "language": "en"
    }
  }
}

qwen3.5-livetranslate-flash-realtime 示例:

{
    "event_id": "event_QxBGpjBDmDDQQWDtrqBKB",
    "type": "session.updated",
    "session": {
        "id": "sess_OozZ1vtbPt2muDflHODIH",
        "object": "realtime.session",
        "model": "qwen3.5-livetranslate-flash-realtime",
        "modalities": [
            "text",
            "audio"
        ],
        "voice": "Ethan",
        "sample_rate": 16000,
        "input_audio_format": "pcm",
        "output_audio_format": "pcm",
        "input_audio_transcription": {
            "model": "qwen3-asr-flash-realtime",
            "language": "zh"
        },
        "turn_detection": {
            "type": "server_vad",
            "threshold": 0.2,
            "prefix_padding_ms": 300,
            "silence_duration_ms": 1000,
            "create_response": true,
            "interrupt_response": true
        },
        "translation": {
           "language": "en",
           "corpus": {
               "phrases": {
                   "人工智能": "Artificial Intelligence",
                   "机器学习": "Machine Learning"
               }
           }
        },
        "enable_voice_clone": true,
        "voice_clone_options": {
            "frequency": "once"
        }
    }
}

session.finished

会话结束事件,表示当前会话中,所有音频翻译已完成。

该事件在客户端发送session.finish后才会发送,客户端接收到该事件后可主动断开连接。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为session.finished。

{
    "event_id": "event_xxx",
    "type": "session.finished"
}

response.created

当服务端生成新的模型响应时,会返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.created。

responseobject

响应对象。

属性

id string

响应的唯一标识符。

conversation_id string

当前会话的唯一标识符。

object string

对象类型,此事件下固定为realtime.response。

status string

响应状态,取值范围:

  • completed(已完成)
  • failed(失败)
  • in_progress(进行中)
  • incomplete(不完整)

modalities array

响应的模态。

voice string

模型生成音频的音色。

output_audio_formatstring

输出音频的格式。

output string

此事件下目前为空。

{
    "event_id": "event_L8hHVI5jYis6BzAjnPWJh",
    "type": "response.created",
    "response": {
        "id": "resp_P79OOMs8LnrXVpiIHUCKR",
        "object": "realtime.response",
        "conversation_id": "conv_UFClXtYkRkFXrs48y8pmK",
        "status": "in_progress",
        "modalities": [
            "text",
            "audio"
        ],
        "voice": "Cherry",
        "output_audio_format": "pcm16",
        "output": []
    }
}

response.done

响应生成完成后,服务端会返回此事件。事件中的 response 对象包含除原始音频数据外的全部输出项。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.done。

responseobject

响应对象。

属性

id string

响应的唯一标识符。

conversation_id string

当前会话的唯一标识符。

object string

对象类型,此事件下固定为realtime.response。

status string

响应的状态。

modalities array

响应的模态。

voice string

模型生成音频的音色。

output_audio_formatstring

输出音频的格式。

output object

响应的输出。

属性

id string

响应输出的唯一标识符。

type string

输出项的类型,当前固定为message。

object string

输出项的对象类型,当前固定为realtime.item。

status string

输出项的状态。

role string

输出项的角色。

content array

输出项的内容。

属性

type string

输出内容的类型。输出为纯文本时,为text;输出包含音频时,为audio。

text string

输出的文本内容。

transcript string

音频转录为文字后的内容。

usage object

本次响应的 Token 消耗信息。

{
  "event_id": "event_CNea8oXNipVanSg2VIzkO",
  "type": "response.done",
  "response": {
    "id": "resp_TfhYTqej692vsGA2jNEtH",
    "object": "realtime.response",
    "conversation_id": "conv_ZtyLfKVm8XqLwYRlsuDih",
    "status": "completed",
    "modalities": [
      "text",
      "audio"
    ],
    "voice": "Cherry",
    "output_audio_format": "pcm16",
    "output": [
      {
        "id": "item_MKtkMwN9RtcyE9eJShyWy",
        "object": "realtime.item",
        "type": "message",
        "status": "completed",
        "role": "assistant",
        "content": [
          {
            "type": "audio",
            "transcript": "Hello? "
          }
        ]
      }
    ],
    "usage": {
      "total_tokens": 56,
      "input_tokens": 47,
      "output_tokens": 9,
      "input_tokens_details": {
        "text_tokens": 20,
        "audio_tokens": 27
      },
      "output_tokens_details": {
        "text_tokens": 2,
        "audio_tokens": 7
      }
    }
  }
}

response.text.delta

适用于 qwen3.8-livetranslate-flash-realtime。 仅输出文本时,返回译文的新增文本片段。

event_idstring

事件唯一标识符。

typestring

response.text.delta。

response_idstring

响应 ID。

item_idstring

消息 ID。

output_indexinteger

输出项索引。

content_indexinteger

内容片段索引。

deltastring

本次新增的文本片段。按接收顺序累加,不覆盖已收到的文本。

{
  "event_id": "event_example",
  "type": "response.text.delta",
  "response_id": "resp_example",
  "item_id": "item_example",
  "output_index": 0,
  "content_index": 0,
  "delta": "Hello"
}

response.text.text

适用于 qwen3.5-livetranslate-flash-realtime 等模型。 使用 qwen3.8-livetranslate-flash-realtime 时,请处理 response.text.delta 事件。

当输出模态仅包含文本,且模型增量生成新的文本时,服务端将返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.text.text。

textstring

返回的增量文本。

response_idstring

回复的ID。

item_idstring

消息项ID,可以关联同一个消息项。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

stashstring

初步生成的临时文本,与当前 text 拼接后构成临时生成结果;系统会通过 response.text.text 事件持续更新 text 和 stash,直至收到response.text.done事件,此时可通过 text 字段获取完整的最终文本。

{
    "event_id": "event_B1lIeyOXR7qJMEExbqtTG",
    "type": "response.text.text",
    "response_id": "resp_B1lIdtjF4Noqpn5NOjznj",
    "item_id": "item_B1lIdJsAJlJiFs8ztWpJt",
    "output_index": 0,
    "content_index": 0,
    "text": "How are",
    "stash": " you today?"
}

response.text.done

当输出模态仅包含文本,且模型生成的文本结束时,服务端返回此事件。

当响应中断、不完整或取消时,服务端也会返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.text.done。

response_idstring

响应的唯一标识符。

item_idstring

消息项的唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

text string

模型输出的完整文本。

{
    "event_id": "event_B1lIeE2Nac33zn5V7h2mm",
    "type": "response.text.done",
    "response_id": "resp_B1lIdtjF4Noqpn5NOjznj",
    "item_id": "item_B1lIdJsAJlJiFs8ztWpJt",
    "output_index": 0,
    "content_index": 0,
    "text": "How can I assist you today?"
}

response.audio.delta

当输出模态包含音频,且模型增量生成新的音频数据时,服务端将返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.audio.delta。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

delta string

模型增量输出的音频数据,使用Base64编码。

{
    "event_id": "event_B1osWMZBtrEQbiIwW0qHQ",
    "type": "response.audio.delta",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "item_id": "item_OFaPGtzfWCPyGzxnuEX9i",
    "output_index": 0,
    "content_index": 0,
    "delta": "UklGRnoGAABXQVZFZm10IBAAAAAB..."
}

response.audio.done

当输出模态包含音频,且模型生成音频结束时,服务端返回此事件。

当响应中断、不完整或取消时,服务端也会返回此事件。

该事件不返回完整音频数据。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.audio.done。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

{
    "event_id": "event_B1osWMWoDRYyITDyNYcBu",
    "type": "response.audio.done",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "item_id": "item_OFaPGtzfWCPyGzxnuEX9i",
    "output_index": 0,
    "content_index": 0
}

input_audio_buffer.speech_started

当服务端 VAD(语音活动检测)检测到用户开始说话时,返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为input_audio_buffer.speech_started。

audio_start_msinteger

检测到语音开始的时间点(毫秒),相对于音频流开始的偏移量。

item_idstring

关联的消息项唯一标识符。

speaker_idinteger

适用于 qwen3.8-livetranslate-flash-realtime。启用 speaker_detection 时返回的说话人标识。可通过本事件的 item_id 关联语音识别结果,并通过翻译消息项的 previous_item_id 关联译文。

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

input_audio_buffer.speech_stopped

当服务端 VAD 检测到用户停止说话时,返回此事件,标志本轮语音输入结束。由于翻译响应基于流式语音同步生成,实际的翻译响应可能已经在语音输入过程中开始,无需等待此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为input_audio_buffer.speech_stopped。

audio_end_msinteger

检测到语音结束的时间点(毫秒),相对于音频流开始的偏移量。

item_idstring

关联的消息项唯一标识符。

{
    "event_id": "event_xxx",
    "type": "input_audio_buffer.speech_stopped",
    "audio_end_ms": 3900,
    "item_id": "item_xxx"
}

input_audio_buffer.committed

Manual 模式(turn_detection为null)下,客户端发送input_audio_buffer.commit事件后,服务端返回此事件进行确认,并自动开始生成翻译响应。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为input_audio_buffer.committed。

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

input_audio_buffer.cleared

客户端发送input_audio_buffer.clear事件后,服务端返回此事件进行确认,表示已清空缓冲区中尚未提交的音频数据。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为input_audio_buffer.cleared。

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

conversation.item.created

当对话中创建新的消息项时,服务端返回此事件。以下场景会触发此事件:

  • 服务端开始生成翻译响应时,创建对应的 assistant 消息项(此时content为空数组,内容随流式响应逐步填充)。
  • Manual 模式下,客户端发送input_audio_buffer.commit事件后,服务端会额外创建一个对应用户输入音频的消息项(content中包含{"type": "input_audio"})。

对于同一个 VAD 片段,服务端会分别创建语音识别结果和翻译结果消息项。语音识别结果消息项的 item.id 与翻译结果事件的 previous_item_id 相同。客户端可据此关联原文和译文,并同时展示。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为conversation.item.created。

previous_item_idstring

前一消息项的唯一标识符。对于翻译结果事件,该值与同一 VAD 片段的语音识别结果消息项 item.id 相同。

itemobject

消息项信息。

属性

idstring

消息项的唯一标识符。

typestring

固定为message。

objectstring

固定为realtime.item。

statusstring

消息项的状态。

rolestring

消息的角色,取值为assistant或user。

contentarray

消息的内容。响应刚创建时为空数组,随流式响应逐步填充;Manual 模式下 commit 产生的用户消息项中包含{"type": "input_audio"}。

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

conversation.item.input_audio_transcription.delta

适用于 qwen3.8-livetranslate-flash-realtime。 返回输入语音的原文识别增量。

event_idstring

事件唯一标识符。

typestring

conversation.item.input_audio_transcription.delta。

item_idstring

消息 ID。

content_indexinteger

内容片段索引。

deltastring

本次新增的文本片段。按接收顺序累加,不覆盖已收到的文本。

{
  "event_id": "event_example",
  "type": "conversation.item.input_audio_transcription.delta",
  "item_id": "item_example",
  "content_index": 0,
  "delta": "Hello"
}

conversation.item.input_audio_transcription.text

适用于 qwen3.5-livetranslate-flash-realtime 等模型。 使用 qwen3.8-livetranslate-flash-realtime 时,请处理 conversation.item.input_audio_transcription.delta 事件。

当配置了input_audio_transcription.model参数时,服务端会流式返回输入音频的语音识别结果(源语言原文)。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为conversation.item.input_audio_transcription.text。

item_idstring

消息项唯一标识符。

content_indexinteger

目前固定为 0。

textstring

已确认的识别文本。

stashstring

待确认的识别文本(可能会被后续事件修正)。

languagestring

检测到的源语种。

emotionstring

被识别音频的情感。支持的情感如下:

  • surprised:惊讶
  • neutral:平静
  • happy:愉快
  • sad:悲伤
  • disgusted:厌恶
  • angry:愤怒
  • fearful:恐惧
{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.text",
    "item_id": "item_xxx",
    "content_index": 0,
    "text": "",
    "stash": "今天天气真好",
    "language": "zh",
    "emotion": "neutral"
}

conversation.item.input_audio_transcription.completed

当配置了input_audio_transcription.model参数时,语音识别完成后服务端会返回此事件,包含最终的完整识别结果。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为conversation.item.input_audio_transcription.completed。

item_idstring

消息项唯一标识符。

content_indexinteger

目前固定为 0。

transcriptstring

完整的语音识别结果(源语言原文)。

languagestring

检测到的源语种。

emotionstring

被识别音频的情感。支持的情感如下:

  • surprised:惊讶
  • neutral:平静
  • happy:愉快
  • sad:悲伤
  • disgusted:厌恶
  • angry:愤怒
  • fearful:恐惧
{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.completed",
    "item_id": "item_xxx",
    "content_index": 0,
    "transcript": "今天天气真好,我们一起去公园散步吧。",
    "language": "zh",
    "emotion": ""
}

conversation.item.input_audio_transcription.failed

当输入了音频但识别失败时,服务端发送该事件。与其他error事件分开处理,便于客户端识别相关的具体项目。

typestring

事件类型,固定为conversation.item.input_audio_transcription.failed。

item_idstring

关联的对话项 ID。

content_indexinteger

包含音频的内容部分的索引。

error.codestring

错误代码。

error.messagestring

错误消息。

{
    "event_id": "event_xxx",
    "type": "conversation.item.input_audio_transcription.failed",
    "item_id": "item_xxx",
    "content_index": 0,
    "error": {
        "code": "xxx",
        "message": "xxx",
        "param": "xxx"
    }
}

response.audio_transcript.delta

适用于 qwen3.8-livetranslate-flash-realtime。输出文本和音频时,返回译文的新增文本片段。

event_idstring

事件唯一标识符。

typestring

response.audio_transcript.delta。

response_idstring

响应 ID。

item_idstring

消息 ID。

output_indexinteger

输出项索引。

content_indexinteger

内容片段索引。

deltastring

本次新增的文本片段。按接收顺序累加,不覆盖已收到的文本。

{
  "event_id": "event_example",
  "type": "response.audio_transcript.delta",
  "response_id": "resp_example",
  "item_id": "item_example",
  "output_index": 0,
  "content_index": 0,
  "delta": "Hello"
}

response.audio_transcript.text

适用于 qwen3.5-livetranslate-flash-realtime 等模型。 使用 qwen3.8-livetranslate-flash-realtime 时,请处理 response.audio_transcript.delta 事件。

当输出模态包含音频时,服务端可能返回此事件,用于展示实时翻译内容。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.audio_transcript.text。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

textstring

已确认无误的翻译文本片段。

stashstring

初步翻译的临时文本,与当前 text 拼接后构成临时翻译结果;系统会通过 response.audio_transcript.text 事件持续更新 text 和 stash,直至收到response.audio_transcript.done事件,此时可通过 transcript 字段获取完整的最终翻译文本。

{
  "event_id": "event_xxx",
  "type": "response.audio_transcript.text",
  "response_id": "resp_xxx",
  "item_id": "item_xxx",
  "output_index": 0,
  "content_index": 0,
  "text": "Hello,",
  "stash": " who are you?"
}

response.audio_transcript.done

当输出模态包含音频,且模型生成文本结束时,服务端返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.audio_transcript.done。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

transcriptstring

完整文本。

{
    "event_id": "event_VN4Q4GJugLcc1S23viW8E",
    "type": "response.audio_transcript.done",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "item_id": "item_JvJauNH2CTXb1D9WV6pD4",
    "output_index": 0,
    "content_index": 0,
    "transcript": "How can I assist you today?"
}

response.output_item.added

在响应生成过程中创建新输出项时,服务端返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.output_item.added。

response_idstring

响应的唯一标识符。

output_indexinteger

目前固定为 0。

itemobject

输出项信息。

属性

idstring

输出项的唯一标识符。

typestring

固定为 message。

objectstring

始终为 realtime.item 。

statusstring

输出项的状态。

rolestring

消息的角色。

contentstring

消息的内容。

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

response.output_item.done

当新的项输出完成时,服务端返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.output_item.done。

response_idstring

响应的唯一标识符。

output_indexinteger

目前固定为 0。

itemobject

输出项信息。

属性

idstring

输出项的唯一标识符。

objectstring

始终为 realtime.item 。

typestring

固定为 message。

statusstring

输出项的状态。

rolestring

发送消息的角色。

contentstring

消息的内容。

{
    "event_id": "event_XkiwbYTBC9Wcdwy6uYJ2G",
    "type": "response.output_item.done",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "output_index": 0,
    "item": {
        "id": "item_JvJauNH2CTXb1D9WV6pD4",
        "object": "realtime.item",
        "type": "message",
        "status": "completed",
        "role": "assistant",
        "content": [
            {
                "type": "audio",
                "text": "你好,我是阿里云研发的大规模语言模型,我叫千问。有什么我可以帮助你的吗?"
            }
        ]
    }
}

response.content_part.added

当新的内容部分输出时,服务端返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.content_part.added。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

partobject

输出项信息。

属性

typestring

内容部分的类型。

textstring

内容部分的文本。

{
    "event_id": "event_J2UixwYKZsXg7c9YXZetL",
    "type": "response.content_part.added",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "item_id": "item_OFaPGtzfWCPyGzxnuEX9i",
    "output_index": 0,
    "content_index": 0,
    "part": {
        "type": "audio",
        "text": ""
    }
}

response.content_part.done

当新的内容部分输出完成时,服务端返回此事件。

event_idstring

本次事件唯一标识符。

typestring

事件类型,固定为response.content_part.done。

response_idstring

响应的唯一标识符。

item_idstring

消息项唯一标识符。

output_indexinteger

目前固定为 0。

content_indexinteger

目前固定为 0。

partobject

输出项信息。

属性

typestring

内容部分的类型。

textstring

内容部分的文本。

{
    "event_id": "event_VN4Q4GJugLcc1S23viW8E",
    "type": "response.content_part.done",
    "response_id": "resp_P79OOMs8LnrXVpiIHUCKR",
    "item_id": "item_JvJauNH2CTXb1D9WV6pD4",
    "output_index": 0,
    "content_index": 0,
    "part": {
        "type": "audio",
        "text": "你好,我是阿里云研发的大规模语言模型,我叫千问。有什么我可以帮助你的吗?"
    }
}