跳转到内容

400 content[].thinking must be passed back - Claude Code

Quick fix

升级 cc-switch 至 v3.15.0 及以上版本以修复思考块丢失问题,或降级 Claude Code 并改用 DeepSeek 原生 Anthropic 接口。

报错原文
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 报错。

  1. 升级 cc-switch 至 v3.15.0 或更高版本,维护者已在此版本修复了 reasoning_content 的格式转换问题。

  2. 若升级后仍报错,可降级 Claude Code 至 v2.1.150 或更早版本(如 v2.1.119)以绕过此问题,执行命令:npm install -g @anthropic-ai/[email protected]

  3. 对于 DeepSeek 模型,建议在 cc-switch 中直接配置使用其原生 Anthropic 兼容接口,避免使用 OpenAI 兼容接口触发不必要的格式转换。

ToolClaude Code / Codex
Versioncc-switch < 3.15.0 (affected), >= 3.15.0 (fixed)
PlatformsWindows
如何回归旧版 Claude Code 并关闭自动升级?
无需先卸载,直接通过 npm 安装指定版本即可覆盖并降级,命令为 npm install -g @anthropic-ai/[email protected]
为什么 DeepSeek 走 OpenAI 兼容接口会报错?
DeepSeek 提供了原生 Anthropic 接口,走 OpenAI 兼容接口会触发 cc-switch 的格式转换,容易在思考模式下丢失数据。建议直接使用 Anthropic 接口。

这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。