feat(providers): split zai into 4 plans (Global/China × direct API/Coding Plan) — salvage #13500 - #13911
Closed
kshitijk4poor wants to merge 3 commits into
Closed
feat(providers): split zai into 4 plans (Global/China × direct API/Coding Plan) — salvage #13500#13911kshitijk4poor wants to merge 3 commits into
kshitijk4poor wants to merge 3 commits into
Conversation
…ding Plan) Replace the single zai provider (with fragile runtime HTTP endpoint probing) with 4 explicit static providers: | Hermes id | Endpoint | Env var | |--------------------|-------------------------------------------|--------------------| | zai | api.z.ai/api/paas/v4 | ZAI_API_KEY | | zai-cn | open.bigmodel.cn/api/paas/v4 | GLM_API_KEY | | zai-coding-global | api.z.ai/api/coding/paas/v4 | ZAI_CODING_API_KEY | | zai-coding-cn | open.bigmodel.cn/api/coding/paas/v4 | GLM_CODING_API_KEY | - Remove detect_zai_endpoint / _resolve_zai_base_url (eliminates ~8s probes) - Thread 4 plans through auth, providers, models, status, doctor, setup, auxiliary routing, model normalization, trajectory compressor - Legacy GLM_API_KEY fallback on zai provider for upgrade safety - zai-cn declared before zai in registry so auto-detect with only GLM_API_KEY prefers the China plan (backward compat) Based on NousResearch#13500 by @yuanmingyi.
Hardcode the coding plan endpoint URLs in HERMES_OVERLAYS rather than relying solely on models.dev API responses. Matches the pattern used by zai and zai-cn direct plan overlays for resilience.
|
Both failing checks look unrelated to this PR — could someone confirm?
|
|
@kshitijk4poor hello, can you please tell what is blocking in detail or help to bypass the failing checks?
|
Contributor
|
Dont worry about the failing tests, and the supply chain audit is just for us to take more caution when reviewing |
|
I'll discard this PR and open a new PR with simpler changes (just one new zai coding plan provider added) at #34323 @teknium1 @alt-glitch |
13 tasks
11 tasks
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
Salvage of #13500 by @yuanmingyi — cherry-picked onto current
mainwith authorship preserved.Replaces the single
zaiprovider (which used fragile runtime HTTP endpoint probing viadetect_zai_endpoint) with 4 explicit static providers. Users pick their plan once; credentials resolve deterministically with no startup latency.zaiapi.z.ai/api/paas/v4ZAI_API_KEYzai-cnopen.bigmodel.cn/api/paas/v4GLM_API_KEYzai-coding-globalapi.z.ai/api/coding/paas/v4ZAI_CODING_API_KEYzai-coding-cnopen.bigmodel.cn/api/coding/paas/v4GLM_CODING_API_KEYChanges
hermes_cli/auth.py— 4 distinctPROVIDER_REGISTRYentries with per-plan env vars and static base URLs. Dropsdetect_zai_endpoint/_resolve_zai_base_url(eliminates ~8s probes).zai-cndeclared beforezaiso auto-detect with onlyGLM_API_KEYprefers China plan.hermes_cli/providers.py—HERMES_OVERLAYSgains 3 new entries. Aliases routeglm/zhipu→zai-cn;z-ai/z.ai→zai.agent/models_dev.py— maps each Hermes id to its models.dev catalog (zhipuai,zai-coding-plan,zhipuai-coding-plan)hermes_cli/models.py— curated model lists: direct plans (9 models), coding plans (4 coding-focused models)agent/auxiliary_client.py— aux model defaults per plan; vision model forzai/zai-cnrun_agent.py—_anthropic_preserve_dots()extended to all 4 planstrajectory_compressor.py— path-based provider disambiguation (fixes dead code that only compared hostnames)--providerchoices, qqbot STT adapterFollow-up fix
base_url_overrideto coding plan overlays inproviders.pyfor resilience (matches the pattern used by direct plan overlays rather than relying solely on models.dev)Compatibility
provider: zai+ onlyGLM_API_KEY→ key resolves via fallback tuple; request hitsapi.z.ai(may 401 if key was issued for bigmodel.cn — runninghermes modelre-picks the correct plan)provider: zai-cn+GLM_API_KEY→ cleanGLM_API_KEY→zai-cn(registry order ensures this)ZAI_API_KEYalways wins overGLM_API_KEYwhen both presentTesting
574 tests pass across the affected test files (1 deselected is pre-existing on
main):Closes #13500