fix(provider): expose xhigh instead of max for GLM-5.2 on OpenAI-compatible#34283
Open
bogerman1 wants to merge 1 commit into
Open
fix(provider): expose xhigh instead of max for GLM-5.2 on OpenAI-compatible#34283bogerman1 wants to merge 1 commit into
bogerman1 wants to merge 1 commit into
Conversation
…atible GLM-5.2's native top reasoning tier is `max`, but `max` is not part of the OpenAI `reasoning_effort` enum (none/minimal/low/medium/high/xhigh). OpenAI-compatible upstreams that follow the OpenAI spec — e.g. hyper, Cloudflare AI Gateway, and OpenRouter passthrough — reject `reasoning_effort: "max"` with a 400. The OpenRouter branch already exposes `xhigh` and lets the gateway translate it to GLM's native `max`. The OpenAI-compatible branch erroneously exposed `max` directly, which: 1. Produces a 400 from spec-compliant upstreams when the user selects the top tier. 2. Surfaces only `high` and `max` in the TUI variant switcher, hiding the `xhigh` tier that the user can actually select without errors. Mirror the OpenRouter branch: expose `high` and `xhigh`, and let the gateway translate `xhigh` to GLM's native `max` when needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #34278
Type of change
What does this PR do?
GLM-5.2's native top reasoning tier is called
max, butmaxis not in the OpenAIreasoning_effortenum (none/minimal/low/medium/high/xhigh). The OpenAI-compatible branch ofvariants()was exposingmaxdirectly, which:reasoning_effort: "max",xhightier from the TUI switcher.The sibling OpenRouter branch already does the right thing (exposes
xhigh, gateway translates to nativemax). This PR mirrors that for@ai-sdk/openai-compatible. The Anthropic branch is left alone since@ai-sdk/anthropicacceptsmaxnatively.How did you verify your code works?
Updated the three existing GLM-5.2 openai-compatible tests to expect
xhighinstead ofmax.Screenshots / recordings
N/A (no UI change — the variant list is rendered from the map this PR fixes).
Checklist