Skip to content

alibaba-cn reasoning models (kimi-k2.5, qwen-plus, qwen3, etc.) do not output thinking content #12771

@AdJIa

Description

@AdJIa

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:

  1. Line 607-611: Sets chat_template_args.enable_thinking only for providerID === "opencode" with kimi-k2-thinking
  2. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions