Skip to content

feat(auxiliary): add zhipuai alias to PROVIDER_REGISTRY and _PROVIDER_ALIASES#27323

Open
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:feat/glm-auxiliary-provider-26880
Open

feat(auxiliary): add zhipuai alias to PROVIDER_REGISTRY and _PROVIDER_ALIASES#27323
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:feat/glm-auxiliary-provider-26880

Conversation

@zccyman

@zccyman zccyman commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Add zhipuai as a recognized provider alias for Z.AI / GLM in both _PROVIDER_ALIASES (auxiliary client) and _PROVIDER_ALIASES (auth), and add ZHIPUAI_API_KEY to the zai provider's api_key_env_vars tuple.

Closes #26880

Problem

Users who want to use GLM/ZhipuAI as a first-class auxiliary provider currently need complex workarounds:

auxiliary:
  vision:
    provider: custom
    base_url: https://open.bigmodel.cn/api/paas/v4
    api_key: <key>

This triggers the "custom" provider branch, which strips the provider identity, breaks provider-specific logic downstream (e.g., max_tokens skip for vision), and requires manual key config.

Solution

After this PR, users can simply write:

auxiliary:
  vision:
    provider: zhipuai   # or: glm, zhipu, z-ai, z.ai
    model: glm-4v-flash

API key is auto-resolved from GLM_API_KEY / ZAI_API_KEY / ZHIPUAI_API_KEY; base_url auto-resolved from PROVIDER_REGISTRY.

The existing normalization chain (_normalize_aux_provider_PROVIDER_ALIASES → "zai") already handles glm and zhipu. This PR adds the missing zhipuai alias in both alias maps and adds ZHIPUAI_API_KEY to the recognized env vars.

Files Changed

File Change
agent/auxiliary_client.py Add "zhipuai": "zai" to _PROVIDER_ALIASES
hermes_cli/auth.py Add "zhipuai": "zai" to _PROVIDER_ALIASES; add ZHIPUAI_API_KEY to zai api_key_env_vars
tests/agent/test_auxiliary_client.py New test test_maps_zai_glm_aliases
tests/hermes_cli/test_api_key_providers.py Update test_zai_env_vars expectation

Test Results

tests/agent/test_auxiliary_client.py::TestNormalizeAuxProvider::test_maps_zai_glm_aliases PASSED
tests/hermes_cli/test_api_key_providers.py -k "zai" 11 passed

Design Decisions

  • No new PROVIDER_REGISTRY entry was added. The zai provider already exists with correct config. The alias system (_PROVIDER_ALIASES) is the right place to add name variants since both _normalize_aux_provider and the auth provider resolver use it.
  • zhipuai was chosen as the new alias because it matches the official platform name (ZhipuAI / 智谱AI).

@cardtest15-coder

This comment was marked as spam.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have provider/zai ZAI provider comp/agent Core agent loop, run_agent.py, prompt builder area/auth Authentication, OAuth, credential pools labels May 17, 2026
…_ALIASES

Add 'zhipuai' as a recognized provider alias for Z.AI / GLM, alongside
the existing 'glm', 'zhipu', 'z-ai', and 'z.ai' aliases. Users can now
configure:

  auxiliary:
    vision:
      provider: zhipuai  # or 'zhipu', 'glm', 'z-ai', 'z.ai'
      model: glm-4v-flash

without needing a custom base_url + api_key.

Changes:
- agent/auxiliary_client.py: add 'zhipuai' → 'zai' to _PROVIDER_ALIASES
- hermes_cli/auth.py: add 'zhipuai' → 'zai' to _PROVIDER_ALIASES;
  add ZHIPUAI_API_KEY to zai provider's api_key_env_vars tuple
- tests: verify all Z.AI / GLM aliases normalize to 'zai';
  update test_zai_env_vars expectation

Closes NousResearch#26880
@zccyman zccyman force-pushed the feat/glm-auxiliary-provider-26880 branch from 47da46a to b2ff4a7 Compare May 18, 2026 00:35
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Z.AI/ZhipuAI alias cleanup. I verified the core premise is still real on current main: agent/auxiliary_client.py:131 and hermes_cli/auth.py:1501 map glm/zhipu to zai but not zhipuai, and hermes_cli/auth.py:240 does not include ZHIPUAI_API_KEY.

Problems

  • The alias update is incomplete across current provider surfaces. hermes_cli/providers.py:240 and hermes_cli/models.py:1158 also carry the Z.AI alias set (glm, z-ai, z.ai, zhipu) and would still omit zhipuai.
  • The PR does not add direct auth-path tests for the new alias/env var. Existing tests cover resolve_provider("glm"), resolve_provider("z-ai"), and resolve_provider("zhipu") at tests/hermes_cli/test_api_key_providers.py:181, plus env auto-detection for GLM/ZAI/Z_AI at tests/hermes_cli/test_api_key_providers.py:248.

Suggested changes

  • Add "zhipuai": "zai" to hermes_cli/providers.py and hermes_cli/models.py as well.
  • Add tests for resolve_provider("zhipuai") == "zai" and auto-detection from ZHIPUAI_API_KEY.

Automated hermes-sweeper review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have provider/zai ZAI provider type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add GLM (ZhipuAI) as first-class auxiliary provider

4 participants