CC Switch local proxy failed while handling Codex /responses
Quick fix
升级 CC Switch 到最新版并重开 Codex 对话;旧会话历史中残留的非法 schema 或图片块会持续触发 400。
Symptom
Section titled “Symptom”CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.Codex 客户端强制使用 Responses API(`/responses` 端点),而第三方供应商(DeepSeek、智谱 GLM、Kimi 等)仅支持 Chat Completions 格式。CC Switch 本地代理在将 Responses 请求转换为 Chat Completions 格式时存在多个转换缺陷,导致上游返回 HTTP 400。这些缺陷涉及工具 schema 转换、图片块映射、上下文超限及消息 ID 格式等多个方面。最常见的原因是 Codex 内置工具 `codex_app__automation_update` 的 schema 顶层使用了 `oneOf` 但缺少 `type: "object"`,CC Switch 未做兜底补全,直接透传给上游导致被拒。此外,发送图片给非多模态模型(如 DeepSeek、GLM)时,`input_image` 类型未被过滤或转换,同样触发 400。部分问题在 v3.17.0 及后续版本中已修复,但仍有部分场景(如 xAI OAuth、Kimi `$ref` 校验)在最新版中未完全解决。
升级 CC Switch 到最新版本。v3.17.0 修复了 `codex_app__automation_update` 的 schema `type: null` 兜底问题,后续版本逐步修复了图片块转换等问题。
在 Codex 中新开一个对话。旧会话的历史记录中可能已残留非法的 schema 或 `image_url` 块,即使升级 CC Switch 后,重发历史仍会触发同样的 400 错误。
如果使用的是 DeepSeek、GLM 等非多模态模型,避免在 Codex 中发送图片。这些模型不支持 `image_url` 或 `input_image` 类型的 content 块,发送图片必然导致 400。
检查 `~/.codex/config.toml` 配置,确保 `wire_api = "responses"` 且 `base_url` 指向 CC Switch 本地代理地址(通常为 `http://127.0.0.1:15721/v1`)。
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”本页汇总自 43 个真实 issue
- #3532「3.6.1」Codex 接入第三方 API 开启路由之后的未知错误,无法调用 Native Tool
- #3540codex使用deepseek发送图片出现报错
- #3561[codex][mimo]小米 mimo 调用错误
- #3575Codex接入Deepseek 显示 local proxy failed while handling Codex endpoint. failed to deserialize the JSON body into the target
- #3741Image problem
- #3770本地路由跟自动故障转移的疑惑
- #3837建议增加 strip_assistant_prefill 整流器
- #3890CC Switch Bug Report: image_url 不受支持导致 Codex + deepseek-v4-pro 崩溃
- #4007使用 CC Switch 将 Codex 切换到 DeepSeek V4 后出现 PDF 上传失败与历史对话丢失问题
- #4107在codex中,使用CCswitch切换国内模型(使用本地路由),重启后,如果发送的内容中含有图片,则报错
- #4173[Bug] Codex 走 Responses API 时图片未转换,第三方 provider(智谱等)报 content.type 非法
- #4360HTTP 400; cause: Invalid schema for function 'list_mcp_resources': null is not of type
- #4554[Bug] Zhipu GLM provider returns HTTP 400 on Codex /responses endpoint — messages.content.type
- #4714Codex /responses endpoint: max_tokens calculated as negative number (e.g. -213, -1712)
- #4792CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Zhipu GLM5.2; model: glm-5.2; upstream_status: HTTP 400; cause: messages.content.type 参数非法,取值范围 ['text']
- #4961deepseek-v4-pro 返回 400:工具 schema 中 type: null 不兼容
- #4973v3.16.5 regression: `invalid tool_call_id` (HTTP 400) when routing Codex → SenseNova on `deepseek-v4-flash`
- #4992Codex: codex_app__automation_update tool schema breaks DeepSeek routing (HTTP 400)
- #5001[Bug] Codex `/responses` 工具调用 arguments 在客户端解析失败时,CC Switch 错误信息不报告真正的根本原因
- #5101[Bug] 使用自建推理服务(GLM-5.2)发送图片时,因模型不支持多模态导致代理报错
- #5110Codex + OpenCode Go 2 上下文超限(HTTP 400):truncation_policy.limit 与 context_window 不匹配,且代理不触发自动压缩
- #5113CC Switch local proxy failed while handling Codex endpoint /responses
- #5192[Codex] DeepSeek 400 错误:codex_app__automation_update 工具 schema 中 type 为 null
- #5209Codex Desktop gpt-5.6-sol uses ultra reasoning effort, but cc-switch Codex /responses path only models up to xhigh/max
- #5263Codex /responses 端点代理到 DeepSeek 时报 schema 错误
- #5264codex通过ccswitch连接deepseek老出问题
- #5300[Codex] function codex_app__automation_update with parameters: null causes DeepSeek HTTP 400 — "Invalid schema for function"
- #5332codex使用cc Switch接入deepseek报错
- #5349Bug: `type: null` in tool schema causes HTTP 400 on Codex Responses→Chat transform (DeepSeek and other strict-schema providers)
- #5490Codex Chat 路由下 function tool 偶发 HTTP 400:function/parameters 缺失导致 schema 无效
- #5714[Bug] `apiFormat=openai_chat` 在 claude 应用下把请求错误地路由到 codex 应用 (Ollama Cloud / 本地 Ollama 不可用)
- #5730[Bug] Codex old tasks fail on native /responses because converted message IDs use resp_*_msg instead of msg_*
- #5774Bug: MiMo model doesn't support json_schema format, breaks Codex auto-approval
- #6151CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Zhipu GLM; model: glm-5.2; upstream_status: HTTP 400; cause: messages.content.type 参数非法,取值范围 ['text']
- #6218[Codex] 代理路由请求体超上游体积上限时自动瘦身图片(修复百炼 6MB BadRequest.TooLarge 会话卡死)
- #6260[Bug] 本地代理把流式返回的"空 thinking"写入 Codex 会话历史,下次请求回传时上游 400「thinking 长度不足」
- #6614[Bug] Codex 经本地代理接 Kimi:工具 schema 的 $ref 带同级关键字被 Moonshot 400 拒绝(附已验证修复)
- #6629Codex /responses 接口代理失败:CC Switch 转换后生成非法 response item id
- #6697[Bug] Codex 纯图片 tool 输出在无视觉能力的上游被整条丢弃 → 孤儿 tool_calls 导致会话永久 400
- #6795[Bug][Codex][xAI OAuth] Native Responses disables tool_search and sends 744 flattened tools, exceeding xAI's 350-tool limit
- #6815[Bug] v3.20.0 xAI (Grok) OAuth + Codex: mcp__codex_app__automation_update 仍被拒绝 (root oneOf/anyOf with non-object branch)
- #6836Zhipu GLM5.3不支持视觉,但是CC生成的配置里标记为了支持视觉
- #6861CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Kimi For Coding; model: kimi-for-coding; upstream_status: HTTP 400;
- 升级到最新版后为什么还是报错?
- 旧会话的历史记录中已经保存了非法的 schema 或图片块,Codex 每次请求都会带上完整历史,导致上游持续返回 400。必须新开一个对话才能解决。
- 发送图片就报错,但文字对话正常,是 CC Switch 的 bug 吗?
- 部分模型(如 DeepSeek、GLM 的某些版本)本身不支持多模态输入。CC Switch 在转发含图片的请求时,如果没有对非多模态模型过滤图片块,就会触发 400。升级到最新版可改善此问题,但最根本的解决方式是使用支持多模态的模型。
- 报错提示 `Invalid schema for function 'codex_app__automation_update'` 是什么意思?
- Codex 内置的 `codex_app__automation_update` 工具使用了 `oneOf` 结构的 JSON Schema,顶层缺少 `type: "object"`。CC Switch 在转换格式时未补全该字段,导致上游 API 严格校验失败。v3.17.0 已修复此问题。
- 使用 Kimi 模型时报 `tools.function.parameters is not a valid moonshot flavored json schema` 怎么办?
- 这是 Moonshot(Kimi)特有的严格 schema 校验规则,要求 `$ref` 引用不能与同级关键字并存。该问题在 v3.20.0 中仍未完全修复,建议关注后续版本更新。
- 报错 `level "max" not supported` 或 `max_tokens must be at least 1, got -1712` 是什么原因?
- 前者是 Codex Desktop 对特定模型(如 `gpt-5.6-sol`)的 reasoning effort 级别映射不完整导致;后者是 CC Switch 在计算 `max_tokens` 时出现负数溢出。两者均为 CC Switch 的转换逻辑缺陷,建议升级到最新版并关注相关 issue 进展。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。