Description
When using DeepSeek models (e.g. deepseek-v4-pro, deepseek-v4-flash) with thinking mode enabled, the API requires that reasoning_content from assistant messages that contained tool calls be included in all subsequent requests. If it's omitted, the API returns a 400 error.
From DeepSeek's docs:
▎ "For turns that do perform tool calls, the reasoning_content must be fully passed back to the API in all subsequent requests. If your code does not ▎ correctly pass back reasoning_content, the API will return a 400 error."
Reproduction:
- Configure OpenCode to use a DeepSeek model with thinking mode enabled 2. Ask a question that triggers a tool call (e.g. weather lookup, date check, file read)
- The first turn works, but subsequent turns fail with a 400 error
Root cause:
When serializing assistant messages into the conversation context, OpenCode likely drops reasoning_content from the message object. For non-tool-call
turns DeepSeek ignores missing reasoning_content, but for tool call turns it's mandatory.
Expected behavior:
reasoning_content must be preserved in assistant messages that contain tool_calls when sending the conversation history to DeepSeek's API.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Description
When using DeepSeek models (e.g. deepseek-v4-pro, deepseek-v4-flash) with thinking mode enabled, the API requires that reasoning_content from assistant messages that contained tool calls be included in all subsequent requests. If it's omitted, the API returns a 400 error.
From DeepSeek's docs:
▎ "For turns that do perform tool calls, the reasoning_content must be fully passed back to the API in all subsequent requests. If your code does not ▎ correctly pass back reasoning_content, the API will return a 400 error."
Reproduction:
Root cause:
When serializing assistant messages into the conversation context, OpenCode likely drops reasoning_content from the message object. For non-tool-call
turns DeepSeek ignores missing reasoning_content, but for tool call turns it's mandatory.
Expected behavior:
reasoning_content must be preserved in assistant messages that contain tool_calls when sending the conversation history to DeepSeek's API.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response