fix(zai): add fetch_models override for GLM-5.2 + base_url fix - #46666
fix(zai): add fetch_models override for GLM-5.2 + base_url fix#46666ether-btc wants to merge 1 commit into
Conversation
- 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
teknium1
left a comment
There was a problem hiding this comment.
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 acceptbase_url, but current main calls it withbase_url=...athermes_cli/models.py:2485. Applied unchanged, authenticated Z.AI picker discovery would raiseTypeError; it also would not forward a resolved custom endpoint toProviderProfile.fetch_models(). - Changing
plugins/model-providers/zai/__init__.py'sbase_urldoes not change the runtime Z.AI default: runtime resolution useshermes_cli/auth.py:243-250andhermes_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.6if confirmed), rather than duplicating the generic merge mechanism. - If an override remains necessary, preserve and forward
base_urland add a focused regression test.
Automated hermes-sweeper review.
| class ZAIProfile(ProviderProfile): | ||
| """Z.AI / GLM provider with extended model catalog.""" | ||
|
|
||
| def fetch_models( |
There was a problem hiding this comment.
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", | |||
There was a problem hiding this comment.
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.
3366d73 to
c4adb08
Compare
Problem
GLM-5.2 and several GLM-4.5 variants work via
/chat/completionsbut are absent from the/modelscatalog endpoint. Without afetch_modelsoverride, 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:Add
ZAIProfile(ProviderProfile)with afetch_models()override that:super().fetch_models()_EXTRA_MODELSset (8 known-working models)_EXTRA_MODELSlist if the catalog is unreachableFix
base_url:/api/paas/v4→/api/coding/paas/v4Expand
fallback_models: addedglm-4.5,glm-4.5-air,glm-4.5-flashVerification
Tested on a Raspberry Pi 5 running Hermes Agent. GLM-5.2 is the daily driver model — it works reliably via
/chat/completionsbut 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.