Skip to content

fix(zai): add fetch_models override for GLM-5.2 + base_url fix - #46666

Open
ether-btc wants to merge 1 commit into
NousResearch:mainfrom
ether-btc:fix/zai-clean-pr
Open

fix(zai): add fetch_models override for GLM-5.2 + base_url fix#46666
ether-btc wants to merge 1 commit into
NousResearch:mainfrom
ether-btc:fix/zai-clean-pr

Conversation

@ether-btc

Copy link
Copy Markdown
Contributor

Problem

GLM-5.2 and several GLM-4.5 variants work via /chat/completions but are absent from the /models catalog endpoint. Without a fetch_models override, the model picker silently drops these models — the user can't select them even though they're functional.

Changes (1 file, +40/-2)

plugins/model-providers/zai/__init__.py:

  1. Add ZAIProfile(ProviderProfile) with a fetch_models() override that:

    • Fetches the live catalog via super().fetch_models()
    • Merges it with a curated _EXTRA_MODELS set (8 known-working models)
    • Falls back to the full _EXTRA_MODELS list if the catalog is unreachable
  2. Fix base_url: /api/paas/v4/api/coding/paas/v4

  3. Expand fallback_models: added glm-4.5, glm-4.5-air, glm-4.5-flash

Verification

Tested on a Raspberry Pi 5 running Hermes Agent. GLM-5.2 is the daily driver model — it works reliably via /chat/completions but was invisible in the model picker until this fix was applied.


Replaces #46615 (closed — that branch carried 146 unrelated file changes from a stale fork point). This PR is a clean cherry-pick against latest main.

- Add ZAIProfile class overriding fetch_models to merge live catalog with
  known working models (GLM-5.2, GLM-4.5 variants) absent from /models endpoint
- Fix base_url to match config (coding/paas/v4)
- Resolves silent capability loss where GLM-5.2 works via chat/completions
  but was missing from model picker
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins provider/zai ZAI provider labels Jun 15, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused cleanup. The primary picker regression has been addressed on current main by the shared catalog path: 630b43892d7e795f7ebf84b0d9ea8f0428a3692b added live-plus-curated merging, now implemented at hermes_cli/models.py:2485-2517; the Z.AI curated list already includes glm-5.2, glm-4.5, and glm-4.5-flash at hermes_cli/models.py:299-308.

Problems

  • The proposed ZAIProfile.fetch_models() does not accept base_url, but current main calls it with base_url=... at hermes_cli/models.py:2485. Applied unchanged, authenticated Z.AI picker discovery would raise TypeError; it also would not forward a resolved custom endpoint to ProviderProfile.fetch_models().
  • Changing plugins/model-providers/zai/__init__.py's base_url does not change the runtime Z.AI default: runtime resolution uses hermes_cli/auth.py:243-250 and hermes_cli/auth.py:6462-6463.

Suggested changes

  • Re-scope to any verified remaining IDs absent from the shared curated Z.AI catalog (for example, glm-4.5-air / glm-4.6 if confirmed), rather than duplicating the generic merge mechanism.
  • If an override remains necessary, preserve and forward base_url and add a focused regression test.

Automated hermes-sweeper review.

class ZAIProfile(ProviderProfile):
"""Z.AI / GLM provider with extended model catalog."""

def fetch_models(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main calls provider profiles as _p.fetch_models(api_key=..., base_url=...) in hermes_cli/models.py:2485. This override must accept base_url and forward it to super().fetch_models(); otherwise authenticated Z.AI picker discovery raises TypeError and ignores a resolved custom/coding endpoint.

@@ -14,8 +49,11 @@
"glm-5.2",
"glm-5",
"glm-4-9b",
"glm-4.5",
"glm-4.5-air",
"glm-4.5-flash",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This profile field is not the runtime Z.AI endpoint source: resolve_api_key_provider_credentials() derives the default from hermes_cli/auth.py's PROVIDER_REGISTRY and _resolve_zai_base_url(). Changing this line alone will not route normal Z.AI inference to the coding endpoint.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@ether-btc
ether-btc force-pushed the fix/zai-clean-pr branch 2 times, most recently from 3366d73 to c4adb08 Compare July 26, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/zai ZAI provider sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants