feat(auxiliary): add zhipuai alias to PROVIDER_REGISTRY and _PROVIDER_ALIASES#27323
Open
zccyman wants to merge 1 commit into
Open
feat(auxiliary): add zhipuai alias to PROVIDER_REGISTRY and _PROVIDER_ALIASES#27323zccyman wants to merge 1 commit into
zccyman wants to merge 1 commit into
Conversation
This comment was marked as spam.
This comment was marked as spam.
…_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
47da46a to
b2ff4a7
Compare
Contributor
|
Thanks for the focused Z.AI/ZhipuAI alias cleanup. I verified the core premise is still real on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
zhipuaias a recognized provider alias for Z.AI / GLM in both_PROVIDER_ALIASES(auxiliary client) and_PROVIDER_ALIASES(auth), and addZHIPUAI_API_KEYto the zai provider'sapi_key_env_varstuple.Closes #26880
Problem
Users who want to use GLM/ZhipuAI as a first-class auxiliary provider currently need complex workarounds:
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:
API key is auto-resolved from
GLM_API_KEY/ZAI_API_KEY/ZHIPUAI_API_KEY; base_url auto-resolved fromPROVIDER_REGISTRY.The existing normalization chain (
_normalize_aux_provider→_PROVIDER_ALIASES→ "zai") already handlesglmandzhipu. This PR adds the missingzhipuaialias in both alias maps and addsZHIPUAI_API_KEYto the recognized env vars.Files Changed
agent/auxiliary_client.py"zhipuai": "zai"to_PROVIDER_ALIASEShermes_cli/auth.py"zhipuai": "zai"to_PROVIDER_ALIASES; addZHIPUAI_API_KEYto zaiapi_key_env_varstests/agent/test_auxiliary_client.pytest_maps_zai_glm_aliasestests/hermes_cli/test_api_key_providers.pytest_zai_env_varsexpectationTest Results
Design Decisions
zaiprovider already exists with correct config. The alias system (_PROVIDER_ALIASES) is the right place to add name variants since both_normalize_aux_providerand the auth provider resolver use it.zhipuaiwas chosen as the new alias because it matches the official platform name (ZhipuAI / 智谱AI).