HTTP 400 Codex /responses 请求失败
Quick fix
检查供应商是否支持 Codex 使用的请求格式;若支持 Responses API,可将该提供商的 apiFormat 设为 openai_responses 以避免请求转换。
Symptom
Section titled “Symptom”CC Switch local proxy failed while handling Codex endpoint /responses. Provider: OpenCode Go ox alpha; model: ox-alpha-free; upstream_status: HTTP 400; cause: Error from provider (Console Go): Upstream request failed: [1210] Invalid API parameter, please check the documentation.这些问题都表现为 Codex 的 /responses 请求收到上游 HTTP 400,但原因并不完全相同:有的与客户端或供应商对请求字段、参数的处理有关;另有案例指出,提供商配置为 openai_chat 时,CC Switch 会把 Responses 请求转换成 Chat Completions,请求转换可能产生非法 JSON。该案例中,提供商原生支持 Responses API,将 apiFormat 改为 openai_responses 后请求成功。另一个案例仅报告查看生成图片后出现供应商参数错误,没有给出已验证的修复。
确认供应商支持 Codex 当前请求所用的 API 格式。若供应商原生支持 Responses API,可将该 Codex 提供商的 apiFormat 改为 openai_responses,避免转换;该改法在一个 issue 中得到验证。
// 配置文件路径:issue 未提供// 不提供配置差异:issue 未提供具体文件路径或配置格式如果改用 openai_responses 后仍收到 HTTP 400,检查客户端和供应商的请求兼容性;现有 issue 未提供适用于所有供应商的通用修复。
Affected Versions
Section titled “Affected Versions”ToolCodex
Versioncc-switch 3.17.0 - 3.20.2(报告版本范围;未说明修复版本)
PlatformsWindowsmacOS
Source Issues
Section titled “Source Issues”本页汇总自 4 个真实 issue
- #5342codex与chatgpt合并的更新后似乎请求字段与ccswitch不匹配了
- #5653CC Switch 将 ChatGPT Powered by Codex & OWL 版本 26.715.72359 /responses 转 /chat/completions 时生成非法 JSON,导致上游 400
- #6699CC Switch local proxy failed while handling Codex endpoint /responses. Provider: OpenCode Go ox alpha; model: ox-alpha-free; upstream_status: HTTP 400; cause: Error from provider (Console Go)
- #7215ChatGPT(Codex) App无法使用非OpenAI模型
- 新开一个对话窗能解决吗?
- issue 中有用户建议尝试新对话,但报告者回复新开对话仍然有问题,因此不能视为已确认的修复。
- 为什么把 apiFormat 改成 openai_responses?
- 在一个 issue 中,提供商原生支持 /v1/responses;改为 openai_responses 后,带完整载荷的请求返回 200。
401 Unauthorized升级到 cc-switch 4.0.x;或手动清空 ~/.codex/auth.json 中残留的第三方 OPENAI_API_KEY 后重启 Codex,重新走 ChatGPT OAuth 登录。Invalid schema for function — Codex将 CC Switch 升级至包含 v3.18.0 修复的版本可解决 `parameters.type:null` 变体;其他 `null` schema 变体仍需跟踪原帖。ChatGPT无法认证, 全局代理已经开了 - Codex升级 cc-switch 到 v3.16.4+,并在「设置 → 路由 → 全局出站代理」填入可用代理地址后重试 Codex/ChatGPT 认证。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。