OpenAI 接听 Live SIP 呼叫
接听呼叫
post /live/sessions/{session_id}/accept
接听 SIP 来电。session 须包含值为 live 的 type、模型及启动配置。接听前,按照 Live 提示词指南编写前端对话指令,并另行编写后端提示词。SIP 媒体格式通过协商确定,须省略 audio.format。
路径参数
session_id: string
创建响应或来电 webhook 中的不透明 Live 会话标识。须原样保留返回值,包括其前缀。
请求体参数
内容类型:application/json
session: object { model, type, audio, 6 more }
用于接听 SIP 来电的 Live 会话模型与启动配置。
model: string or "gpt-live-1"
接听呼叫所用的 Live 模型。
minLength: 1
string
minLength: 1
"gpt-live-1"
Live 模型。无论采用哪种传输方式,均须在会话配置中指定;不要通过 URL 查询参数传入。
"gpt-live-1"
type: "live" (default: "live")
会话类型,固定为 live。
"live"
audio: optional object { output }
启动时的音频输出配置。SIP 会协商媒体格式;audio.format 仅适用于主 WebSocket 连接。音色在启动后不能更改。
output: optional object { voice }
Live 模型生成语音的配置。须在启动会话前选择音色。
voice: optional string or "alloy" or "ash" or "ballad" or 35 more or CustomVoice
Live 语音使用的音色,可以是内置音色名称,也可以是包含 ID 的自定义音色对象。默认为 marin,启动后不能更改。
string
"alloy" or "ash" or "ballad" or 35 more
Live 语音使用的音色,可以是内置音色名称,也可以是包含 ID 的自定义音色对象。默认为 marin,启动后不能更改。
"alloy"
"ash"
"ballad"
"beacon"
"bossa"
"brise"
"calandria"
"cedar"
"cinder"
"compas"
"coral"
"delta"
"destello"
"echo"
"flitz"
"gleam"
"halo"
"harema"
"hornero"
"juni"
"luciernaga"
"marin"
"meridian"
"nira"
"noeul"
"nuri"
"pearl"
"quartz"
"ripple"
"sage"
"shida"
"shimmer"
"sillage"
"stone"
"tempo"
"verse"
"vesper"
"willow"
CustomVoice object { id }
id: string
minLength: 1, maxLength: 128
delegation: optional ClientDelegation or Responses { responses, type, acknowledgement_delay_ms } or Decisions { decisions, type, acknowledgement_delay_ms } or null
Live 模型委派任务的处理方。省略或设为 null 时,由你的应用处理;使用 responses 或 decisions,可委派给对应 API。
ClientDelegation object { type, acknowledgement_delay_ms }
将任务委派给你的应用。Live 会话发出委派事件,由你的后端处理。
type: "client" (default: "client")
委派任务的处理方。由你的应用处理时固定为 client。
"client"
acknowledgement_delay_ms: optional integer
从委派任务发出到请求自动语音确认的等待时长,单位为毫秒。模型仍可能在等待结束前发言。向会话追加任何说明(commentary)或思考(thinking)都会取消所有待处理的确认,包括其他委派任务的确认。Decisions 会话默认为 400,其他会话默认为 0,即立即请求。更新会话时省略此项会保留当前值;更新仅作用于后续委派。
minimum: 0, maximum: 800
Responses object { responses, type, acknowledgement_delay_ms }
将任务委派给由 Live 会话管理的 Responses 模型。
responses: ResponsesDelegationConfig
Live 会话将任务委派给 Responses 时所使用的后端模型、提示词和工具。
model: string
服务端管理的 Responses 委派使用的模型。
instructions: optional string or null
交给被委派的 Responses 模型的指令,与 Live 指令分开设置。参阅后端提示词。
max_output_tokens: optional integer or null
每次委派响应的最大输出词元数。
minimum: 16
parallel_tool_calls: optional boolean or null
被委派的 Responses 模型能否在单次响应中请求多个工具调用。
reasoning: optional object { effort, summary } or null
传给每次委派 Responses 请求的推理配置。
effort: optional "none" or "minimal" or "low" or 3 more or null
被委派的 Responses 模型使用的推理强度。支持的值取决于后端模型。
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
summary: optional "concise" or "detailed" or "auto" or null
向被委派的 Responses 模型请求的推理摘要类型,须模型支持。
"concise"
"detailed"
"auto"
service_tier: optional "auto" or "default" or "fast_tier_temp_pilot" or 3 more or null
委派 Responses 请求使用的服务层级。
"auto"
"default"
"fast_tier_temp_pilot"
"flex"
"priority"
"ultrafast"
text: optional object { verbosity } or null
传给每次委派 Responses 请求的文本生成配置。
verbosity: optional "low" or "medium" or "high" or null
Responses 后端生成文本的详细程度,此项不配置 Live 模型的口头表达方式。
"low"
"medium"
"high"
tool_choice: optional "auto" or "none" or "required" or Function { name, type } or Mcp { server_label, type, name } or 11 more
控制 Responses 后端在处理 Live 模型委派的任务时使用哪个工具。
LiveToolChoiceEnum = "auto" or "none" or "required"
"auto"
"none"
"required"
Function object { name, type }
name: string
要调用的函数工具名称。
type: "function" (default: "function")
要调用的工具,固定为 function。
"function"
Mcp object { server_label, type, name }
server_label: string
要调用的 MCP 服务器标签。
type: "mcp" (default: "mcp")
要调用的工具,固定为 mcp。
"mcp"
name: optional string or null
要调用的 MCP 工具名称。省略时,服务器可选择默认工具。
FileSearch object { type }
type: "file_search" (default: "file_search")
要调用的工具,固定为 file_search。
"file_search"
WebSearch object { type }
type: "web_search" (default: "web_search")
要调用的工具,固定为 web_search。
"web_search"
WebSearchPreview object { type }
type: "web_search_preview" (default: "web_search_preview")
要调用的工具,固定为 web_search_preview。
"web_search_preview"
ImageGeneration object { type }
type: "image_generation" (default: "image_generation")
要调用的工具,固定为 image_generation。
"image_generation"
Computer object { type }
type: "computer" (default: "computer")
要调用的工具,固定为 computer。
"computer"
CodeInterpreter object { type }
type: "code_interpreter" (default: "code_interpreter")
要调用的工具,固定为 code_interpreter。
"code_interpreter"
ProgrammaticToolCalling object { type }
type: "programmatic_tool_calling" (default: "programmatic_tool_calling")
要调用的工具,固定为 programmatic_tool_calling。
"programmatic_tool_calling"
Shell object { type }
需要调用工具时,强制模型调用 shell 工具。
type: "shell" (default: "shell")
要调用的工具,固定为 shell。
"shell"
Custom object { name, type }
name: string
要调用的自定义工具名称。
type: "custom" (default: "custom")
要调用的工具,固定为 custom。
"custom"
ApplyPatch object { type }
执行工具调用时,强制模型调用 apply_patch 工具。
type: "apply_patch" (default: "apply_patch")
要调用的工具,固定为 apply_patch。
"apply_patch"
LiveAllowedToolsChoiceParam object { tools, type, mode }
tools: array of Function { name, type } or Mcp { server_label, type, name } or FileSearch { type } or 9 more
被委派的 Responses 模型可以调用的工具。
minItems: 1, maxItems: 128
Function object { name, type }
name: string
要调用的函数工具名称。
type: "function" (default: "function")
要调用的工具,固定为 function。
"function"
Mcp object { server_label, type, name }
server_label: string
要调用的 MCP 服务器标签。
type: "mcp" (default: "mcp")
要调用的工具,固定为 mcp。
"mcp"
name: optional string or null
要调用的 MCP 工具名称。省略时,服务器可选择默认工具。
FileSearch object { type }
type: "file_search" (default: "file_search")
要调用的工具,固定为 file_search。
"file_search"
WebSearch object { type }
type: "web_search" (default: "web_search")
要调用的工具,固定为 web_search。
"web_search"
WebSearchPreview object { type }
type: "web_search_preview" (default: "web_search_preview")
要调用的工具,固定为 web_search_preview。
"web_search_preview"
ImageGeneration object { type }
type: "image_generation" (default: "image_generation")
要调用的工具,固定为 image_generation。
"image_generation"
Computer object { type }
type: "computer" (default: "computer")
要调用的工具,固定为 computer。
"computer"
CodeInterpreter object { type }
type: "code_interpreter" (default: "code_interpreter")
要调用的工具,固定为 code_interpreter。
"code_interpreter"
ProgrammaticToolCalling object { type }
type: "programmatic_tool_calling" (default: "programmatic_tool_calling")
要调用的工具,固定为 programmatic_tool_calling。
"programmatic_tool_calling"
Shell object { type }
需要调用工具时,强制模型调用 shell 工具。
type: "shell" (default: "shell")
要调用的工具,固定为 shell。
"shell"
Custom object { name, type }
name: string
要调用的自定义工具名称。
type: "custom" (default: "custom")
要调用的工具,固定为 custom。
"custom"
ApplyPatch object { type }
执行工具调用时,强制模型调用 apply_patch 工具。
type: "apply_patch" (default: "apply_patch")
要调用的工具,固定为 apply_patch。
"apply_patch"
type: "allowed_tools" (default: "allowed_tools")
工具选择类型,固定为 allowed_tools。
"allowed_tools"
mode: optional "none" or "auto" or "required" or null
从允许的工具集合中选择工具的方式。
"none"
"auto"
"required"
tools: optional array of FunctionTool or WebSearch { type } or FileSearch { type } or 10 more
Responses 后端处理 Live 模型委派的任务时可用的工具。
FunctionTool object { name, type, description, 2 more }
Live 模型委派任务时,Responses 后端可用的函数工具。
name: string
被委派的 Responses 模型调用此函数时使用的名称。
type: "function" (default: "function")
工具类型,固定为 function。
"function"
description: optional string or null
函数的用途,以及被委派的 Responses 模型应在何时调用它。
parameters: optional map[unknown] or null
描述函数可接受参数的 JSON Schema 对象。
strict: optional boolean or null
被委派的 Responses 模型是否必须严格遵循函数的参数模式。
WebSearch object { type }
Live 会话的 Responses 后端可用的网页搜索工具。
type: "web_search" (default: "web_search")
工具类型,固定为 web_search。
"web_search"
FileSearch object { type }
type: "file_search" (default: "file_search")
"file_search"
CodeInterpreter object { type }
type: "code_interpreter" (default: "code_interpreter")
"code_interpreter"
Shell object { type, environment }
Responses shell 工具。可使用托管容器,或通过 response.item.create 返回本地 shell 执行结果。不支持域名密钥(domain secrets)。
type: "shell" (default: "shell")
"shell"
environment: optional ContainerAuto { type, file_ids, memory_limit, 2 more } or ContainerReference { container_id, type } or Local { type, skills } or null
ContainerAuto object { type, file_ids, memory_limit, 2 more }
type: "container_auto" (default: "container_auto")
为此请求自动创建容器。
"container_auto"
file_ids: optional array of string or null
可选的已上传文件列表,这些文件将提供给代码使用。
maxItems: 50
memory_limit: optional "1g" or "4g" or "16g" or "64g" or null
容器的内存上限。
"1g"
"4g"
"16g"
"64g"
network_policy: optional Disabled { type } or Allowlist { allowed_domains, type } or null
容器的网络访问策略。
Disabled object { type }
type: "disabled" (default: "disabled")
禁用出站网络访问,固定为 disabled。
"disabled"
Allowlist object { allowed_domains, type }
allowed_domains: array of string
type 为 allowlist 时允许访问的域名列表。
minItems: 1
type: "allowlist" (default: "allowlist")
仅允许对指定域名发起出站网络访问,固定为 allowlist。
"allowlist"
skills: optional array of SkillReference { skill_id, type, version } or Inline { description, name, source, type } or null
可选的技能列表,通过 ID 或内联数据引用技能。
maxItems: 200
SkillReference object { skill_id, type, version }
skill_id: string
引用的技能 ID。
minLength: 1, maxLength: 64
type: "skill_reference" (default: "skill_reference")
引用通过 /v1/skills 接口创建的技能。
"skill_reference"
version: optional string or null
可选的技能版本。使用正整数或 'latest',省略时使用默认版本。
Inline object { description, name, source, type }
description: string
技能描述。
name: string
技能名称。
source: object { data, media_type, type }
内联技能载荷。
data: string
采用 Base64 编码的技能 ZIP 包。
minLength: 1, maxLength: 70254592
media_type: "application/zip" (default: "application/zip")
内联技能载荷的媒体类型,必须为 application/zip。
"application/zip"
type: "base64" (default: "base64")
内联技能来源的类型,必须为 base64。
"base64"
type: "inline" (default: "inline")
为此请求定义内联技能。
"inline"
ContainerReference object { container_id, type }
container_id: string
引用的容器 ID。
type: "container_reference" (default: "container_reference")
引用通过 /v1/containers 接口创建的容器。
"container_reference"
Local object { type, skills }
type: "local" (default: "local")
使用本地计算机环境。
"local"
skills: optional array of object { description, name, path } or null
可选的技能列表。
maxItems: 200
description: string
技能描述。
name: string
技能名称。
path: string
包含该技能的目录路径。
ImageGeneration object { type }
type: "image_generation" (default: "image_generation")
"image_generation"
Mcp object { type }
type: "mcp" (default: "mcp")
"mcp"
Custom object { type }
type: "custom" (default: "custom")
"custom"
Namespace object { type }
type: "namespace" (default: "namespace")
"namespace"
ToolSearch object { type }
type: "tool_search" (default: "tool_search")
"tool_search"
ProgrammaticToolCalling object { type }
type: "programmatic_tool_calling" (default: "programmatic_tool_calling")
"programmatic_tool_calling"
Computer object { type }
type: "computer" (default: "computer")
"computer"
ApplyPatch object { type }
type: "apply_patch" (default: "apply_patch")
"apply_patch"
type: "responses" (default: "responses")
委派任务的处理方。由 Responses API 处理任务时固定为 responses。
"responses"
acknowledgement_delay_ms: optional integer
从委派任务发出到请求自动语音确认的等待时长,单位为毫秒。模型仍可能在等待结束前发言。向会话追加任何说明(commentary)或思考(thinking)都会取消所有待处理的确认,包括其他委派任务的确认。Decisions 会话默认为 400,其他会话默认为 0,即立即请求。更新会话时省略此项会保留当前值;更新仅作用于后续委派。
minimum: 0, maximum: 800
Decisions object { decisions, type, acknowledgement_delay_ms }
decisions: DecisionsDelegationConfig
model: string
minLength: 1
questions: array of DecisionQuestion
按顺序一起求值的原生 Decision API 问题。
minItems: 1, maxItems: 64
Choice object { choices, instructions, type, name }
choices: array of DecisionChoiceOption
minItems: 2, maxItems: 255
value: string or boolean
string
boolean
description: optional string
instructions: string or array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
string
array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
minItems: 1
DecisionInputText object { text, type }
text: string
输入模型的文本。
maxLength: 10485760
type: "input_text" (default: "input_text")
"input_text"
InputImage object { image_url, type, detail }
image_url: string
采用 Base64 编码的图像 data URL,或可公开访问的 HTTP(S) 图像 URL。
pattern: ^(data:|https?://), maxLength: 20971520
type: "input_image" (default: "input_image")
"input_image"
detail: optional "low" or "high" or "auto" or "original" or null
发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。
"low"
"high"
"auto"
"original"
InputJSON object { data, type }
data: map[unknown] or array of map[unknown]
LiveDecisionJSONObject = map[unknown]
array of map[unknown]
type: "input_json" (default: "input_json")
"input_json"
type: "choice" (default: "choice")
"choice"
name: optional string
Predicate object { instructions, type, name }
instructions: string or array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
string
array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
minItems: 1
DecisionInputText object { text, type }
InputImage object { image_url, type, detail }
image_url: string
采用 Base64 编码的图像 data URL,或可公开访问的 HTTP(S) 图像 URL。
pattern: ^(data:|https?://), maxLength: 20971520
type: "input_image" (default: "input_image")
"input_image"
detail: optional "low" or "high" or "auto" or "original" or null
发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。
"low"
"high"
"auto"
"original"
InputJSON object { data, type }
data: map[unknown] or array of map[unknown]
LiveDecisionJSONObject = map[unknown]
array of map[unknown]
type: "input_json" (default: "input_json")
"input_json"
type: "predicate" (default: "predicate")
"predicate"
name: optional string
Score object { instructions, levels, type, name }
instructions: string or array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
string
array of DecisionInputText or InputImage { image_url, type, detail } or InputJSON { data, type }
minItems: 1
DecisionInputText object { text, type }
InputImage object { image_url, type, detail }
image_url: string
采用 Base64 编码的图像 data URL,或可公开访问的 HTTP(S) 图像 URL。
pattern: ^(data:|https?://), maxLength: 20971520
type: "input_image" (default: "input_image")
"input_image"
detail: optional "low" or "high" or "auto" or "original" or null
发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。
"low"
"high"
"auto"
"original"
InputJSON object { data, type }
data: map[unknown] or array of map[unknown]
LiveDecisionJSONObject = map[unknown]
array of map[unknown]
type: "input_json" (default: "input_json")
"input_json"
levels: array of object { label, description }
minItems: 2, maxItems: 10
label: string
description: optional string
type: "score" (default: "score")
"score"
name: optional string
type: "decisions" (default: "decisions")
"decisions"
acknowledgement_delay_ms: optional integer
从委派任务发出到请求自动语音确认的等待时长,单位为毫秒。模型仍可能在等待结束前发言。向会话追加任何说明(commentary)或思考(thinking)都会取消所有待处理的确认,包括其他委派任务的确认。默认为 400;更新仅作用于后续委派。
minimum: 0, maximum: 800
input: optional array of InitialItem
启动前提供的有序纯文本历史记录。支持 developer、user 和 assistant 消息,每条消息包含一个文本部分;最多 128 条消息,并受配置的渲染后词元数量上限约束,默认上限为 8,192。
maxItems: 128
Developer object { content, role, id, 2 more }
包含在 Live 会话初始文本历史记录中的开发者消息。
content: array of object { text, type }
消息内容。Live 初始对话历史记录中的每条消息须恰好提供一个文本部分。
minItems: 1, maxItems: 1
text: string
要包含在 Live 会话初始对话历史记录中的消息文本。
type: optional "input_text" (default: "input_text")
文本内容类型,固定为 input_text。
"input_text"
role: "developer" (default: "developer")
此历史消息的作者,固定为 developer。
"developer"
id: optional string or null
所提供历史消息的可选标识。Live 使用消息的角色和文本初始化对话。
status: optional "incomplete" or "completed" or null
所提供消息的状态。Live 将其文本作为历史记录,不会恢复未完成的消息。
"incomplete"
"completed"
type: optional "message" (default: "message")
历史记录条目的类型,固定为 message。
"message"
User object { content, role, id, 2 more }
包含在 Live 会话初始文本历史记录中的用户消息。
content: array of object { text, type }
消息内容。Live 初始对话历史记录中的每条消息须恰好提供一个文本部分。
minItems: 1, maxItems: 1
text: string
要包含在 Live 会话初始对话历史记录中的消息文本。
type: optional "input_text" (default: "input_text")
文本内容类型,固定为 input_text。
"input_text"
role: "user" (default: "user")
此历史消息的作者,固定为 user。
"user"
id: optional string or null
所提供历史消息的可选标识。Live 使用消息的角色和文本初始化对话。
status: optional "incomplete" or "completed" or null
所提供消息的状态。Live 将其文本作为历史记录,不会恢复未完成的消息。
"incomplete"
"completed"
type: optional "message" (default: "message")
历史记录条目的类型,固定为 message。
"message"
Assistant object { content, role, id, 2 more }
包含在 Live 会话初始文本历史记录中的助手消息。
content: array of Text { text, type } or OutputText { text, type }
消息内容。Live 初始对话历史记录中的每条消息须恰好提供一个文本部分。
minItems: 1, maxItems: 1
Text object { text, type }
启动 Live 会话时作为对话历史记录提供的助手文本。
text: string
要包含在 Live 会话初始对话历史记录中的消息文本。
type: optional "text" (default: "text")
文本内容类型,固定为 text。
"text"
OutputText object { text, type }
启动 Live 会话时作为对话历史记录提供的助手输出文本。
text: string
要包含在 Live 会话初始对话历史记录中的消息文本。
type: "output_text" (default: "output_text")
文本内容类型,固定为 output_text。
"output_text"
role: "assistant" (default: "assistant")
此历史消息的作者,固定为 assistant。
"assistant"
id: optional string or null
所提供历史消息的可选标识。Live 使用消息的角色和文本初始化对话。
status: optional "incomplete" or "completed" or null
所提供消息的状态。Live 将其文本作为历史记录,不会恢复未完成的消息。
"incomplete"
"completed"
type: optional "message" (default: "message")
历史记录条目的类型,固定为 message。
"message"
instructions: optional string or null
关于音色、对话、打断及何时委派任务的前端指令。先阅读 Live 提示词指南;将业务规则和工具工作流程放在单独的后端提示词中。客户端提供的指令最多 16,384 个词元。省略或提供空白指令时使用服务端默认值。启动后不能更改。
safety_identifier: optional string or null
最终用户的稳定标识,用于安全监控和滥用检测。
maxLength: 128
store: optional boolean
是否保存会话,以便之后分叉和下载录音。新会话默认为 false。
triggers: optional array of DecisionTrigger
每种转录事件类型最多配置一个 Decisions 触发器。触发器独立于任务委派运行。更新时省略 triggers 会保留当前配置,发送列表会替换配置,发送空列表会禁用触发器。
maxItems: 2
decisions: object { questions }
使用当前转录文本与会话共享的 Decision 条目进行求值的问题。
questions: array of DecisionQuestion
按顺序一起求值的原生 Decision API 问题。
minItems: 1, maxItems: 64
Choice object { choices, instructions, type, name }
Predicate object { instructions, type, name }
Score object { instructions, levels, type, name }
event_type: "session.input_transcript.delta" or "session.output_transcript.delta"
"session.input_transcript.delta"
"session.output_transcript.delta"
type: "decisions" (default: "decisions")
"decisions"
示例
## 设置 OPENAI_API_KEY,并替换会话 ID、SDP 与中继凭据;SDP 须使用实际协商内容。
curl https://api.openai.com/v1/live/sessions/$SESSION_ID/accept \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"session": {
"model": "gpt-live-1",
"type": "live"
}
}'
TRAE-AI编程


更多建议: