GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DeepSeek V4 Flash: `reasoning_content` must be passed back to API when using thinking mode · Issue #24130 · anomalyco/opencode

DeepSeek V4 Flash: reasoning_content must be passed back to API when using thinking mode #24130

New issue
Copy link
New issue
Copy link
Closed
#24146
Closed
DeepSeek V4 Flash: reasoning_content must be passed back to API when using thinking mode#24130
#24146
Copy link
Assignees
rekram1-node
Labels
bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Description

@wenduof
wenduof
opened on Apr 24, 2026
Issue body actions

Description

Description

When using the newly released DeepSeek V4 Flash model (deepseek-v4-flash) for file writing operations, the following error occurs:
The reasoning_content in the thinking mode must be passed back to the API.

Background

DeepSeek released V4 preview today (see: https://mp.weixin.qq.com/s/8bxXqS2R8Fx5-1TLDBiEDg), with two models:

  • deepseek-v4-pro
  • deepseek-v4-flash
    The official announcement explicitly states that V4 is optimized for Agent products including Claude Code, OpenCode, CodeBuddy, etc. Both models support thinking mode, configurable via reasoning_effort parameter (high/max).

Root Cause

DeepSeek Thinking Mode API requires:

  • When thinking mode is enabled, assistant messages must contain a reasoning_content field
  • For tool call scenarios, reasoning_content must be passed back to the API in all subsequent requests
  • Reference: https://api-docs.deepseek.com/guides/thinking_mode#tool-calls
    The known solution in OpenCode is to configure interleaved:
"interleaved": {
  "field": "reasoning_content"
}
Issue
1. New model names (deepseek-v4-flash, deepseek-v4-pro) are not pre-configured with interleaved in the default provider settings
2. Users must manually add this configuration for proper functioning
3. Compared to legacy model deepseek-reasoner, V4's default behavior may differ (per official docs: deepseek-chat temporarily points to deepseek-v4-flash non-thinking mode, but this may change over time)
Suggested Fix
1. Update default provider configuration: Pre-configure interleaved for deepseek-v4-pro and deepseek-v4-flash models
2. Or auto-detect: Automatically handle reasoning_content when DeepSeek models with thinking mode are detected
Workaround
Users can manually configure in opencode.json:
{
  "provider": {
    "deepseek": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "DeepSeek",
      "options": {
        "baseURL": "https://api.deepseek.com/v1",
        "apiKey": "{env:DEEPSEEK_API_KEY}"
      },
      "models": {
        "deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash",
          "interleaved": {
            "field": "reasoning_content"
          }
        },
        "deepseek-v4-pro": {
          "name": "DeepSeek V4 Pro",
          "interleaved": {
            "field": "reasoning_content"
          }
        }
      }
    }
  }
}
Notes on interleaved Configuration
Based on prior issues (#6040, #8934), configuring "interleaved": { "field": "reasoning_content" } for DeepSeek models using the official API (@ai-sdk/openai-compatible) has minimal side effects:
- Slightly increased token usage (DeepSeek API ignores reasoning_content from prior turns per #5577, but still bills for them)
- Slightly increased network bandwidth
This is the recommended configuration per DeepSeek's API documentation.
Related Issues
This issue type has been reported multiple times, but is new for V4 models:
- #4947, #5027, #5332, #5577, #6040, #8934, #10788, #17523
OpenCode Version
1.14.22
Operating System
ubuntu 22.04

### Plugins

rtk

### OpenCode version

1.14.22

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

Ubuntu 22.04

### Terminal

_No response_

Activity

  1. wenduof
    added
    bugSomething isn't working
    on Apr 24, 2026
  2. github-actions
    assigned
    rekram1-node
    on Apr 24, 2026
  3. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  4. github-actions commented on Apr 24, 2026

    @github-actions
    github-actionsBot
    on Apr 24, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • deepseek-v4-pro model ID is not recognized as a thinking model, causing reasoning_content errors even with interleaved configured #24097: deepseek-v4-pro model ID not recognized as thinking model, causing identical reasoning_content errors
    • [Bug] DeepSeek V4 fails with 'reasoning_content must be passed back' error in multi-turn conversations #24124: DeepSeek V4 fails with same 'reasoning_content must be passed back' error in multi-turn conversations
    • Support DeepSeek V4 Thinking Mode with reasoning_content handling #24114: Support DeepSeek V4 Thinking Mode with reasoning_content handling
    • DeepSeek thinking mode: reasoning_content must be passed back to API on conversation continuation #24104: DeepSeek thinking mode: reasoning_content must be passed back to API on conversation continuation
    • Missing reasoning_content field in the assistant message for DeepSeek API implementation #17523: Missing reasoning_content field in assistant message for DeepSeek API implementation (older, related root issue)

    There appear to be several issues open today covering the same DeepSeek V4 reasoning_content / interleaved configuration problem. Please coordinate with the reporters of those issues, and consider closing as a duplicate if the underlying problem is the same.

  5. rekram1-node
    closed this as completedin #24146on Apr 24, 2026
  6. fkyah3 commented on Apr 25, 2026

    @fkyah3
    fkyah3
    on Apr 25, 2026
    More actions

    Same issue affecting multiple projects — updated list as of April 26:

    Project Issue
    OpenCode #24104 #24130 #24261
    OpenClaw openclaw#71160 openclaw#71455
    n8n n8n#29119
    Continue.dev continuedev#10758
    HuggingFace Chat-UI chat-ui#1664

    All share the same root cause: AI SDKs don't preserve reasoning_content on assistant messages with tool_calls across multi-turn agent conversations. Our fork (fkyah3/opencode-fkyah3) implements a brute-force fix at the normalizeMessages() level: unconditionally inject reasoning_content: "" for ALL assistant messages before API dispatch. Verified working with direct DeepSeek API.

    See #24261 for more context. Not a config issue — just ecosystem adaptation lag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.