Skip to content

feat(models): add GLM-5.2 with 1M context window - #45806

Closed
hetdev wants to merge 1 commit into
NousResearch:mainfrom
hetdev:feat/add-glm-5.2
Closed

feat(models): add GLM-5.2 with 1M context window#45806
hetdev wants to merge 1 commit into
NousResearch:mainfrom
hetdev:feat/add-glm-5.2

Conversation

@hetdev

@hetdev hetdev commented Jun 13, 2026

Copy link
Copy Markdown

Summary

GLM-5.2 (Zhipu/z.ai) is now available and ships with a truly usable 1M-token context window — a significant upgrade from the 200K window of GLM-5/5.1. This PR registers the model across all relevant surfaces.

Changes

agent/model_metadata.py

  • Add "glm-5.2": 1000000 to KNOWN_CONTEXT_LENGTHS. The longest-first substring matching ensures this entry wins over the generic "glm": 202752 catch-all.

hermes_cli/models.py (3 locations)

  • OPENROUTER_MODELS: add z-ai/glm-5.2
  • _PROVIDER_MODELS curated list: add z-ai/glm-5.2
  • _PROVIDER_MODELS["zai"]: add glm-5.2

Source

  • GLM-5.2 announcement — Zhipu confirms 1M context window, MIT-licensed open-source release.
  • Model architecture: 744B params (40B activated MoE), DeepSeek Sparse Attention (DSA), pre-trained on 28.5T tokens.

Verification

# Substring matching resolves correctly:
# "glm-5.2" → matches "glm-5.2" (len 7) before "glm" (len 3) → 1,000,000 ✅
# "glm-5.1" → matches "glm" only → 202,752 (unchanged) ✅
# "glm-4.5" → matches "glm" only → 202,752 (unchanged) ✅

GLM-5.2 (Zhipu/z.ai) ships with a truly usable 1M-token context window,
a significant upgrade from the 200K window of GLM-5/5.1.

Changes:
- model_metadata.py: add "glm-5.2": 1000000 entry (substring matching
  longest-first ensures it wins over the generic "glm": 202752 catch-all)
- models.py: register glm-5.2 in OPENROUTER_MODELS, _PROVIDER_MODELS
  curated list, and the "zai" provider model list

Source: https://docs.z.ai/guides/llm/glm-5 (GLM-5.2 announcement)
@alt-glitch alt-glitch added type/feature New feature or request provider/zai ZAI provider P3 Low — cosmetic, nice to have labels Jun 13, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for jumping on GLM-5.2. We merged the broader GLM-5.2 support via #45695, preserving @am423's authorship in git history:

#45695

That landed the 1M context metadata plus the Z.AI model picker/setup/auth probing/fallback surfaces, so this PR is now covered. Closing as duplicate, with appreciation for helping validate the same issue.

@teknium1 teknium1 closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have provider/zai ZAI provider type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants