anomalyco / anomalyco/opencode
reasoningToggle() returns {} for @ai-sdk/openai-compatible despite models.dev declaring a toggle (GLM 4.7, GLM 5-turbo)
@nexxeln is already working on this.
Since Aug 15, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Problem
GLM 4.7 and GLM 5-turbo (zai-coding-plan) declare reasoning_options: [{"type": "toggle"}] on models.dev, but reasoningToggle() in packages/opencode/src/provider/transform.ts only handles @ai-sdk/alibaba and @ai-sdk/cohere. It returns {} for @ai-sdk/openai-compatible. No reasoning variants appear in the /models menu, so thinking can't be disabled for these models.
Aware of #18598 (closed as intentional). That decision predated the metadata-driven variant system (#36624, #36543, #37519), under which models.dev now declares a toggle for these models, but the new code path can't serve it for this transport. Flagging the inconsistency rather than relitigating the old behavior. If the metadata is wrong instead, that'd be good to know too.
Verification
Against the Z.AI coding plan endpoint, glm-4.7, same prompt:
thinking: {"type": "disabled"}→reasoning_contentempty, correct answer- default → 269 chars of
reasoning_content, correct answer
The API honors the toggle. Only the menu variants are missing.
Suggested fix
case "@ai-sdk/openai-compatible":
return {
none: { thinking: { type: "disabled" } },
high: { thinking: { type: "enabled" } },
}
Metadata-gated (only called when models.dev declares a toggle), fix is similar to the MiniMax M3 variants from #38330. Happy to send a PR with test.each coverage if the approach looks right.
Plugins
No response
OpenCode version
1.18.18
Steps to reproduce
- Authenticate zai-coding-plan
- /models → GLM 4.7
- No reasoning variants offered (thinking can't be disabled)
Screenshot and/or share link
No response
Operating System
macOS 15.6.1
Terminal
No response
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.