Description
Bug: DeepSeek reasoning_content not passed back in multi-turn conversations
Affected provider: DeepSeek (via OpenRouter or DeepSeek API directly)
Affected models: DeepSeek V4 Pro (and any DeepSeek model with thinking mode enabled)
Description
When using a DeepSeek model with thinking mode enabled, the API requires that reasoning_content blocks returned in assistant messages are passed back as-is in subsequent turns. OpenCode currently does not preserve these blocks when building the conversation history, causing the following error on the second message:
[DeepSeek] The `reasoning_content` in the thinking mode must be passed back to the API.
Steps to Reproduce
- Configure OpenCode with DeepSeek V4 Pro via OpenRouter (
openrouter/deepseek/deepseek-v4-pro) or DeepSeek API directly
- Enable thinking mode (or use a model where it is on by default)
- Send a first message — response succeeds
- Send a second message in the same session
- Error is thrown immediately
Expected Behavior
OpenCode should preserve the reasoning_content block from assistant messages and include it verbatim when building the messages array for subsequent API calls.
Expected assistant message format in history:
{
"role": "assistant",
"content": [
{
"type": "reasoning_content",
"reasoning_content": "<content returned by the model>"
},
{
"type": "text",
"text": "<actual response>"
}
]
}
Actual Behavior
The reasoning_content block is stripped from the assistant message before the next API call, causing DeepSeek to reject the request.
Environment
- OpenCode version: v1.14.24
- OS: MacOs
- Provider: DeepSeek via OpenRouter
- Model:
deepseek/deepseek-v4-pro
References
Workaround
Disable thinking mode for DeepSeek models in OpenCode settings. This avoids the error but reduces model performance.
Terminal
No response
Description
Bug: DeepSeek
reasoning_contentnot passed back in multi-turn conversationsAffected provider: DeepSeek (via OpenRouter or DeepSeek API directly)
Affected models: DeepSeek V4 Pro (and any DeepSeek model with thinking mode enabled)
Description
When using a DeepSeek model with thinking mode enabled, the API requires that
reasoning_contentblocks returned in assistant messages are passed back as-is in subsequent turns. OpenCode currently does not preserve these blocks when building the conversation history, causing the following error on the second message:Steps to Reproduce
openrouter/deepseek/deepseek-v4-pro) or DeepSeek API directlyExpected Behavior
OpenCode should preserve the
reasoning_contentblock from assistant messages and include it verbatim when building the messages array for subsequent API calls.Expected assistant message format in history:
{ "role": "assistant", "content": [ { "type": "reasoning_content", "reasoning_content": "<content returned by the model>" }, { "type": "text", "text": "<actual response>" } ] }Actual Behavior
The
reasoning_contentblock is stripped from the assistant message before the next API call, causing DeepSeek to reject the request.Environment
deepseek/deepseek-v4-proReferences
Workaround
Disable thinking mode for DeepSeek models in OpenCode settings. This avoids the error but reduces model performance.
Terminal
No response