400 content[].thinking must be passed back - Claude Code
Quick fix
升级 cc-switch 至 v3.15.0 及以上版本以修复思考块丢失问题,或降级 Claude Code 并改用 DeepSeek 原生 Anthropic 接口。
Symptom
Section titled “Symptom”API Error: 400 The `content[].thinking` in the thinking mode must be passed back to the API.Claude Code 和 Codex 在开启 extended thinking 时,要求上一轮的 thinking 或 reasoning_content 块必须在下一轮请求中原样传回。cc-switch 在旧版本(v3.15.0 之前)的协议转换层中,未能正确保留或传递这些思考块,导致上游 API 拒绝请求并返回 400 错误。此外,不同模型(如 Kimi)对 thinking 参数的格式要求不同,也会引发类似的 400 报错。
升级 cc-switch 至 v3.15.0 或更高版本,维护者已在此版本修复了 reasoning_content 的格式转换问题。
若升级后仍报错,可降级 Claude Code 至 v2.1.150 或更早版本(如 v2.1.119)以绕过此问题,执行命令:npm install -g @anthropic-ai/[email protected]
对于 DeepSeek 模型,建议在 cc-switch 中直接配置使用其原生 Anthropic 兼容接口,避免使用 OpenAI 兼容接口触发不必要的格式转换。
Affected Versions
Section titled “Affected Versions”ToolClaude Code / Codex
Versioncc-switch < 3.15.0 (affected), >= 3.15.0 (fixed)
PlatformsWindows
Source Issues
Section titled “Source Issues”本页汇总自 4 个真实 issue
- #2769无法正常使用代理
- #3261DeepSeek V4 + Claude Code thinking mode 400 错误修复方案
- #4452使用codex配置kimi模型报错
- #6592CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: The `reasoning_content` in the thinking mode must be passed back to the API.
- 如何回归旧版 Claude Code 并关闭自动升级?
- 无需先卸载,直接通过 npm 安装指定版本即可覆盖并降级,命令为 npm install -g @anthropic-ai/[email protected]。
- 为什么 DeepSeek 走 OpenAI 兼容接口会报错?
- DeepSeek 提供了原生 Anthropic 接口,走 OpenAI 兼容接口会触发 cc-switch 的格式转换,容易在思考模式下丢失数据。建议直接使用 Anthropic 接口。
正文内容频繁出现在 thinking(思考)块内,visible text 块几乎为空升级 cc-switch 至包含 PR #4210 的版本,将预注入 thinking 占位符改为反应式处理即可解决长上下文会话冻结与正文折叠问题。API Error: 400 Param Incorrect Claude Code升级 CC Switch 到 v3.16.2 或更新版本,修复 MiMo thinking mode 下 reasoning_content 未回传导致的 400 错误。Invalid schema for function升级 cc-switch 至 v3.18.0+,修复 Codex 工具参数缺失 type: object 导致的上游 400 报错。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。