Skip to content

[FEATURE]: Expose low/high/max reasoning effort for z-ai/glm-5.3(-flash) (parity with glm-5.2 and xAI fix #42160) #46295

Description

@criterium

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

feat(provider): expose low/high/max reasoning effort for z-ai/glm-5.3(-flash)

Context

z-ai/glm-5.3 and glm-5.3-flash support reasoning_effort: low / high / max (default max, thinking.type=disabled returns 400). This is documented in docs.z.ai/guides/llm/glm-5.3.md and zai-org/GLM-5.3-Flash on Hugging Face. glm-5.2 already exposes variants in OpenCode, so 5.3 is the natural follow-up. This would bring it in line with the recent xAI fix for grok-3-mini (#42160), but with its own value set.

Current behavior

packages/opencode/src/provider/transform.ts:730-790 (v1 1.18.25) defines variants for glm-5.2 (high/xhigh via @openrouter, high/max via openai-compatible):

const glm52 = ["glm-5.2", ...].some(...)
if (glm52 && npm === "@openrouter/ai-sdk-provider") return {high, xhigh}
...
if (id.includes("glm") && !glm52) return {}

As a result z-ai/glm-5.3(-flash) via any provider (openrouter, openai-compatible, ...) currently has no variants — the TUI shows no options and agent.options.reasoningEffort has no effect. The model always runs at the default max.

Expected

Expose the three levels for glm-5.3(-flash) on the same providers as 5.2, for example:

const glm53 = ["glm-5.3", "glm-5-3", "glm-5p3", "glm-5.3-flash"].some(...)
if (glm53 && npm === "@openrouter/ai-sdk-provider")
  return { low: { reasoning: { effort: "low" } }, high: { reasoning: { effort: "high" } }, max: { reasoning: { effort: "max" } } }
if (glm53 && npm === "@ai-sdk/openai-compatible")
  return { low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" }, max: { reasoningEffort: "max" } }
if (glm53 && npm === "@ai-sdk/anthropic")
  return { low: { effort: "low" }, high: { effort: "high" }, max: { effort: "max" } }

This matches the Z.ai spec (low lightweight, high enhanced, max deep) and allows mid-session changes to affect the next turn, similar to how muse-spark (minimal→xhigh) already works. It would also keep v2 in sync, where the same early return currently covers all glm models.

Repro

  1. Configure provider.openrouter.models["z-ai/glm-5.3-flash"] in opencode.jsonc.
  2. Open the model picker — variants are listed but changing them has no real effect.
  3. Setting reasoningEffort: "low" (or any level) still runs at max; usage.completion_tokens_details.reasoning_tokens stays at the max level.

References

  • docs.z.ai/guides/llm/glm-5.3.md — table reasoning_effort: low/high/max, default max
  • zai-org/GLM-5.3-Flash on Hugging Face — reasoning_effort defaults to max if not passed
  • 1120d070 stats alias ox-alpha → glm-5.3-flash (shows the model is already recognized)
  • fix(xai): pass through reasoning effort (#42160) — prior art for exposing reasoning effort

Happy to adjust the value mapping if you prefer a different naming (e.g. high/xhigh alias for max). Thanks for considering it!

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions