diff options
| author | AdJIa <[email protected]> | 2026-02-09 12:42:23 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-08 22:42:23 -0600 |
| commit | 0cd52f830c2a7e7a09612dbdd7a529bfd4b4bde8 (patch) | |
| tree | e8625648fa67fcd78bf901fcdc871290f0266533 | |
| parent | 62f38087b8a1fa5eeebc14c376f0ebfb1d7b3e5c (diff) | |
| download | opencode-0cd52f830c2a7e7a09612dbdd7a529bfd4b4bde8.tar.gz opencode-0cd52f830c2a7e7a09612dbdd7a529bfd4b4bde8.zip | |
fix: enable thinking for all reasoning models on alibaba-cn (DashScope) (#12772)
Co-authored-by: lujia <[email protected]>
| -rw-r--r-- | packages/opencode/src/provider/transform.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 8aab0d415..9aadb84cf 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -643,6 +643,20 @@ export namespace ProviderTransform { } } + // Enable thinking for reasoning models on alibaba-cn (DashScope). + // DashScope's OpenAI-compatible API requires `enable_thinking: true` in the request body + // to return reasoning_content. Without it, models like kimi-k2.5, qwen-plus, qwen3, qwq, + // deepseek-r1, etc. never output thinking/reasoning tokens. + // Note: kimi-k2-thinking is excluded as it returns reasoning_content by default. + if ( + input.model.providerID === "alibaba-cn" && + input.model.capabilities.reasoning && + input.model.api.npm === "@ai-sdk/openai-compatible" && + !modelId.includes("kimi-k2-thinking") + ) { + result["enable_thinking"] = true + } + if (input.model.api.id.includes("gpt-5") && !input.model.api.id.includes("gpt-5-chat")) { if (!input.model.api.id.includes("gpt-5-pro")) { result["reasoningEffort"] = "medium" |
