feat: first-class glm/zhipu provider alias + model-name inference#247
Merged
warren618 merged 1 commit intoJun 16, 2026
Merged
Conversation
Add a first-class `glm` alias of the existing `zhipu` provider so a model name like `glm-4.6`/`glm-5.1` resolves to the Zhipu capability record and base URL instead of silently falling back to the OpenAI slot. - capabilities.py: share one `_ZHIPU_CAPABILITIES` record between `zhipu` and the new `glm` alias (mirrors kimi/moonshot), and infer `zhipu` for model ids starting with `glm`. - llm_providers.json: register a `glm` entry aliasing the Zhipu env names and default model so onboarding/diagnostics surface it. - tests: cover the alias, model-name inference, env-name resolution, the unchanged openai fallback, and the new registry default. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Contributor
Author
|
Thanks for merging this, @warren618. A first-class glm alias for the zhipu provider plus model-name handling is a nice convenience. |
Contributor
Author
|
Thanks @warren618 - the first-class glm alias plus model-name inference means GLM/Zhipu users no longer have to borrow the openai config. |
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
This adds a first-class
glmprovider alias of the existingzhipuprovider, plus model-name inference, so GLM / Zhipu coding-plan users no longer have to borrow theopenaislot. When the model name starts withglm, the agent now resolves the Zhipu provider and its base URL automatically even if no explicit provider is configured.Why
This closes #237, where a user asked for first-class GLM / Zhipu support and you confirmed that a dedicated
glm/zhipualias, so people do not have to borrow theopenaislot, would be a very welcome PR, pointing at the provider layer.The problem today is silent and confusing. A
zhipuprovider already exists, but there is noglmalias and nothing that infers the provider from the model name. So a user who sets only their model toglm-4.6orglm-5.1falls through to the OpenAI capability record and gets pointed at the OpenAI base URL, with no error to explain why their GLM key is being ignored. Makingglma real alias and teaching the inference path about it removes that footgun and matches what the issue actually asked for.Changes
The change follows the existing
kimitomoonshotalias precedent exactly. The Zhipu capability record is now shared between the canonicalzhipuprovider and the newglmalias, the model-name inference path maps anyglm-prefixed model back to Zhipu, and the provider registry gains aglmentry that reuses the same Zhipu environment variables and default model so onboarding and diagnostics surface it. Tests cover the alias, bothglm-4.6andglm-5.1inference, the environment-name resolution, and confirm that an unknown or empty model still falls back to OpenAI.Two things are deliberately left out of scope. Coding-plan-specific request headers are not added here, because those need the exact 400 payload from the coding endpoint and a separate shape decision, the same situation as the Kimi For-Coding work in #204. The alias is also not added to the CLI status and choice maps, since the canonical
zhipualready covers those displays, mirroring howkimidefers tomoonshotthere.Test Plan
TestProviderCapabilityAliasesclass plus the provider-defaults regression, 9 passing).ruff checkis clean on the changed files.The
build_llmtests that import the optionallangchain-openaidependency were not run here because it is not installed in this environment; the same five errors are present on a pristinemaincheckout, so they are pre-existing and unrelated to this change.Checklist
Fixes #237