Skip to main content

端点

无状态模式兼容 OpenAI 的 Responses API。目录中的所有对话模型都可通过此端点调用,计费、配额与日志和对话补全完全一致。 这个端点存在的主要原因:新版本的 Codex CLI 只支持 Responses 协议(wire_api = "chat" 已被移除),有了它,Codex 以及其他只讲 Responses 协议的客户端就能把 VibeToken 用作模型服务商。

在 Codex 中使用 VibeToken

~/.codex/config.toml 中添加 provider:
然后导出 key,照常使用 Codex:
Codex 对自定义 provider 的默认无状态行为(每轮重发完整历史、store: false)正是此端点期望的方式——无需额外配置。

请求头

请求体

string
必填
模型 ID(仅限对话模型)。见模型总览或实时的模型 API
string | array
必填
纯字符串(视为单条 user 消息)或输入项数组。支持的项类型:message(角色为 userassistantsystemdeveloper——developer 映射为 system)、function_callfunction_call_outputreasoning(接受但跳过)。消息内容可以是字符串或类型化片段(input_textoutput_textinput_image)。
string
系统级指令,会作为 system 消息置于最前。
integer
生成 token 的上限。
number
采样温度,0–2。
number
核采样概率,0–1。
boolean
设为 true 时,响应为 response.* 事件的 Server-Sent Events 流:response.createdresponse.output_item.addedresponse.output_text.delta … → response.output_item.doneresponse.completed。函数调用项在 response.output_item.done 中完整给出。
array
扁平 Responses 格式的函数工具:{"type": "function", "name": "...", "description": "...", "parameters": {...}}。服务端工具类型(web_search 等)会被接受并静默丢弃——VibeToken 不托管它们,模型只是拿不到该工具。
string | object
"auto""none""required",或 {"type": "function", "name": "..."}

无状态设计

不支持 previous_response_id 和服务端会话存储——携带 previous_response_id 的请求会返回 400 并附带说明。请每轮发送完整的输入项历史(客户端若发送 store: false 会被接受并忽略)。这正是 Codex 对自定义 provider 的默认模式,也是大多数 Responses SDK 的常见用法。

示例

响应

当模型调用工具时,output 数组会包含 function_call 项(call_idnamearguments);请在下一次请求的 input 中以 function_call_output 项返回每个结果。

计费

对话补全完全相同:请求走同一条管线,按相同的 token 价格计量,并以相同方式出现在你的生成日志中。