Problem
Using DeepSeek thinking models through an OpenAI-compatible Custom Inference endpoint can fail on follow-up requests because reasoning_content is not being round-tripped in conversation history.
Preview-build error observed with the OpenCode endpoint:
Response stream finished unexpectedly with internal error: POST "https://opencode.ai/zen/go/v1/chat/completions": 400 Bad Request {"message":"Error from provider (DeepSeek): The `reasoning_content` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}
Local endpoint evidence
Tested against https://opencode.ai/zen/go/v1/ without including credentials in logs or this issue.
GET /models lists DeepSeek thinking-capable models including deepseek-v4-pro and deepseek-v4-flash.
- Direct
POST /chat/completions probes against listed DeepSeek models worked.
- DeepSeek responses included
reasoning_content in assistant messages / stream deltas.
Provider docs
DeepSeek Thinking Mode docs describe that thinking-mode tool-call turns must pass reasoning_content back to the API on the next request:
https://api-docs.deepseek.com/guides/thinking_mode
Likely scope
This looks like provider conversation/history handling in the backend/provider adapter path, not a client model-list or Custom Inference modal contract issue.
The model autofill proposal can import DeepSeek model IDs correctly, but successful multi-turn use of these models likely requires preserving and replaying reasoning_content when constructing follow-up chat-completion requests for DeepSeek-compatible providers.
Acceptance criteria
- DeepSeek thinking-mode responses preserve
reasoning_content in conversation state when required by the provider.
- Follow-up requests for DeepSeek-compatible models include the required
reasoning_content fields in prior assistant messages.
- The fix is scoped so providers that do not support or require
reasoning_content are unaffected.
- Add regression coverage for a multi-turn DeepSeek-compatible response that includes
reasoning_content followed by a request that must replay it.
Related issue
Model autofill for Custom Inference endpoints is tracked separately in #11586.
Problem
Using DeepSeek thinking models through an OpenAI-compatible Custom Inference endpoint can fail on follow-up requests because
reasoning_contentis not being round-tripped in conversation history.Preview-build error observed with the OpenCode endpoint:
Local endpoint evidence
Tested against
https://opencode.ai/zen/go/v1/without including credentials in logs or this issue.GET /modelslists DeepSeek thinking-capable models includingdeepseek-v4-proanddeepseek-v4-flash.POST /chat/completionsprobes against listed DeepSeek models worked.reasoning_contentin assistant messages / stream deltas.Provider docs
DeepSeek Thinking Mode docs describe that thinking-mode tool-call turns must pass
reasoning_contentback to the API on the next request:https://api-docs.deepseek.com/guides/thinking_mode
Likely scope
This looks like provider conversation/history handling in the backend/provider adapter path, not a client model-list or Custom Inference modal contract issue.
The model autofill proposal can import DeepSeek model IDs correctly, but successful multi-turn use of these models likely requires preserving and replaying
reasoning_contentwhen constructing follow-up chat-completion requests for DeepSeek-compatible providers.Acceptance criteria
reasoning_contentin conversation state when required by the provider.reasoning_contentfields in prior assistant messages.reasoning_contentare unaffected.reasoning_contentfollowed by a request that must replay it.Related issue
Model autofill for Custom Inference endpoints is tracked separately in #11586.