diff --git a/agent/model_metadata.py b/agent/model_metadata.py index a638798a970ed..6be46f3c0a49a 100644 --- a/agent/model_metadata.py +++ b/agent/model_metadata.py @@ -481,13 +481,16 @@ DEFAULT_CONTEXT_LENGTHS = { # https://platform.minimax.io/docs/api-reference/text-chat-openai "minimax-m3": 1000000, "minimax": 204800, - # GLM — GLM-5.2 ships with a 1M context window (verified empirically: - # needle-in-a-haystack retrieval at 789K prompt tokens succeeded with - # zero errors on api.z.ai/api/coding/paas/v4). Older GLM models - # (5, 5.1, 5-turbo) are ~202K. Longest-key-first substring matching - # ensures "glm-5.2" resolves to 1M while older variants still hit the - # generic 202K fallback. + # GLM — GLM-5.2 and GLM-5.3 ship with a 1M context window. GLM-5.2 was + # verified empirically (needle-in-a-haystack retrieval at 789K prompt + # tokens succeeded with zero errors on api.z.ai/api/coding/paas/v4). + # GLM-5.3 uses the same base model (all gains are post-training) with + # 1M context / 128K max output per docs.z.ai/guides/llm/glm-5.3 + # (verified 2026-08-14). Older GLM models (5, 5.1, 5-turbo) are ~202K. + # Longest-key-first substring matching ensures "glm-5.2"/"glm-5.3" + # resolve to 1M while older variants still hit the generic 202K fallback. "glm-5.2": 1_048_576, + "glm-5.3": 1_048_576, "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/auth.py b/hermes_cli/auth.py index 3da395831f43b..377552db740b6 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -724,8 +724,8 @@ ZAI_ENDPOINTS = [ # (id, base_url, probe_models, label) ("global", "https://api.z.ai/api/paas/v4", ["glm-5"], "Global"), ("cn", "https://open.bigmodel.cn/api/paas/v4", ["glm-5"], "China"), - ("coding-global", "https://api.z.ai/api/coding/paas/v4", ["glm-5.2", "glm-5.1", "glm-5v-turbo", "glm-4.7"], "Global (Coding Plan)"), - ("coding-cn", "https://open.bigmodel.cn/api/coding/paas/v4", ["glm-5.2", "glm-5.1", "glm-5v-turbo", "glm-4.7"], "China (Coding Plan)"), + ("coding-global", "https://api.z.ai/api/coding/paas/v4", ["glm-5.3", "glm-5.2", "glm-5.1", "glm-5v-turbo", "glm-4.7"], "Global (Coding Plan)"), + ("coding-cn", "https://open.bigmodel.cn/api/coding/paas/v4", ["glm-5.3", "glm-5.2", "glm-5.1", "glm-5v-turbo", "glm-4.7"], "China (Coding Plan)"), ] diff --git a/hermes_cli/models.py b/hermes_cli/models.py index 12ee2e714fb91..01ea2d89cf1a0 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -81,7 +81,8 @@ OPENROUTER_MODELS: list[tuple[str, str]] = [ # MiniMax ("minimax/minimax-m3", ""), # Z-AI - ("z-ai/glm-5.2", "default"), + ("z-ai/glm-5.3", "default"), + ("z-ai/glm-5.2", ""), ("z-ai/glm-5.1", ""), # Xiaomi ("xiaomi/mimo-v2.5-pro", ""), @@ -254,6 +255,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { # MiniMax "minimax/minimax-m3", # Z-AI + "z-ai/glm-5.3", "z-ai/glm-5.2", "z-ai/glm-5.1", # Xiaomi @@ -328,6 +330,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "gemini-3.1-flash-lite-preview", ], "zai": [ + "glm-5.3", "glm-5.2", "glm-5.1", "glm-5", @@ -345,6 +348,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning", # Third-party agentic models hosted on build.nvidia.com # (map to OpenRouter defaults — users get familiar picks on NIM) + "z-ai/glm-5.3", "z-ai/glm-5.2", "moonshotai/kimi-k2.6", "minimaxai/minimax-m3", @@ -480,6 +484,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "minimax-m3", "minimax-m2.7", "minimax-m2.5", + "glm-5.3", "glm-5.2", "glm-5.1", "glm-5", @@ -501,6 +506,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "kimi-k2.7-code", "kimi-k2.6", "kimi-k2.5", + "glm-5.3", "glm-5.2", "glm-5.1", "glm-5", diff --git a/plugins/model-providers/zai/__init__.py b/plugins/model-providers/zai/__init__.py index 76426b77dcdd5..0eca2a4dc727e 100644 --- a/plugins/model-providers/zai/__init__.py +++ b/plugins/model-providers/zai/__init__.py @@ -47,22 +47,28 @@ def _model_supports_thinking(model: str | None) -> bool: def _is_glm_5_2(model: str | None) -> bool: - """Detect GLM-5.2 across the alias spellings providers use. + """Detect GLM-5.2/5.3 (reasoning_effort-capable) across alias spellings. - Covers the canonical ``glm-5.2`` plus the ``glm-5-2`` / ``glm-5p2`` - variants seen on relays (Fireworks ``glm-5p2``, etc.) and any - vendor-prefixed form (``z-ai/glm-5.2``, ``zai-org-glm-5-2``). + Covers the canonical ``glm-5.2``/``glm-5.3`` plus the ``glm-5-2`` / + ``glm-5p2`` variants seen on relays (Fireworks ``glm-5p2``, etc.) and any + vendor-prefixed form (``z-ai/glm-5.2``, ``zai-org-glm-5-2``). GLM-5.3 + uses the same base model as 5.2 (post-training gains only) and exposes + the same ``reasoning_effort`` knob (verified live 2026-08-14: the + coding-plan endpoint accepts ``reasoning_effort: high`` for glm-5.3). """ m = (model or "").strip().lower() if not m: return False - return any(token in m for token in ("glm-5.2", "glm-5-2", "glm-5p2")) + return any( + token in m + for token in ("glm-5.2", "glm-5-2", "glm-5p2", "glm-5.3", "glm-5-3", "glm-5p3") + ) def _glm_5_2_reasoning_effort(reasoning_config: dict | None) -> str | None: - """Map Hermes reasoning effort onto GLM-5.2's native ``high``/``max``. + """Map Hermes reasoning effort onto GLM-5.2/5.3's native ``high``/``max``. - GLM-5.2 only supports two enabled effort levels. ``xhigh``/``max``/``ultra`` + These models only support two enabled effort levels. ``xhigh``/``max``/``ultra`` request the top tier; everything else that is enabled requests ``high`` (its minimum thinking level). When reasoning is explicitly disabled, or no effort preference is supplied, the server default is left untouched.