Skip to content

fix(provider): expose xhigh instead of max for GLM-5.2 on OpenAI-compatible#34283

Open
bogerman1 wants to merge 1 commit into
anomalyco:devfrom
bogerman1:fix/glm-5.2-openai-compatible-reasoning-effort
Open

fix(provider): expose xhigh instead of max for GLM-5.2 on OpenAI-compatible#34283
bogerman1 wants to merge 1 commit into
anomalyco:devfrom
bogerman1:fix/glm-5.2-openai-compatible-reasoning-effort

Conversation

@bogerman1

Copy link
Copy Markdown

Issue for this PR

Closes #34278

Type of change

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

What does this PR do?

GLM-5.2's native top reasoning tier is called max, but max is not in the OpenAI reasoning_effort enum (none/minimal/low/medium/high/xhigh). The OpenAI-compatible branch of variants() was exposing max directly, which:

  • gets 400'd by spec-compliant upstreams (hyper, Cloudflare AI Gateway, OpenRouter passthrough) that reject reasoning_effort: "max",
  • hides the actually-selectable xhigh tier from the TUI switcher.

The sibling OpenRouter branch already does the right thing (exposes xhigh, gateway translates to native max). This PR mirrors that for @ai-sdk/openai-compatible. The Anthropic branch is left alone since @ai-sdk/anthropic accepts max natively.

How did you verify your code works?

$ bun test test/provider/transform.test.ts
275 pass, 0 fail, 523 expect() calls

$ bun run typecheck
(tsgo --noEmit, clean)

$ oxlint packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.ts
0 errors (143 pre-existing warnings unchanged)

Updated the three existing GLM-5.2 openai-compatible tests to expect xhigh instead of max.

Screenshots / recordings

N/A (no UI change — the variant list is rendered from the map this PR fixes).

Checklist

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

…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.
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-5.2 on OpenAI-compatible providers: TUI variant switcher shows max (invalid reasoning_effort) instead of xhigh

1 participant