Skip to content

feat(core): add reasoning variant toggle for GLM models - #18599

Closed
0717376 wants to merge 1 commit into
anomalyco:devfrom
0717376:fix/glm-thinking-toggle
Closed

0717376 wants to merge 1 commit into
anomalyco:devfrom
0717376:fix/glm-thinking-toggle

Conversation

@0717376

@0717376 0717376 commented Mar 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #18598

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

GLM models were excluded from reasoning variants in ProviderTransform.variants(), which meant users could not toggle thinking mode on/off at runtime — only via static config before starting a session.

This PR removes GLM from the exclusion list and adds none/high variants with the correct parameter format per provider:

  • Z.AI/Zhipu directly: thinking: { type: "enabled"/"disabled" } (native API format)
  • OpenRouter / openai-compatible: reasoning: { enabled: true/false }

Users just need "reasoning": true in their model config to get the variant selector. The code handles the provider-specific format automatically.

How did you verify your code works?

  • All 121 existing transform tests pass, including 4 new tests covering GLM variants for Z.AI, OpenRouter (both SDK flavors), and unknown providers
  • Manually tested with GLM-5 via OpenRouter: confirmed none disables thinking output, high enables it, switching works mid-session

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

GLM models were excluded from reasoning variants, preventing
runtime thinking toggle. Add none/high variants with correct
parameter format per provider (thinking for Z.AI, reasoning
for OpenRouter).

Closes anomalyco#18598
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found potentially related PRs that address similar reasoning/thinking variant features:

Related PRs:

  1. feat(provider): add reasoning variants for Together AI, OpenRouter, and OpenAI-compatible providers (feat(provider): add reasoning variants for Together AI, OpenRouter, and OpenAI-compatible providers #12145)

  2. fix(provider): respect thinking toggle for Gemini models (fix(provider): respect thinking toggle for Gemini models #12117)

  3. feat(model): add provider fast mode toggle (feat(model): add provider fast mode toggle #17840)

These are not exact duplicates of PR #18599, but they address related functionality around reasoning/thinking variants for different providers. PR #18599 appears to be the first to specifically add this feature for GLM models.

@0717376

0717376 commented Apr 1, 2026

Copy link
Copy Markdown
Author

@rekram1-node hey, would appreciate a review when you get a chance. All checks pass, tested manually with GLM-5 via OpenRouter.

@rekram1-node

Copy link
Copy Markdown
Collaborator

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLM models excluded from reasoning variants — no way to toggle thinking at runtime

2 participants