You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DeepSeek V4: reasoning_content 400 error persists on v1.14.31 — complete fix exists in unmerged PRs #25311
When using DeepSeek V4 Pro or Flash models with thinking mode enabled (default), multi-turn conversations fail with:
The `reasoning_content` in the thinking mode must be passed back to the API.
This happens reliably on v1.14.31 (latest release) in conversations with multiple tool-call turns, regardless of whether the conversation is fresh or resumed from history.
Why the existing fixes are insufficient
The release notes mention:
v1.14.24: "Fixed DeepSeek assistant messages so reasoning is always included"
v1.14.29: "DeepSeek OpenAI-compatible setups now keep reasoning_content interleaved by default"
These handle some code paths but not all. The fundamental issue is that reasoning_content must be present on every assistant message in the conversation history — historical messages from DB replay, string-content messages, and messages processed on the second interleaved pass all need it. The current code has gaps.
The fix exists — three separate PRs wrote it
Three contributors have submitted PRs with the complete fix:
Provider: @ai-sdk/openai-compatible via LLM Gateway (pinned to DeepSeek API)
Model: deepseek-v4-pro with reasoning: true and interleaved: { field: "reasoning_content" }
Also reproduced with direct DeepSeek API (bypassing gateway)
Request
Please review and merge one of the existing complete fixes (#24250, #24895) so that DeepSeek V4 with thinking mode works reliably in multi-turn conversations.
There are also many closed issues tracking this same error (e.g. #24261, #24442, #24190, #24803). The maintainers are likely already tracking this bug — please check the above issues and consider adding a +1 or relevant details there rather than opening a new report.
Edit: Ignore the below. My opencode was out of date. Seems to be working fine in the actual up to date version.
I can confirm the first one you linked fixes it: #24250
I had OpenCode pull the main dev branch and asked it apply the linked fix. Then I re-built, and it's working perfectly for me now. You'll just have to build it, took less than 20 seconds for me.
The bug affects any OpenAI-compatible provider that returns but doesn't accept it as input — not just DeepSeek
(an undocumented field) does nothing — it's a silent no-op
The interleaved transform is internal to the SDK pipeline, not configurable via
Our temporary workaround is to disable reasoning (), but that significantly degrades model quality for complex tasks (~20-30% drop for architecture/design, ~5% for simple tasks).
We believe a merge of any one of the three PRs — particularly #24250 which is the most comprehensive (3-layer fix covering auto-enable interleaved, dynamic SDK key, and unconditional reasoning injection for all assistant messages) — would resolve this for Cerebras GLM-4.7 and all other affected providers.
Could you review one of these? Happy to provide additional testing or reproductions.
The bug affects any OpenAI-compatible provider that returns reasoning_content but doesn't accept it as input - not just DeepSeek
implementsReasoning: false (an undocumented field) does nothing - it's a silent no-op
The interleaved transform is internal to the SDK pipeline, not configurable via .opencode/opencode.json
Our temporary workaround is to disable reasoning (reasoning_effort: none), but that significantly degrades model quality for complex tasks (~20-30% drop for architecture/design, ~5% for simple tasks).
We believe a merge of any one of the three PRs - particularly #24250 which is the most comprehensive (3-layer fix covering auto-enable interleaved, dynamic SDK key, and unconditional reasoning injection for all assistant messages) - would resolve this for Cerebras GLM-4.7 and all other affected providers.
Could you review one of these? Happy to provide additional testing or reproductions.
Activity
github-actions commentedon May 1, 2026
This issue might be a duplicate of existing issues. Please check:
reasoning_contentin the thinking mode must be passed back to the API. #24920: DeepSeek V4 flash/pro reasoning_content error after conversation interruption (open)There are also many closed issues tracking this same error (e.g. #24261, #24442, #24190, #24803). The maintainers are likely already tracking this bug — please check the above issues and consider adding a
+1or relevant details there rather than opening a new report.chrispository commentedon May 1, 2026
Edit: Ignore the below. My opencode was out of date. Seems to be working fine in the actual up to date version.
I can confirm the first one you linked fixes it: #24250
I had OpenCode pull the main dev branch and asked it apply the linked fix. Then I re-built, and it's working perfectly for me now. You'll just have to build it, took less than 20 seconds for me.
https://github.com/chrispository/opencode_deepseek_fix
tom-knight-ai commentedon May 4, 2026
Comment from optinosis team: Cerebras GLM-4.7 also affected
We hit this exact bug with the Cerebras Z.AI GLM-4.7 model on OpenCode v1.14.33. Our internal issue: https://github.com/optinosis/optinosis/issues/2229
We confirmed that:
Our temporary workaround is to disable reasoning (), but that significantly degrades model quality for complex tasks (~20-30% drop for architecture/design, ~5% for simple tasks).
We believe a merge of any one of the three PRs — particularly #24250 which is the most comprehensive (3-layer fix covering auto-enable interleaved, dynamic SDK key, and unconditional reasoning injection for all assistant messages) — would resolve this for Cerebras GLM-4.7 and all other affected providers.
Could you review one of these? Happy to provide additional testing or reproductions.
tom-knight-ai commentedon May 4, 2026
Comment from optinosis team: Cerebras GLM-4.7 also affected
We hit this exact bug with the Cerebras Z.AI GLM-4.7 model on OpenCode v1.14.33. Our internal issue: https://github.com/optinosis/optinosis/issues/2229
We confirmed that:
reasoning_contentbut doesn't accept it as input - not just DeepSeekimplementsReasoning: false(an undocumented field) does nothing - it's a silent no-op.opencode/opencode.jsonOur temporary workaround is to disable reasoning (
reasoning_effort: none), but that significantly degrades model quality for complex tasks (~20-30% drop for architecture/design, ~5% for simple tasks).We believe a merge of any one of the three PRs - particularly #24250 which is the most comprehensive (3-layer fix covering auto-enable interleaved, dynamic SDK key, and unconditional reasoning injection for all assistant messages) - would resolve this for Cerebras GLM-4.7 and all other affected providers.
Could you review one of these? Happy to provide additional testing or reproductions.
github-actions commentedon Jul 5, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.