CC Switch local proxy failed while handling Codex /responses
Quick fix
Upgrade CC Switch to the latest version and start a new Codex conversation; invalid schema or image blocks left in old session history will keep triggering 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'.The Codex client mandates the Responses API (`/responses` endpoint), while third-party providers (DeepSeek, 智谱 GLM, Kimi, etc.) only support the Chat Completions format. The CC Switch local proxy has multiple conversion defects when transforming Responses requests into Chat Completions format, causing upstream to return HTTP 400. These defects involve tool schema conversion, image block mapping, context limit overflow, and message ID format. The most common cause is that the schema for the Codex built-in tool `codex_app__automation_update` uses `oneOf` at the top level but lacks `type: "object"`; CC Switch does not apply fallback completion and passes it through directly to upstream, resulting in rejection. Additionally, when sending images to non-multimodal models (such as DeepSeek, GLM), the `input_image` type is not filtered or converted, also triggering 400. Some issues have been fixed in v3.17.0 and subsequent versions, but certain scenarios (such as xAI OAuth, Kimi `$ref` validation) remain unresolved in the latest version.
Upgrade CC Switch to the latest version. v3.17.0 fixed the `codex_app__automation_update` schema `type: null` fallback issue, and subsequent versions progressively fixed image block conversion and other problems.
Start a new conversation in Codex. Old session history may retain invalid schema or `image_url` blocks; even after upgrading CC Switch, resending history will still trigger the same 400 error.
If using non-multimodal models such as DeepSeek or GLM, avoid sending images in Codex. These models do not support `image_url` or `input_image` type content blocks; sending images will inevitably cause 400.
Check the `~/.codex/config.toml` configuration to ensure `wire_api = "responses"` and `base_url` points to the CC Switch local proxy address (typically `http://127.0.0.1:15721/v1`).
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 43 real issues
- #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;
- Why does it still report errors after upgrading to the latest version?
- Old session history has already saved invalid schema or image blocks. Codex includes the full history in every request, causing upstream to continuously return 400. You must start a new conversation to resolve this.
- Sending images causes an error, but text conversation works fine. Is this a CC Switch bug?
- Some models (such as certain versions of DeepSeek, GLM) do not support multimodal input. When CC Switch forwards requests containing images without filtering image blocks for non-multimodal models, it triggers 400. Upgrading to the latest version can improve this, but the fundamental solution is to use a model that supports multimodal input.
- What does the error `Invalid schema for function 'codex_app__automation_update'` mean?
- The Codex built-in `codex_app__automation_update` tool uses a `oneOf` JSON Schema structure, missing `type: "object"` at the top level. CC Switch does not complete this field during format conversion, causing strict upstream API validation to fail. v3.17.0 fixed this issue.
- What should I do when using Kimi model and getting `tools.function.parameters is not a valid moonshot flavored json schema`?
- This is a strict schema validation rule specific to Moonshot (Kimi), requiring that `$ref` references cannot coexist with sibling keywords. This issue is not fully fixed in v3.20.0; recommend monitoring subsequent version updates.
- What causes the errors `level "max" not supported` or `max_tokens must be at least 1, got -1712`?
- The former is caused by incomplete reasoning effort level mapping in Codex Desktop for specific models (such as `gpt-5.6-sol`); the latter is a negative overflow when CC Switch calculates `max_tokens`. Both are CC Switch conversion logic defects; recommend upgrading to the latest version and monitoring related issue progress.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.