端点
POST /v1/responses
OpenAI Responses API 兼容端点。GPT 系列原生支持;以本端点调用其它文本模型(Gemini、豆包、Claude、DeepSeek、Qwen、GLM、MiniMax、Kimi、Grok)时,网关自动把 Responses 请求转成上游支持的格式再发出,客户侧收到的仍是标准 Responses 结构(含流式 event: response.*)。Claude 推荐 创建消息 /v1/messages;Gemini 也可使用 Gemini 原生格式(/v1beta/models/{model}:generateContent)。各协议的完整对照见 协议支持的模型。
Codex CLI / Codex Desktop 只能讲 Responses 协议,文本模型都可以在这些工具里使用。gpt-6-sol、gpt-6.1-sol 带 tools 时推荐直接用本端点。非流式请求超过约 30 秒可能被网络边缘断开,长任务请用 stream: true。
多轮对话用 previous_response_id 续接时,可配合请求头 X-CA-Session-ID 让同一会话固定在同一条线路上,见 会话亲和。
请求
请求头
| 请求头 | 取值 | 说明 |
|---|---|---|
Authorization | Bearer sk-xxxxxx | 鉴权。本端点不接受 `x-api-key`(只带它会返回 401) |
content-type | application/json |
最小请求体:
{
"model": "gpt-5.6-sol",
"input": "用一句话介绍 云上创造"
}参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 文本模型 ID |
input | string 或数组 | 是 | 输入内容 |
stream | boolean | 否 | 设为 true 时以 SSE 流式返回 |
reasoning.effort | string | 否 | 推理力度,如 low;none / minimal 对不支持的模型自动改为 low(见 创建对话补全 的「参数自动适配」) |
tools | array | 否 | 工具列表,支持 {"type": "web_search"} 与 {"type": "function", ...} |
max_output_tokens | integer | 否 | 最大输出 token 数;gpt-6 系推理模型建议 ≥ 4096(过小时部分线路会 400,网关自动放大重试一次);低于线路最小值时自动抬高 |
temperature | number | 否 | 采样温度,0 到 2;默认 1。推理模型不接受时网关自动去掉重发,见 创建对话补全 的「参数自动适配」 |
top_p | number | 否 | 核采样阈值,0 到 1;默认 1。推理模型不接受时网关自动去掉重发,见 创建对话补全 的「参数自动适配」 |
service_tier | string | 否 | 本站暂不支持快速模式,该字段会被忽略 |
其余字段按 OpenAI Responses API 格式透传。
响应
object 为 response,生成结果在 output 数组里,按输出项类型区分:
| 输出项 type | 说明 |
|---|---|
message | 模型回复,文本在 content[].text(content[].type 为 output_text) |
function_call | 模型请求调用函数,name 与 arguments 为调用参数 |
web_search_call | 模型执行了 Web 搜索 |
reasoning | 推理摘要项 |
status 为 completed 表示生成完成;usage 含 input_tokens、output_tokens、total_tokens 及各自的 _details。响应里的 model(流式时 response.model)是你请求时填的模型 ID,原样返回。上游返回空流(没有任何 response.* 事件)且你还没收到任何字节时,网关会自动换一条线路重试一次,仍为空返回 502 empty_response(见 错误码)。
stream 为 true 时返回 Responses API 标准事件流:response.created → response.in_progress → response.output_item.added → response.content_part.added → 多个 response.output_text.delta → response.output_text.done → … → response.completed,以 response.completed 结束。部分线路的流中还会夹带 codex.rate_limits、codex.response.metadata、responsesapi.websocket_timing 这类附加事件,客户侧可忽略;这些事件不是每条线路都会出现。
示例
本页示例为海外模型,地址用国外通道 https://acapi.top;换成国内通道 https://api.acapi.top 同样可用,两个地址均可用,见 调用地址。
基础请求
curl https://acapi.top/v1/responses \
-H "Authorization: Bearer sk-xxxxxx" \
-H "content-type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "用一句话介绍 云上创造"
}'Python SDK
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://acapi.top/v1",
)
resp = client.responses.create(
model="gpt-5.6-sol",
input="用一句话介绍 云上创造",
)
print(resp.output_text)流式请求
请求体加 "stream": true,其余不变。
错误
| HTTP 状态 | error.type / error.code | 触发条件 |
|---|---|---|
| 401 | new_api_error(code 为空) | 鉴权失败,详见 鉴权 |
| 400 | invalid_request_error | 参数错误,message 里会说明具体字段 |
| 503 | model_not_found | 模型 ID 不存在或暂不可用 |