Skip to content

BUG: z.ai preset silently runs at 200K context instead of 1M #14

Description

@jellologic

Live bug in 0.1.0

src/providers.js ships the z.ai preset as:

models: { opus: 'glm-5.2', sonnet: 'glm-5.2', haiku: 'glm-5.2' }

GLM-5.2 is a 1M-context model, but because ANTHROPIC_BASE_URL points away from api.anthropic.com, Claude Code cannot verify 1M support and falls back to a hardcoded 200,000. Users get ~20% of the context they're paying for, and auto-compaction fires at roughly 167–187K — which presents as "the model keeps forgetting things", with no error anywhere.

The fix is the [1m] suffix, not the window variable

Per model-config:

To enable extended context for a pinned model, append [1m] to the model ID in ANTHROPIC_DEFAULT_OPUS_MODEL or ANTHROPIC_DEFAULT_SONNET_MODEL

The suffix is read per variable, not per model

That second line is the trap: it must be appended to every model variable. One unsuffixed variable silently runs that tier at 200K.

Setting CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000 does not substitute for this — see #2, where the value is capped at the assumed window and collapses back to 200K.

Note this is a live upstream gap, not just ours

z.ai's international docs ship glm-5.2 with no suffix, while bigmodel.cn and Volcengine both document glm-5.2[1m] — same model, same vendor. Anyone following z.ai international's own instructions has this bug.

Proposal

Add an explicit extendedContext flag to the provider/model schema so the suffix is applied deliberately rather than by string-munging.

Acceptance criteria

  • z.ai preset yields glm-5.2[1m] on all model tier variables
  • Suffix applied only where the model genuinely supports 1M — never speculatively
  • Test asserts every ANTHROPIC_DEFAULT_*_MODEL carries the suffix when extended context is on
  • Existing user configs with a bare glm-5.2 are migrated or warned about
  • Verified against a real z.ai key before release — /status should report 1M

Verified per-provider values

Provider Model ID Window
MiniMax MiniMax-M3[1m] 1000000
Kimi kimi-k3[1m] 1048576 (2^20)
Zhipu / bigmodel.cn glm-5.2[1m] 1000000
Volcengine ARK glm-5.2[1m] 1000000
z.ai international ships bare glm-5.2 ← the gap

Qwen/DashScope and DeepSeek document no [1m] — do not add speculatively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatThird-party gateway compatibility

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions