summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdJIa <[email protected]>2026-02-09 12:42:23 +0800
committerGitHub <[email protected]>2026-02-08 22:42:23 -0600
commit0cd52f830c2a7e7a09612dbdd7a529bfd4b4bde8 (patch)
treee8625648fa67fcd78bf901fcdc871290f0266533
parent62f38087b8a1fa5eeebc14c376f0ebfb1d7b3e5c (diff)
downloadopencode-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.ts14
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"