Bug Description
When using reasoning models on the alibaba-cn provider (DashScope), no reasoning/thinking content is produced despite models having capabilities.reasoning: true.
This affects all reasoning-capable models on alibaba-cn, not just kimi-k2.5:
alibaba-cn/kimi-k2.5
alibaba-cn/qwen-plus, alibaba-cn/qwen-turbo, alibaba-cn/qwen-flash
alibaba-cn/qwen3-* (8b, 14b, 32b, 235b)
alibaba-cn/qwq-plus, alibaba-cn/qwq-32b
alibaba-cn/deepseek-r1*
alibaba-cn/qvq-max
- etc.
The only exception is alibaba-cn/kimi-k2-thinking, which returns reasoning_content by default.
Root Cause
DashScope's OpenAI-compatible API requires enable_thinking: true in the request body to activate reasoning output. Without this parameter, reasoning_content is either absent or an empty string.
In packages/opencode/src/provider/transform.ts, the options() function handles thinking in two places, but neither covers the alibaba-cn (DashScope) case:
- Line 607-611: Sets
chat_template_args.enable_thinking only for providerID === "opencode" with kimi-k2-thinking
- Line 634-643: Sets
thinking.type: "enabled" only for @ai-sdk/anthropic SDK
The alibaba-cn provider uses @ai-sdk/openai-compatible — neither condition matches.
Reproduction
# No reasoning output (reasoning tokens = 0)
opencode run -m alibaba-cn/kimi-k2.5 --format json --thinking "test"
opencode run -m alibaba-cn/qwen-plus --format json --thinking "test"
# Direct API calls confirm enable_thinking is required:
# Without: no reasoning_content
curl $DASHSCOPE_API -d '{"model":"qwen-plus","messages":[...]}'
# With: reasoning_content present
curl $DASHSCOPE_API -d '{"model":"qwen-plus","messages":[...],"enable_thinking":true}'
Workaround
Add to opencode.json (per model):
{
"provider": {
"alibaba-cn": {
"models": {
"kimi-k2.5": { "options": { "enable_thinking": true } },
"qwen-plus": { "options": { "enable_thinking": true } }
}
}
}
}
Environment
- OpenCode version: v1.1.53
- Provider:
alibaba-cn (DashScope)
- API:
https://dashscope.aliyuncs.com/compatible-mode/v1
- SDK:
@ai-sdk/openai-compatible
Bug Description
When using reasoning models on the
alibaba-cnprovider (DashScope), no reasoning/thinking content is produced despite models havingcapabilities.reasoning: true.This affects all reasoning-capable models on
alibaba-cn, not just kimi-k2.5:alibaba-cn/kimi-k2.5alibaba-cn/qwen-plus,alibaba-cn/qwen-turbo,alibaba-cn/qwen-flashalibaba-cn/qwen3-*(8b, 14b, 32b, 235b)alibaba-cn/qwq-plus,alibaba-cn/qwq-32balibaba-cn/deepseek-r1*alibaba-cn/qvq-maxThe only exception is
alibaba-cn/kimi-k2-thinking, which returnsreasoning_contentby default.Root Cause
DashScope's OpenAI-compatible API requires
enable_thinking: truein the request body to activate reasoning output. Without this parameter,reasoning_contentis either absent or an empty string.In
packages/opencode/src/provider/transform.ts, theoptions()function handles thinking in two places, but neither covers thealibaba-cn(DashScope) case:chat_template_args.enable_thinkingonly forproviderID === "opencode"withkimi-k2-thinkingthinking.type: "enabled"only for@ai-sdk/anthropicSDKThe
alibaba-cnprovider uses@ai-sdk/openai-compatible— neither condition matches.Reproduction
Workaround
Add to
opencode.json(per model):{ "provider": { "alibaba-cn": { "models": { "kimi-k2.5": { "options": { "enable_thinking": true } }, "qwen-plus": { "options": { "enable_thinking": true } } } } } }Environment
alibaba-cn(DashScope)https://dashscope.aliyuncs.com/compatible-mode/v1@ai-sdk/openai-compatible