Skip to content

deepseek-v4-pro model ID is not recognized as a thinking model, causing reasoning_content errors even with interleaved configured #24097

Closed

Description

@ruichenrui

Description

Config that fails

{
  "provider": {
    "deepseek": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "DeepSeek",
      "options": {
        "baseURL": "https://api.deepseek.com",
        "apiKey": "<key>"
      },
      "models": {
        "deepseek-v4-pro": {
          "name": "DeepSeek-V4-Pro",
          "limit": { "context": 1048576, "output": 262144 },
          "interleaved": { "field": "reasoning_content" },
          "options": {
            "reasoningEffort": "max",
            "thinking": { "type": "enabled" }
          }
        }
      }
    }
  }
}

**Error**

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

**Workaround that works**

Changing the model key from deepseek-v4-pro to deepseek-reasoner (with identical options) resolves the error:
"deepseek-reasoner": {
  "name": "DeepSeek-V4-Pro",
  "interleaved": { "field": "reasoning_content" },
  ...
}

**Expected behavior**

deepseek-v4-pro should be recognized as a thinking/reasoning model and handle reasoning_content correctly when interleaved is configured, just like deepseek-reasoner.

**Reference**

DeepSeek API docs list deepseek-v4-pro as the official model identifier for V4 Pro: https://api-docs.deepseek.com/

### Plugins

_No response_

### OpenCode version

1.14.21

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

_No response_

### Terminal

_No response_

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (e.g., specifically about the model ID not being recognized as a reasoning model when using a custom key like deepseek-v4-pro vs deepseek-reasoner), feel free to clarify so it can be tracked separately.

  3. Svtter commented on Apr 24, 2026

    @Svtter

    This post solved this problem.

  4. ruichenrui commented on Apr 24, 2026

    @ruichenrui
    Author

    Thanks for checking. After reviewing both issues, mine is distinct:

    {
      "provider": {
        "deepseek": {
          "npm": "@ai-sdk/anthropic",
          "name": "DeepSeek",
          "options": {
            "baseURL": "https://api.deepseek.com/anthropic",
            "apiKey": "<apikey>"
          },
          "models": {
            "deepseek-v4-pro": {
              "name": "DeepSeek-V4-Pro",
              "limit": { "context": 1048576, "output": 262144 },
              "options": {
                "thinking": { "type": "enabled", "budgetTokens": 8192 }
              }
            }
          }
        }
      }
    }
    Results:
    - @ai-sdk/openai-compatible + deepseek-v4-pro = Broken
    - @ai-sdk/openai-compatible + deepseek-reasoner = Works
    - @ai-sdk/anthropic + deepseek-v4-pro = Works
    This strongly suggests the bug is specifically in how OpenCode maps deepseek-v4-pro when using @ai-sdk/openai-compatible, not a general lack of V4 support.
  5. ruichenrui commented on Apr 24, 2026

    @ruichenrui
    Author

    Update: Tested the @ai-sdk/anthropic workaround mentioned above, but it also fails with a similar error.
    Config used:

    {
      "provider": {
        "deepseek": {
          "npm": "@ai-sdk/anthropic",
          "name": "DeepSeek",
          "options": {
            "baseURL": "https://api.deepseek.com/anthropic",
            "apiKey": "{env:DEEPSEEK}"
          },
          "models": {
            "deepseek-v4-pro": {
              "name": "DeepSeek-V4-Pro",
              "limit": {
                "context": 1048576,
                "output": 262144
              },
              "options": {
                "thinking": {
                  "type": "enabled",
                  "budgetTokens": 81920
                }
              }
            }
          }
        }
      }
    }
    Error:
    Bad Request: {"error":{"message":"The content[].thinking in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
    This confirms that the issue is not specific to the OpenAI-compatible protocol. Both @ai-sdk/openai-compatible and @ai-sdk/anthropic paths fail with deepseek-v4-pro because OpenCode does not correctly preserve and forward the model's reasoning/thinking content back to the API on subsequent turns.
  6. Small-tailqwq commented on Apr 24, 2026

    @Small-tailqwq

    相同的问题

    Image

    使用配置如下:

    {
      "npm": "@ai-sdk/anthropic",
      "name": "DeepSeek",
      "options": {
        "baseURL": "https://api.deepseek.com/anthropic",
        "apiKey": "sk-************************"
      },
      "models": {
        "deepseek-v4-pro": {
          "name": "DeepSeek-V4-Pro",
          "limit": {
            "context": 1048576,
            "output": 262144
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "deepseek-v4-flash": {
          "name": "DeepSeek-V4-Flash",
          "limit": {
            "context": 1048576,
            "output": 262144
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        }
      }
    }
    
    Bad Request: {"error":{"message":"The `content[].thinking` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
    
  7. kobe2000 commented on Apr 25, 2026

    @kobe2000

    1.14.24 the same error

  8. Svtter commented on Apr 26, 2026

    @Svtter

    Root cause analysis with reproduction tests

    I wrote failing tests that prove opencode has structural issues with reasoning round-trip, independent of the OpenRouter SDK bug that was fixed in #24435.

    Commit: Svtter@50ad5c012

    3 structural bugs confirmed by failing tests

    Bug Root cause
    options() missing include for reasoning models Only set in variants(), not in the default path — affects all OpenAI/Copilot/Azure reasoning models when no variant is selected
    convertToOpenAIResponsesInput drops reasoning without itemId Reasoning with encrypted_content but no itemId is silently skipped
    differentModel=true clears reasoning providerMetadata itemId + reasoningEncryptedContent lost on model switch

    Note: DeepSeek uses the interleaved / reasoning_content path via @ai-sdk/openai-compatible, not the OpenAI encrypted_content mechanism. The deepseek-reasoner workaround does NOT work because of special handling — DeepSeek returns {} from variants() (line 373 of transform.ts) and has no include set either. Multiple commenters here confirm deepseek-reasoner still fails. The underlying reasoning round-trip issues affect all providers.

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

Metadata

Metadata

Assignees

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