外观
OpenAI Responses
Responses API 是 Codex 和新型 Agent 工作流的主要协议。它与 Chat Completions 的请求结构不同,不能只把请求路径替换成 /responses。
端点
http
POST /v1/responses
POST /v1/responses/compact1
2
2
Base URL 应保留 /v1:
text
https://agent-team-api.myrimate.cn/v11
非流式请求
bash
curl https://agent-team-api.myrimate.cn/v1/responses \
-H "Authorization: Bearer $AGENT_TEAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "检查下面函数可能出现的并发问题",
"stream": false
}'1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
流式请求
bash
curl -N https://agent-team-api.myrimate.cn/v1/responses \
-H "Authorization: Bearer $AGENT_TEAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "为一个 Go HTTP 服务设计健康检查",
"stream": true
}'1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
服务通过 SSE 返回事件。客户端应按事件类型解析,不要把每一行都当作完整 JSON 响应。
Codex Key 的方案
用于 Codex 的 Key 应选择 codex-subscription,并使用 Responses 协议。Chat Completions 请求不会自动转换成 Responses 请求。
Compaction
POST /v1/responses/compact 用于受支持客户端的上下文压缩流程。只有客户端确实实现了 Responses compaction 协议时才调用它,不要将其作为普通摘要接口使用。
常见错误
| 现象 | 优先检查 |
|---|---|
Invalid URL (POST /responses) | Base URL 缺少 /v1,或客户端没有自动拼接版本路径 |
No available channel | 检查该模型在当前使用方案下是否支持 Responses 协议 |
401 | Key 未发送、Header 格式错误或 Key 已失效 |
| 流式中途断开 | 检查客户端、网络和服务状态,并记录 request id |
