fix: normalize dot-versioned model names for Anthropic API
anthropic/claude-opus-4.6 (OpenRouter format) was being sent as claude-opus-4.6 to the Anthropic API, which expects claude-opus-4-6 (hyphens, not dots). normalize_model_name() now converts dots to hyphens after stripping the provider prefix, matching Anthropic's naming convention. Fixes 404: 'model: claude-opus-4.6 was not found'
This commit is contained in:
parent
1a5f31d631
commit
ef3f3f9c08
2 changed files with 16 additions and 0 deletions
|
|
@ -351,6 +351,17 @@ class TestNormalizeModelName:
|
|||
def test_leaves_bare_name(self):
|
||||
assert normalize_model_name("claude-sonnet-4-20250514") == "claude-sonnet-4-20250514"
|
||||
|
||||
def test_converts_dots_to_hyphens(self):
|
||||
"""OpenRouter uses dots (4.6), Anthropic uses hyphens (4-6)."""
|
||||
assert normalize_model_name("anthropic/claude-opus-4.6") == "claude-opus-4-6"
|
||||
assert normalize_model_name("anthropic/claude-sonnet-4.5") == "claude-sonnet-4-5"
|
||||
assert normalize_model_name("claude-opus-4.6") == "claude-opus-4-6"
|
||||
|
||||
def test_already_hyphenated_unchanged(self):
|
||||
"""Names already in Anthropic format should pass through."""
|
||||
assert normalize_model_name("claude-opus-4-6") == "claude-opus-4-6"
|
||||
assert normalize_model_name("claude-opus-4-5-20251101") == "claude-opus-4-5-20251101"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tool conversion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue