Skip to content

Custom inference DeepSeek thinking models need reasoning_content round-trip #11587

Description

@thesammykins

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.

Metadata

Metadata

Assignees

Labels

area:agentAgent workflows, conversations, prompts, cloud mode, and AI-specific UI.bugSomething isn't working.repro:mediumThe report suggests a plausible repro path, but some uncertainty remains.triagedIssue has received an initial automated triage pass.warp:auto-triage-review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions