anomalyco / anomalyco/opencode

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

Open
#46,295 0 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 30, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.