Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
docsneeds:complianceThis means the issue will auto-close after 2 hours.This means the issue will auto-close after 2 hours.windows
Description
Problem
When using DeepSeek V4 with thinking mode enabled in OpenCode, you may encounter this error:
The reasoning_content in the thinking mode must be passed back to the API
This happens because:
- DeepSeek V4 returns
reasoning_content(thinking process) in addition tocontent(final answer) - In multi-turn conversations with tool calls,
reasoning_contentmust be passed back to the API - The
@ai-sdk/openai-compatiblepackage doesn't preserve and pass backreasoning_content
Solution
Use DeepSeek's Anthropic-compatible API instead of the OpenAI-compatible one. The @ai-sdk/anthropic package natively supports reasoning mode (Claude extended thinking).
Configuration
Edit ~/.config/opencode/opencode.json:
"deepseekv4": {
"npm": "@ai-sdk/anthropic",
"name": "DeepSeek",
"options": {
"baseURL": "https://api.deepseek.com/anthropic",
"apiKey": "your-deepseek-api-key"
},
"models": {
"deepseek-v4-pro": {
"name": "DeepSeek-V4-Pro",
"limit": {
"context": 1048576,
"output": 262144
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
}
}
}Key Changes
- npm: Change from
@ai-sdk/openai-compatibleto@ai-sdk/anthropic - baseURL: Change from
https://api.deepseek.comtohttps://api.deepseek.com/anthropic - thinking.type: Set to
"enabled"to activate thinking mode
Why This Works
- DeepSeek provides two API formats: OpenAI-compatible and Anthropic-compatible
- The Anthropic SDK has native support for reasoning mode (used by Claude's extended thinking)
- By switching to the Anthropic API format, OpenCode can properly handle
reasoning_contentwithout code changes
Usage
After restarting OpenCode, DeepSeek V4 will work with thinking mode enabled. You'll see the reasoning process in the model's responses.
References
- Community solution article: https://svtter.cn/p/如何解决-opencode-中-deepseek-模型的-reasoning-问题/
- DeepSeek API docs: https://api-docs.deepseek.com/zh-cn/
Tested Environment
- OpenCode version: Latest (as of 2026-04-24)
- DeepSeek API: v4-pro
- OS: Windows 11
Reacted by Guankai, LieGeee and hw11
Reacted by Bjarke Elias
Metadata
Metadata
Assignees
Labels
docsneeds:complianceThis means the issue will auto-close after 2 hours.This means the issue will auto-close after 2 hours.windows
Activity
github-actions commentedon Apr 24, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
reasoning_contentsupport, please use the Bug Report template. If you're requesting a fix, use the Feature Request template (with a[FEATURE]:title prefix).Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
deepseek-v4-promodel ID is not recognized as a thinking model, causingreasoning_contenterrors even withinterleavedconfigured #24097: deepseek-v4-pro model ID not recognized as thinking model, causing reasoning_content errorsIf you believe this was flagged incorrectly, please let a maintainer know.
AutumnSun1996 commentedon Apr 24, 2026
@ai-sdk/anthropic still fails sometimes. here's a better workaround i'm using now:
using transformRequestBody to add all missing strings
LieGeee commentedon Apr 24, 2026
LieGeee commentedon Apr 24, 2026
是的这个方案更佳
LieGeee commentedon Apr 24, 2026
Closing to recreate with proper template format.
CycSpring commentedon Apr 24, 2026
在openclaw调用deepseekV4的时候,我也遇到了;openclaw.json里应该怎么改?
LieGeee commentedon Apr 24, 2026
上面有
arjunp1120 commentedon May 29, 2026
What does that mean?? where do you use that? i defined my plugin but it doesn't work; can you please clarify what you mean by this code???
LieGeee commentedon May 29, 2026
你发给ai吧,我已经开始用pi了,很久没用opencode了不记得,你有web_search吗,直接把链接发过去,没有就直接粘贴吧,应该ai可以改的
CycSpring commentedon Jun 1, 2026
哈哈,挺久前的问题了;AI几天一个样,我现在都用的codex、cc、hermes了