Bug Description
The zai provider's _resolve_zai_base_url() function in hermes_cli/auth.py completely ignores the base_url configured in config.yaml. Instead, it probes a hardcoded list of 4 endpoints in order:
ZAI_ENDPOINTS = [
("global", "https://api.z.ai/api/paas/v4"),
("cn", "https://open.bigmodel.cn/api/paas/v4"),
("coding-global", "https://api.z.ai/api/coding/paas/v4"),
("coding-cn", "https://open.bigmodel.cn/api/coding/paas/v4"),
]
The same API key works on both standard and coding endpoints. Since probing takes the first endpoint that succeeds, standard endpoints always win — coding endpoints (positions 3-4) are unreachable.
Related issue #51229 addresses cache persistence but not the core problem: config.yaml's base_url field is ignored entirely.
Impact
Zhipu AI offers separate Coding Plan endpoints (/coding/paas/v4) with different quota/pricing. Users who configure base_url: https://open.bigmodel.cn/api/coding/paas/v4 in config.yaml expect all requests to go through that endpoint. Instead:
config.yaml's base_url is silently ignored
- Every gateway restart triggers endpoint probing
- Each probe sends a
glm-5, max_tokens=1 test request to the standard endpoint — wasting tokens
- The standard endpoint is always selected first
- All subsequent requests burn standard-endpoint quota
In a 20-profile deployment, switching from hindsight to openviking required gateway restarts that triggered mass re-probing, accidentally routing all traffic to standard endpoints for days before detection.
Workaround
Set environment variable GLM_BASE_URL (source line 670-671 in auth.py). This bypasses probing entirely:
if env_override:
return env_override
But this requires setting GLM_BASE_URL in every .env file, every systemd Environment= directive, AND every EnvironmentFile — because EnvironmentFile silently overrides Environment for same-named variables.
Expected Behavior
config.yaml's base_url should be respected as the authoritative endpoint. Probing should only be a fallback when base_url is not explicitly configured.
# Proposed priority:
# 1. GLM_BASE_URL env var (current — keep)
# 2. config.yaml base_url (NEW — currently ignored!)
# 3. auth.json cached detection (current — keep)
# 4. Live probing (current — last resort only)
Environment
- Hermes Agent: 0.18.0
- Provider: zai (Zhipu AI / Z.AI)
- Deployment: 20 profiles, all using GLM-5.2 via coding endpoint
- Issue discovered: 2026-06-27, affecting all 20 profiles
Bug Description
The
zaiprovider's_resolve_zai_base_url()function inhermes_cli/auth.pycompletely ignores thebase_urlconfigured inconfig.yaml. Instead, it probes a hardcoded list of 4 endpoints in order:The same API key works on both standard and coding endpoints. Since probing takes the first endpoint that succeeds, standard endpoints always win — coding endpoints (positions 3-4) are unreachable.
Related issue #51229 addresses cache persistence but not the core problem:
config.yaml'sbase_urlfield is ignored entirely.Impact
Zhipu AI offers separate Coding Plan endpoints (
/coding/paas/v4) with different quota/pricing. Users who configurebase_url: https://open.bigmodel.cn/api/coding/paas/v4inconfig.yamlexpect all requests to go through that endpoint. Instead:config.yaml'sbase_urlis silently ignoredglm-5, max_tokens=1test request to the standard endpoint — wasting tokensIn a 20-profile deployment, switching from hindsight to openviking required gateway restarts that triggered mass re-probing, accidentally routing all traffic to standard endpoints for days before detection.
Workaround
Set environment variable
GLM_BASE_URL(source line 670-671 inauth.py). This bypasses probing entirely:But this requires setting
GLM_BASE_URLin every.envfile, every systemdEnvironment=directive, AND everyEnvironmentFile— becauseEnvironmentFilesilently overridesEnvironmentfor same-named variables.Expected Behavior
config.yaml'sbase_urlshould be respected as the authoritative endpoint. Probing should only be a fallback whenbase_urlis not explicitly configured.Environment