fix: strip provider prefix from model name in /model command#8059
Open
tomqiaozc wants to merge 1 commit into
Open
fix: strip provider prefix from model name in /model command#8059tomqiaozc wants to merge 1 commit into
tomqiaozc wants to merge 1 commit into
Conversation
When switching to a non-curated model via /model provider/name, the provider prefix was stored verbatim in the session override, causing HTTP 400 from the provider API. Extract and strip the prefix when it matches a known provider (non-aggregator only, since aggregators use vendor/model as the expected slug format). Also update the stale zai curated model list with glm-5.1, glm-4.6, and glm-4.5-air. Fixes NousResearch#7922 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Related to #6211 — same root cause (Z.AI provider prefix not stripped). This PR adds the fallback stripping logic for unlisted models. |
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
/model zai/glm-5.1, thezai/prefix was stored verbatim in the session override, causing the provider API to reject it with HTTP 400 ("Unknown Model"). This happened becausedetect_provider_for_model()returned None for models not in the curated list, sonormalize_model_for_provider()didn't know which prefix to strip./prefix matching a known provider (via_PROVIDER_MODELSor_PROVIDER_ALIASES), extract it as the target provider and strip the prefix. Skips this for aggregator providers (OpenRouter etc.) wherevendor/modelis the expected slug format.glm-5.1,glm-4.6, andglm-4.5-air.Fixes #7922
Test plan
test_switch_model_strips_provider_prefix_for_unlisted_model— verifieszai/glm-5.1becomesglm-5.1with providerzai🤖 Generated with Claude Code