From 463590861cf43945825d7334fd2cfc79eed0bd77 Mon Sep 17 00:00:00 2001 From: adelvillar1 Date: Sat, 13 Jun 2026 13:04:30 -0500 Subject: [PATCH] fix(models): support glm-5.2, kimi-k2.7-code + merge live/curated model lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three changes to fix newly-released models not appearing in the picker or being capped at wrong context lengths: 1. Add glm-5.2 to zai provider's static model list 2. Add kimi-k2.7-code to kimi-coding provider's static model list 3. Fix generic live-fetch path in provider_model_ids() to MERGE curated entries with live /v1/models results instead of replacing them — same pattern already used by the Anthropic path. Providers like Z.AI and Kimi don't list new models in /v1/models immediately even though inference works, causing curated entries to silently disappear. 4. Add glm-5.2 context length (1M tokens) to DEFAULT_CONTEXT_LENGTHS, before the generic 'glm' catch-all (202752) that was capping it at ~200K via substring matching. --- agent/model_metadata.py | 5 ++++- hermes_cli/models.py | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/agent/model_metadata.py b/agent/model_metadata.py index 3a71e974fdb7..f19ccdc6a940 100644 --- a/agent/model_metadata.py +++ b/agent/model_metadata.py @@ -209,7 +209,10 @@ def _strip_provider_prefix(model: str) -> str: # https://platform.minimax.io/docs/api-reference/text-chat-openai "minimax-m3": 1000000, "minimax": 204800, - # GLM + # GLM — GLM-5.2 ships with 1M context; GLM-5 and GLM-5.1 are 200K. + # Substring matching is longest-first, so "glm-5.2" wins over the + # generic "glm" catch-all for that slug. + "glm-5.2": 1_000_000, "glm": 202752, # xAI Grok — xAI /v1/models does not return context_length metadata, # so these hardcoded fallbacks prevent Hermes from probing-down to diff --git a/hermes_cli/models.py b/hermes_cli/models.py index 9b473f05606a..7d3849c7df8a 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -256,6 +256,7 @@ def _xai_curated_models() -> list[str]: "gemini-3.5-flash", ], "zai": [ + "glm-5.2", "glm-5.1", "glm-5", "glm-5v-turbo", @@ -280,6 +281,7 @@ def _xai_curated_models() -> list[str]: "openai/gpt-oss-120b", ], "kimi-coding": [ + "kimi-k2.7-code", "kimi-k2.6", "kimi-k2.5", "kimi-for-coding", @@ -2330,7 +2332,19 @@ def provider_model_ids(provider: Optional[str], *, force_refresh: bool = False) if api_key: live = _p.fetch_models(api_key=api_key) if live: - return live + # Merge curated entries with live results so models that + # are reachable for inference before they appear in + # /v1/models survive the live fetch (same pattern as the + # Anthropic path above). Curated go first to preserve the + # recommended ordering in the /model picker. + curated = list(_PROVIDER_MODELS.get(normalized, [])) + merged = list(curated) + merged_lower = {m.lower() for m in curated} + for m in live: + if m.lower() not in merged_lower: + merged.append(m) + merged_lower.add(m.lower()) + return merged # Use profile's fallback_models if defined if _p.fallback_models: return list(_p.fallback_models)