anomalyco / anomalyco/opencode
Reasoning variants ineffective for alibaba provider: catalog npm (@ai-sdk/openai-compatible) drops enableThinking/thinkingBudget
@kitlangton is already working on this.
Since Sep 1, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Summary
Reasoning variants (thinking control) do not work for models served by the built-in alibaba provider. Variant options declared in config (enableThinking / thinkingBudget) are silently dropped before reaching the wire, so users cannot disable or budget thinking on Qwen3 models via Alibaba/DashScope-compatible endpoints.
opencode version: 1.18.25 (desktop and CLI behave identically)
Root cause
The models.dev catalog entry for the alibaba provider uses npm: "@ai-sdk/openai-compatible". Meanwhile:
- opencode bundles
@ai-sdk/alibaba(it is inBUNDLED_PROVIDERS) and that SDK supportsenableThinking/thinkingBudgetprovider options, mapped to the wire fieldsenable_thinking/thinking_budget(verified in the bundled dist and in @ai-sdk/alibaba sources >= 1.0.17). ProviderTransform.reasoningToggle()even has alibaba-specific handling ({ none: { enableThinking: false }, high: { enableThinking: true } }), andreasoningEffort()deliberately returns nothing for@ai-sdk/alibaba— both only reachable when the model's npm actually is@ai-sdk/alibaba.- With the catalog npm (
@ai-sdk/openai-compatible),ProviderTransform.providerOptions()wraps variant options under theopenaiCompatiblekey, and that SDK's provider-options schema strips everything except its own fields. Result: noenable_thinking, nothinking_budgeton the wire. OnlyreasoningEffortsurvives, emitted asreasoning_effort, which DashScope-compatible endpoints ignore (and values likexhighare not standard effort values anyway).
This overlaps with #42876 and #42793 (body-level variant fields being discarded), but the specific failure here is the catalog npm mismatch: the alibaba-specific variant machinery exists but is never engaged because the provider resolves to the generic openai-compatible SDK.
Reproduction
Config (no secrets needed; any DashScope-compatible endpoint with a thinking model works):
{
"provider": {
"alibaba": {
"options": { "baseURL": "<dashscope-compatible endpoint>", "apiKey": "<key>" },
"models": {
"qwen3.8-max": {
"reasoning": true,
"variants": {
"none": { "enableThinking": false },
"xhigh": { "enableThinking": true, "thinkingBudget": 262144 }
}
}
}
}
}
}
Log the outgoing HTTP bodies with a local proxy (opencode run -m alibaba/qwen3.8-max --variant none|xhigh "...").
Observed (1.18.25, catalog npm):
| variant | wire body | response reasoning tokens |
|---|---|---|
| none | no thinking fields at all | ~13 (thinking still ON server-side) |
| xhigh | reasoning_effort: "xhigh" (ignored) |
~12 |
Expected / workaround: adding "npm": "@ai-sdk/alibaba" at the provider level engages the bundled SDK:
| variant | wire body | response reasoning tokens |
|---|---|---|
| none | enable_thinking: false |
0 (no reasoning_content in stream) |
| xhigh | enable_thinking: true, thinking_budget: 262144 |
58 |
Suggested fixes
- Point the
alibabacatalog models that support thinking controls at the bundled@ai-sdk/alibabainstead of@ai-sdk/openai-compatible(it is already bundled, so no runtime install is needed), or - Teach the openai-compatible path to pass
enable_thinking/thinking_budgetthrough for alibaba-hosted models.
Related: #42876, #42793
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.