Skip to content

fix(config): correct GLM 5.2 context window to 1M tokens#747

Merged
edenreich merged 1 commit into
mainfrom
fix/glm-5.2-context-window-1m
Jul 4, 2026
Merged

fix(config): correct GLM 5.2 context window to 1M tokens#747
edenreich merged 1 commit into
mainfrom
fix/glm-5.2-context-window-1m

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Fixes #745

Ollama Cloud GLM 5.2 has a 1M token context window, but the context window estimator reported 200k because the single glm-4/glm-5 matcher grouped all GLM 4/5 variants under 200k.

Changes

  • config/model_context.go — Added a dedicated glm-5.2 matcher with a 1M context window, placed before the general glm-4/glm-5 matcher. This is required because LookupContextWindow evaluates matchers in priority order using strings.Contains (first match wins), so the more specific pattern must come first — the same convention already used for minimax-m2 vs minimax-m3, deepseek-v3 vs deepseek-v4, etc.
  • internal/models/context_test.go — Added a test case for ollama_cloud/glm-5.2 expecting 1M, alongside the existing GLM 4.6/4.7/5/5.1 cases that remain at 200k.

Verification

All tests in the internal/models package pass:

=== RUN   TestMiscOpenWeightContextWindow
--- PASS: TestMiscOpenWeightContextWindow (0.00s)
PASS
ok      github.com/inference-gateway/cli/internal/models

GLM 4.x and GLM 5/5.1 remain at 200k; only GLM 5.2 resolves to 1M.

Affected repos

  • cli only — no cross-repo impact (no schema/gateway/docs changes needed).

GLM 5.2 supports a 1M token context window, but the existing matcher
grouped all glm-4/glm-5 variants under 200k. Add a dedicated glm-5.2
matcher placed before the general glm-4/glm-5 line so the more specific
pattern wins under first-match strings.Contains evaluation.

Fixes #745
@edenreich edenreich requested a review from a team as a code owner July 4, 2026 20:46
@edenreich edenreich added the bug Something isn't working label Jul 4, 2026
@edenreich edenreich merged commit 164ffaf into main Jul 4, 2026
9 checks passed
@edenreich edenreich deleted the fix/glm-5.2-context-window-1m branch July 4, 2026 20:53
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 4, 2026
## [0.132.1](v0.132.0...v0.132.1) (2026-07-04)

### 🐛 Bug Fixes

* allow agent to read plans from userspace config dir ([#748](#748)) ([d1c1be7](d1c1be7)), closes [#746](#746)
* **config:** correct GLM 5.2 context window to 1M tokens ([#747](#747)) ([164ffaf](164ffaf)), closes [#745](#745)
* **claude-code:** make subscription mode a true pass-through ([#749](#749)) ([10117b4](10117b4)), closes [inference-gateway/inference-gateway#412](inference-gateway/inference-gateway#412)

### 👷 CI/CD

* **deps:** update inference workflow to version 0.15.0 ([c8e1522](c8e1522))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.132.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Ollama Cloud GLM 5.2 Context Length is not 200k

1 participant