OpenAI 兼容接口怎么选:/v1/chat/completions、/v1/responses 与 /v1/messages 的区别

GrooRoute Pro 登记了三个协议端点:POST /v1/chat/completions、POST /v1/responses 和 POST /v1/messages。三个端点共用同一个账户和同一把平台 API Key,鉴权请求头都是 Authorization: Bearer <API Key>。不同客户端和 SDK 调用的接口路径、base_url 填法与请求体字段不同;具体模型支持哪几个接口由其供给声明决定,见下文。

三个协议端点对比

接口路径协议客户端填的地址请求体与返回字段常见客户端
POST /v1/chat/completionsOpenAI 兼容(Chat Completions)https://grooroute.com/v1输入放 messages 数组,返回文本读 choices[0].message.contentOpenAI 官方 SDK(chat.completions.create)、OpenCode(@ai-sdk/openai-compatible)及大多数 OpenAI 兼容客户端
POST /v1/responsesOpenAI Responseshttps://grooroute.com/v1输入放 input,SDK 读返回文本用 output_textOpenAI 官方 SDK(responses.create)、Codex CLI(wire_api = "responses")、OpenCode(@ai-sdk/openai)
POST /v1/messagesAnthropic 兼容https://grooroute.com客户端自己补 /v1/messages会自己补 /v1/messages 的 Anthropic 兼容客户端

端点登记不代表每个模型、每个档位都已开放这种协议:发送请求前,请在接入文档页选择你的 Key 和模型,确认它支持的协议。

/v1/chat/completions 与 /v1/responses 请求体对比

下面 /v1/chat/completions 的示例用 deepseek-v4.1-flash,/v1/responses 的示例用 gpt-5.6-luna,各是清单里第一个声明了对应协议的模型,可以换成模型页列出的其他模型 ID。

Chat Completions:POST /v1/chat/completions

对话历史放在 messages 数组里,每条消息带 role 和 content:

curl https://grooroute.com/v1/chat/completions \
  -H "Authorization: Bearer $GROOROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Hello"}]}'

Responses:POST /v1/responses

输入放在 input 字段里:

curl https://grooroute.com/v1/responses \
  -H "Authorization: Bearer $GROOROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-luna","input":"Hello"}'

各客户端怎么选协议

各模型声明支持的接口

下表是平台已发布、并且当前有供给的模型,以及各自的供给声明支持的接口。接口一列合并了公开可用档位的声明,以接入文档页为准:

模型 ID支持的接口
deepseek-v4.1-flashPOST /v1/chat/completions
gpt-5.6-lunaPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-5.6-solPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-5.6-terraPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-6-astraPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-6-lunaPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-6-solPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gpt-6.1-solPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
grok-4.7POST /v1/chat/completions、POST /v1/responses
gpt-image-1.5未声明
gpt-image-2未声明
gpt-image-2.5-flare未声明
gpt-image-2.5-sunburst未声明
claude-opus-5-5POST /v1/chat/completions、POST /v1/messages
claude-sonnet-5-5POST /v1/chat/completions、POST /v1/messages
gemini-3.8-flashPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses
gemini-4-argonPOST /v1/chat/completions、POST /v1/messages、POST /v1/responses

想知道你手里的 Key 能用哪些模型,可以带上这把 Key 调用 GET /v1/models,或在接入文档页选择 Key 和模型查看生成的配置。价格见模型页,计费规则见计费说明。

常见问题

/v1/chat/completions 和 /v1/responses 的请求体有什么区别?

/v1/chat/completions 的输入放在 messages 数组里,返回文本在 choices[0].message.content;/v1/responses 的输入放在 input 里,SDK 读取返回文本用 output_text。

第三方网关一般支持哪个接口?

GrooRoute Pro 同时登记了 POST /v1/chat/completions、POST /v1/responses 和 POST /v1/messages 三个协议端点。具体某个模型在你的 Key 所在档位开放了哪几个,以接入文档页按 Key 和模型生成的配置为准。

Codex CLI 和 OpenCode 分别走哪个接口?

Codex CLI 在 config.toml 里写 wire_api = "responses",只调用 POST /v1/responses;OpenCode 按 opencode.json 里的 npm 包决定,@ai-sdk/openai-compatible 走 chat completions,@ai-sdk/openai 走 Responses。

三个接口的 base_url 填法一样吗?

只补 /chat/completions 或 /responses 的客户端填带 /v1 的地址;按 Anthropic 协议调用、自己补 /v1/messages 的客户端填不带 /v1 的根地址,避免路径变成 /v1/v1/messages。

最后更新:

相关教程

注册 GrooRoute Pro 账户 · 接入文档 · 模型与价格 · 条款与隐私