Responses
OpenAI 的 Responses 格式,适用于 OpenAI 模型。Codex 和 OpenAI SDK 较新的调用方式用的就是它。请求会原样传给模型。
POST https://api.exoticrouter.com/v1/responses
curl https://api.exoticrouter.com/v1/responses \ -H "Authorization: Bearer $EXOTIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-6.2-astra", "input": "Why is the sky blue?" }'response = client.responses.create( model="openai/gpt-6.2-astra", input="Why is the sky blue?",)print(response.output_text)const response = await client.responses.create({ model: "openai/gpt-6.2-astra", input: "Why is the sky blue?",});console.log(response.output_text);示例使用 OpenAI SDK,Base URL 设为 https://api.exoticrouter.com/v1,设置方法见 OpenAI SDK。
哪些内容会被转发
Section titled “哪些内容会被转发”- 必须有
model。所有文本模型都支持这个接口:OpenAI 模型原样接收请求,其他模型(anthropic/claude-sonnet-5-5、Gemini 或 DeepSeek 模型等)由网关把请求转换成 Chat Completions,再以这种格式返回。 - 对 OpenAI 模型,请求体的其余部分会原样传给模型:
instructions、tools、reasoning、text等。 - 请求头里,
openai-beta会被转发,还有content-type和accept。其他请求头(比如组织或项目相关的)不会转发。
返回的是 OpenAI 的 response 对象,其中的 model 是模型的完整 ID。usage 是模型自己的统计;计费用的输入 token 数是网关自己的计数,可能与它不同。
设置 "stream": true 后,回答以这种格式自己的命名事件返回,从 response.created 到 response.completed。
stream = client.responses.create( model="openai/gpt-6.2-astra", input="Write a haiku about glass.", stream=True,)for event in stream: if event.type == "response.output_text.delta": print(event.delta, end="", flush=True)const stream = await client.responses.create({ model: "openai/gpt-6.2-astra", input: "Write a haiku about glass.", stream: true,});for await (const event of stream) { if (event.type === "response.output_text.delta") process.stdout.write(event.delta);}- 模型没有输出时,网关每 15 秒发送一行注释
: keep-alive。 - 如果模型在流开始之后出错,流会以一个名为
error的事件结束,内容是一个错误对象。
自己保存对话
Section titled “自己保存对话”这里只提供创建 response 的接口。已存储的 response 无法获取、取消或删除,所以不要依赖 store 或 previous_response_id:每次请求都把到目前为止的对话一起发送。
- Codex:使用这种格式的编程智能体。
- Chat Completions:所有文本模型都支持的格式。