content[].thinking must be passed back - CC Switch
Quick fix
升级 cc-switch 到 v3.16.0 或更高版本;临时可回退 Claude Code 到 2.1.150 或关闭 thinking。
Symptom
Section titled “Symptom”API Error: 400 The `content[].thinking` in the thinking mode must be passed back to the API.当 Claude Code 通过 cc-switch 转发到 DeepSeek、Kimi/Moonshot 等 Anthropic 兼容端点时,多轮工具调用后请求会返回 400。原因是这些推理模型默认开启 thinking mode,要求历史中任何包含 tool_use 的 assistant 消息都必须同时带回 thinking block;但 Claude Code 在上下文压缩、会话切换或旧 provider 历史混入时,可能剥离、缺失或保留不兼容的 thinking/redacted_thinking/signature,导致 DeepSeek/Kimi 拒绝请求。部分用户还看到 messages[1].role must be either 'user' or 'assistant', but got 'system' 等变体,本质仍与 thinking/历史格式转换有关。该问题在 cc-switch v3.16.0 中通过对 tool-thinking 历史做归一化修复,后续版本扩展到 Kimi/Moonshot。
首选方案:升级 cc-switch 到 v3.16.0 或更高版本,建议至少 v3.16.2。维护者确认该版本已对 DeepSeek Anthropic 兼容端点的 tool-thinking 历史做归一化处理,并在后续扩展到 Kimi/Moonshot。
如果升级后仍有问题,先退出当前 Claude Code session 并开启新对话。旧会话里如果混杂了其他 provider 的 tool_use 历史,切换到 DeepSeek/Kimi 时容易触发该错误。
临时绕过方案一:在 cc-switch 的 DeepSeek provider 配置中添加 "thinking": false,关闭思考模式。该方案可避免 400,但会失去推理过程。
cc-switch provider config {"includeCoAuthoredBy": false,"thinking": false}临时绕过方案二:回退 Claude Code CLI 到 2.1.150。多名用户确认回退后不再报错。
shell 如果使用 VS Code 插件版 Claude Code,也需要回退插件版本;有用户反馈命令行正常但 VS Code 插件仍报错。
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”本页汇总自 11 个真实 issue
- #2277deepseekv4发布了,如何使用cc switch 使之适配claude code终端
- #2282cc switch接deepseek V4报“API Error: 400 {"error":{"message":"The `content[].thinking` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}”
- #2331[Bug] 临时解决方案Claude Code 与 DeepSeek V4-Flash 工具调用报错:缺少 reasoning_content 导致 400 Invalid Format
- #2401其他模型对话不兼容deepseek对话,如其他模型到额度预警,切换到deepseek,当前对话会报The content[].thinking in the thinking mode must be passed back to the API.
- #3200DeepSeek v4pro报错API400
- #3222DeepSeek V4 /anthropic 端点:tool_use 消息缺少 thinking block 导致 HTTP 400
- #3233API Error: 400 The `content[].thinking` in the thinking mode must be passed back to the API.
- #3263[Bug] DeepSeek Anthropic API thinking block round-trip 导致 400 错误 + Feature Request
- #3287API Error: 400 The content[].thinking in the thinking mode must be passed back to the API.
- #3304API Error: 400 The content[].thinking in the thinking mode must be passed back to the API.
- #3315使用claude desktop配置时调用deepseek写code时会出错
- 为什么新对话正常,旧对话切换到 DeepSeek 后就报错?
- DeepSeek V4 thinking mode 不兼容从其他 provider 切过来的旧 Claude Code 会话历史。旧历史里的 tool_use 轮次缺少 DeepSeek 要求的 thinking block,因此退出当前 session 重新开启通常可以绕过。
- 关闭 thinking 是不是最佳方案?
- 不是长期方案。关闭 "thinking": false 只是避免 API 校验错误,但会牺牲模型推理能力。优先升级 cc-switch 到 v3.16.0 或更高版本。
- 命令行 Claude Code 正常,但 VS Code 插件仍报错怎么办?
- 需要同时回退或更新 VS Code 里的 Claude Code 插件版本。有用户报告命令行恢复后,VS Code 官方插件仍会固定触发该 400 错误。
- Kimi 或 Moonshot 也会出现同样错误吗?
- 会。该问题不只影响 DeepSeek,Kimi k2 / Moonshot 的 Anthropic 兼容端点也可能因 thinking block 回传格式返回 400。cc-switch 后续已将归一化修复扩展到 Kimi/Moonshot。
- 在哪里关闭模型思考能力?
- 在 cc-switch 对应 provider 配置中加入 "thinking": false。如果页面没有直接开关,就编辑 provider JSON 配置。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。