fix: narrow Anthropic adapter dot-mangling to Claude models only (#17171)#17290
Closed
vominh1919 wants to merge 1 commit into
Closed
fix: narrow Anthropic adapter dot-mangling to Claude models only (#17171)#17290vominh1919 wants to merge 1 commit into
vominh1919 wants to merge 1 commit into
Conversation
The normalize_model_name() function unconditionally converted dots to hyphens in all model names. This caused non-Anthropic models (e.g. gpt-5.4) to be mangled to gpt-5-4 when routed through the Anthropic adapter path, resulting in HTTP 404 from the backend. Now only applies dot-to-hyphen conversion for models starting with "claude-" or "anthropic/", which are the actual Anthropic model IDs. Fixes NousResearch#17171 Related: NousResearch#7421, NousResearch#13061, NousResearch#16417
Collaborator
8 tasks
Contributor
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.
Problem
normalize_model_name()inagent/anthropic_adapter.pyunconditionally converts dots to hyphens in all model names (line 1117). This causes non-Anthropic models to be mangled when routed through the Anthropic adapter path:gpt-5.4→gpt-5-4→ HTTP 404 from Codex backendgemini-2.5-pro→gemini-2-5-pro→ would fail similarlyThis affects the webui session route when
resolve_model_provider()doesn't infer the provider from the model name, and the Anthropic adapter is auto-selected as default.Fix
Added a guard in
normalize_model_name()to only apply dot→hyphen conversion for models that look like Anthropic models (claude-*oranthropic/*). Non-Anthropic models pass through unchanged.Before:
After:
Before vs After
claude-opus-4.6claude-opus-4-6✓claude-opus-4-6✓anthropic/claude-sonnet-4.5claude-sonnet-4-5✓claude-sonnet-4-5✓gpt-5.4gpt-5-4✗gpt-5.4✓gemini-2.5-progemini-2-5-pro✗gemini-2.5-pro✓Tests
All existing tests pass — they all use Claude model names which still get dot→hyphen conversion.
Fixes #17171
Related: #7421, #13061, #16417