You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
deepseek-v4-pro model ID is not recognized as a thinking model, causing reasoning_content errors even with interleaved configured #24097
{
"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 version1.14.21### Steps to reproduce_No response_### Screenshot and/or share link_No response_### Operating System_No response_### Terminal_No response_
Reacted by Artyom Maglinets (Артём Маглинец) and Denis
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.
Adapting to the New DeepSeek Model #24092: A generic request to "adapt to DeepSeek V4" with no technical specifics.
My report provides verified workarounds that prove this is a bug in model ID recognition, not a missing feature. Workaround 1: Using the legacy model ID deepseek-reasoner with @ai-sdk/openai-compatible works with identical config. Workaround 2 (via community member @Svtter): Switch to @ai-sdk/anthropic with DeepSeek's Anthropic-compatible endpoint:
{
"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 = WorksThis 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.
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.
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"}}
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.
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.
Activity
github-actions commentedon Apr 24, 2026
This issue might be a duplicate of existing issues. Please check:
reasoning_contentin the thinking mode must be passed back to the API. #24083: Same error message —reasoning_contentin thinking mode must be passed back to the API, also involving DeepSeekIf 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-provsdeepseek-reasoner), feel free to clarify so it can be tracked separately.Svtter commentedon Apr 24, 2026
This post solved this problem.
ruichenrui commentedon Apr 24, 2026
Thanks for checking. After reviewing both issues, mine is distinct:
reasoning_contentin the thinking mode must be passed back to the API. #24083: Only shows the error message without config details or root-cause analysis.My report provides verified workarounds that prove this is a bug in model ID recognition, not a missing feature.
Workaround 1: Using the legacy model ID
deepseek-reasonerwith@ai-sdk/openai-compatibleworks with identical config.Workaround 2 (via community member @Svtter): Switch to
@ai-sdk/anthropicwith DeepSeek's Anthropic-compatible endpoint:{ "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.ruichenrui commentedon Apr 24, 2026
Update: Tested the
@ai-sdk/anthropicworkaround 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.Small-tailqwq commentedon Apr 24, 2026
相同的问题
使用配置如下:
kobe2000 commentedon Apr 25, 2026
1.14.24 the same error
Svtter commentedon Apr 26, 2026
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
options()missingincludefor reasoning modelsvariants(), not in the default path — affects all OpenAI/Copilot/Azure reasoning models when no variant is selectedconvertToOpenAIResponsesInputdrops reasoning withoutitemIdencrypted_contentbut noitemIdis silently skippeddifferentModel=trueclears reasoningproviderMetadataitemId+reasoningEncryptedContentlost on model switchNote: DeepSeek uses the
interleaved/reasoning_contentpath via@ai-sdk/openai-compatible, not the OpenAIencrypted_contentmechanism. Thedeepseek-reasonerworkaround does NOT work because of special handling — DeepSeek returns{}fromvariants()(line 373 oftransform.ts) and has noincludeset either. Multiple commenters here confirmdeepseek-reasonerstill fails. The underlying reasoning round-trip issues affect all providers.