fix(config): correct GLM 5.2 context window to 1M tokens#747
Merged
Conversation
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
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))
Contributor
|
🎉 This PR is included in version 0.132.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-5matcher grouped all GLM 4/5 variants under 200k.Changes
config/model_context.go— Added a dedicatedglm-5.2matcher with a 1M context window, placed before the generalglm-4/glm-5matcher. This is required becauseLookupContextWindowevaluates matchers in priority order usingstrings.Contains(first match wins), so the more specific pattern must come first — the same convention already used forminimax-m2vsminimax-m3,deepseek-v3vsdeepseek-v4, etc.internal/models/context_test.go— Added a test case forollama_cloud/glm-5.2expecting 1M, alongside the existing GLM 4.6/4.7/5/5.1 cases that remain at 200k.Verification
All tests in the
internal/modelspackage pass:GLM 4.x and GLM 5/5.1 remain at 200k; only GLM 5.2 resolves to 1M.
Affected repos
clionly — no cross-repo impact (no schema/gateway/docs changes needed).