schema must be a JSON Schema of 'type: "object"', got 'type: null' - Codex 接 DeepSeek
Quick fix
这是 CC Switch 旧版本的转换缺陷,升级到 v3.18.0 或更高版本即可修复;无需手动修改 config.toml。
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 内置工具(如用于定时任务和电脑操控的 codex_app__automation_update)在 Responses API 中声明的 parameters 字段为 JSON null。当 CC Switch 把请求从 Responses 格式转换为 DeepSeek 等严格校验的 Chat Completions 上游时,未对空 schema 做兜底处理,导致上游直接返回 HTTP 400。该问题在 v3.17.0 中仍未修复(相关代码路径 transform_codex_chat.rs 未对显式 null 做处理),直到 v3.18.0 才通过 PR #4706 和 #5315 合并修复,代理现在会自动将工具 parameters 归一为 {"type":"object"}。另外,部分用户遇到上游上下文超限(如 exceeds the available context size)或模型名拼写错误(如 deepseek-v4-falsh)也会导致 HTTP 400,但这些与 schema 校验是不同的触发条件。
将 CC Switch 升级到 v3.18.0 或更高版本(从 https://github.com/farion1231/cc-switch/releases/latest 下载)
无需手动修改 config.toml;如果之前手动改过,可在 CC Switch 界面中将 DeepSeek 供应商的 Upstream Format 切换为 Responses (native) 并关闭路由按钮
重启 Codex 客户端,验证定时任务、插件调用等功能是否恢复正常
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”本页汇总自 16 个真实 issue
- #3777Qwen3.6 256K上下文问题
- #3921Codex配置了deepseek-v4-pro后无法识别图片
- #4615claude-desktop 代理将子代理(Agent/Subagent)的已解析模型名拒返回 400
- #4793schema must be a JSON Schema of 'type: "object"', got 'type: null'.
- #4803设置定时任务,调用tool出现: model: deepseek-v4-pro; 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'.
- #4839codex 通过 cc 转发到deepseek的 创建定时任务提示词 报错
- #5009codex接入deepseek messages.tool_call_id 报错问题一直没有解决
- #5048[Bug] DeepSeek 返回 400: function schema 缺少 type: "object"
- #5340有报错
- #5354CC switch Codex使用deepseek fail。
- #5384接入deepseek,所有插件无法使用
- #5426codex 接入deepseek, 还是400报错
- #5528[@chrome](plugin://chrome@openai-bundled) 打开Product Hunt 首页,找出今天最热门的3个新发布产品,总结它们各自的特点,并附上对应的访问链接。出错
- #5576在openai中使用电脑操控插件无法正常使用(使用deepsdseeek接入)
- #5959Deepseek v4 flash正式版发布后 兼容性问题
- #7127使用gpt work时自动化任务cc-switch转发给deepseek时的bug
- 为什么我 Upstream Format 设置的 Responses (native) 关闭路由按钮后 Codex 反而用不了?
- Responses 原生支持是 v3.18.0 引入的,但如果你之前已经手动配置了路由,关闭后可能导致请求未经过本地代理转换而直接失败。建议升级后使用默认的 Responses 模式,或重新开启路由让 CC Switch 处理格式转换。
- 升级后还需要手动改 config.toml 吗?
- 不需要。v3.18.0 已内置对 DeepSeek 等严格上游的兼容处理,直接在界面切换供应商即可正常使用,无需手动编辑配置文件。
- Windows 和 macOS 都支持这个修复吗?
- 是的,已有 Windows 和 macOS 用户确认 v3.18.0 修复后切换为 Responses 模式可以正常使用。
- 上下文超过 256K 后报错 HTTP 400 也是这个问题吗?
- 不是。那是上下文长度超出模型窗口限制(如 Qwen3.6 或 DeepSeek 的 256K 上限),需要在 CC Switch 模型表中确认上下文窗口已正确填写,或使用自动压缩功能,与 schema 校验错误是不同的根因。
- 为什么 DeepSeek 无法识别图片?
- DeepSeek 的 deepseek-v4-pro 模型本身不是多模态模型,不支持图片输入,这与 CC Switch 无关,需要更换为多模态模型或等待 DeepSeek 官方支持。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。