Skip to content

Commit 0cd52f8

Browse files
AdJIalujia
andauthored
fix: enable thinking for all reasoning models on alibaba-cn (DashScope) (anomalyco#12772)
Co-authored-by: lujia <lujiax@zmn.cn>
1 parent 62f3808 commit 0cd52f8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/opencode/src/provider/transform.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,20 @@ export namespace ProviderTransform {
643643
}
644644
}
645645

646+
// Enable thinking for reasoning models on alibaba-cn (DashScope).
647+
// DashScope's OpenAI-compatible API requires `enable_thinking: true` in the request body
648+
// to return reasoning_content. Without it, models like kimi-k2.5, qwen-plus, qwen3, qwq,
649+
// deepseek-r1, etc. never output thinking/reasoning tokens.
650+
// Note: kimi-k2-thinking is excluded as it returns reasoning_content by default.
651+
if (
652+
input.model.providerID === "alibaba-cn" &&
653+
input.model.capabilities.reasoning &&
654+
input.model.api.npm === "@ai-sdk/openai-compatible" &&
655+
!modelId.includes("kimi-k2-thinking")
656+
) {
657+
result["enable_thinking"] = true
658+
}
659+
646660
if (input.model.api.id.includes("gpt-5") && !input.model.api.id.includes("gpt-5-chat")) {
647661
if (!input.model.api.id.includes("gpt-5-pro")) {
648662
result["reasoningEffort"] = "medium"

0 commit comments

Comments
 (0)