Problem Description
When using DeepSeek models (such as deepseek-v4-flash) directly in Claude Code with extended thinking enabled, multi-turn conversations trigger a 400 error:
| |
Root Cause Analysis
Call Chain
| |
Protocol Incompatibility
According to the DeepSeek Anthropic API Compatibility Documentation, the compatibility status is as follows:
| Message Field | Support Status |
|---|---|
content[].thinking | ✅ Supported |
content[].redacted_thinking | ❌ Not Supported |
In extended thinking mode during multi-turn conversations, Claude Code faithfully passes back all thinking blocks from the previous round (including redacted_thinking types) to the API as-is. DeepSeek does not recognize redacted_thinking, hence the 400 error.
Additionally, DeepSeek’s thinking block format differs from Anthropic’s native protocol, and the replay logic in tool_use scenarios is not fully compatible either.
Core Conflict
- Anthropic API requirement: In extended thinking mode,
content[].thinkingandcontent[].redacted_thinkingmust be passed back unchanged - DeepSeek compatibility layer: Only supports
thinking, does not supportredacted_thinking - Claude Code behavior: Hard-coded according to Anthropic protocol, does not distinguish between target endpoint types
Community Feedback
This is a widespread community issue that almost all CC agent/router projects have encountered:
| Issue | Project | Title |
|---|---|---|
| #1 | cc-use | DeepSeek Thinking Mode Error: content[].thinking Must Be Passed Back |
| #878 | openclaude | DeepSeek V4: reasoning_content must be passed back (400) on tool_calls |
| #1355 | claude-code-router | CCR 代理 deepseek V4 思考时返回 400 |
| #4543 | new-api | ClaudeCode 接入 DeepSeek V4 遇到 400 reasoning_content 报错 |
| #355 | 9router | DeepSeek API Error 400 – Missing reasoning_content |
| #16748 | hermes-agent | DeepSeek /anthropic: stripped thinking blocks cause HTTP 400 on replay |
| #2414 | cc-switch | Claude 使用 cc-switch 配置 deepseek-v4-pro,无法识别字段 |
| #174 | cc-haha | /compact 命令在使用 DeepSeek API 时无法工作 |
DeepSeek Official Response
Zero response. Nor is there any need to respond.
- First, DeepSeek has no public API issue repository. All feedback occurs in third-party projects without any DeepSeek official personnel participating in any discussions.
- Second, whether to use Anthropic as a compatibility standard, I think DeepSeek should be hesitant.
Temporary Workarounds
- Disable extended thinking — When using DeepSeek in CC, turn off thinking mode
- Use proxy filtering — Add a proxy layer between CC and DeepSeek to filter out
redacted_thinkingblocks - Switch models — Use DeepSeek for non-thinking scenarios and Anthropic native models for thinking scenarios
Why Doesn’t OpenCode Have This Problem?
OpenCode (opencode-ai/opencode) naturally avoids this problem architecturally, not through a dedicated “fix”.
The key lies in the convertMessages method in internal/llm/provider/anthropic.go (lines 60-119):
- When building assistant messages, it only passes back
TextContent(text) andToolCall(tool calls) - Completely ignores
ReasoningContent(thinking content), not putting it in messages - thinking content is only displayed in the UI through stream
thinking_deltaevents and is not passed back to the API
Comparison with Claude Code’s behavior:
| Claude Code | OpenCode | |
|---|---|---|
| thinking replay | ✅ Faithfully replay all thinking blocks (including redacted_thinking) | ❌ Do not replay thinking blocks |
| architectural reason | Follow Anthropic API specification, requires unchanged replay | Self-managed conversation state, thinking only for UI display |
| DeepSeek compatibility | ❌ Triggers 400 (redacted_thinking not recognized) | ✅ Not affected (doesn’t pass thinking at all) |
Conclusion: OpenCode avoids the problem at the cost of not following Anthropic’s extended thinking specification. This approach is friendly to third-party compatible endpoints like DeepSeek, but if Anthropic native thinking context retention capability is needed in the future, re-implementation may be necessary.
Does Not Replay Thinking Blocks Affect DeepSeek Performance?
Basically no, reasons:
- thinking blocks are the model’s internal scratchpad, not final output. The text replies and tool calls in the conversation history already retain key decisions and conclusions
- DeepSeek’s reasoning is closer to OpenAI’s mode — each round is generated independently, unlike Anthropic’s strong reliance on cross-round replay to maintain reasoning coherence
- OpenCode’s extensive actual use also confirms this — community users run multi-turn conversations using DeepSeek thinking mode in OpenCode without feedback about reasoning quality degradation
The truly potentially affected extreme scenario: in ultra-long multi-turn tasks, the model may repeat conclusions it has already reasoned through. However, in most actual use, the impact is negligible.
Related Claude Code Native Issues
CC itself has similar thinking block replay bugs on Anthropic models (not DeepSeek-specific):
