Skip to content

400 error: reasoning_content must be passed back for DeepSeek-family models on direct OpenAI-compatible endpoints #815

Description

@Timmy6942025

Problem

Multi-turn sessions against DeepSeek-family models served by direct OpenAI-compatible profiles (no OpenRouter provider features — e.g. OpenCode Zen, opencode.ai/zen/v1) fail on the second request with:

400 The `reasoning_content` in the thinking mode must be passed back to the API.

The endpoint runs server-managed thinking mode and requires the assistant reasoning_content to be replayed on follow-up requests. jcode stores it (stores_reasoning_content_for_context) but drops it at request-build time for these profiles, because reasoning passback is only unlocked when OpenRouter provider features are enabled or the endpoint is the Kimi coding endpoint (#322).

Repro

  • Any model in the DeepSeek family (e.g. deepseek-v4-flash-free on OpenCode Zen) via a direct OpenAI-compatible profile
  • Start a session, let the model emit a tool call (which carries a stored reasoning block), then send a follow-up request
  • 400 error above

Workaround (verified): set allow_provider_pinning = true on the named profile so provider features are treated as enabled, which unlocks the reasoning passback path.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions