Merge pull request #350 from brt-h/feat/add-opus-4.5-openrouter
feat: Add Claude Opus 4.5 model via OpenRouter
This commit is contained in:
@@ -79,7 +79,9 @@ class TestOpenRouterProvider:
|
||||
provider = OpenRouterProvider(api_key="test-key")
|
||||
|
||||
# Test alias resolution
|
||||
assert provider._resolve_model_name("opus") == "anthropic/claude-opus-4.1"
|
||||
assert provider._resolve_model_name("opus") == "anthropic/claude-opus-4.5"
|
||||
assert provider._resolve_model_name("opus4.5") == "anthropic/claude-opus-4.5"
|
||||
assert provider._resolve_model_name("opus4.1") == "anthropic/claude-opus-4.1"
|
||||
assert provider._resolve_model_name("sonnet") == "anthropic/claude-sonnet-4.5"
|
||||
assert provider._resolve_model_name("sonnet4.1") == "anthropic/claude-sonnet-4.1"
|
||||
assert provider._resolve_model_name("o3") == "openai/o3"
|
||||
@@ -96,7 +98,7 @@ class TestOpenRouterProvider:
|
||||
assert provider._resolve_model_name("r1") == "deepseek/deepseek-r1-0528"
|
||||
|
||||
# Test case-insensitive
|
||||
assert provider._resolve_model_name("OPUS") == "anthropic/claude-opus-4.1"
|
||||
assert provider._resolve_model_name("OPUS") == "anthropic/claude-opus-4.5"
|
||||
assert provider._resolve_model_name("SONNET") == "anthropic/claude-sonnet-4.5"
|
||||
assert provider._resolve_model_name("O3") == "openai/o3"
|
||||
assert provider._resolve_model_name("Mistral") == "mistralai/mistral-large-2411"
|
||||
@@ -305,17 +307,32 @@ class TestOpenRouterRegistry:
|
||||
|
||||
registry = OpenRouterModelRegistry()
|
||||
|
||||
# Test known model
|
||||
# Test known model (opus alias now points to 4.5)
|
||||
caps = registry.get_capabilities("opus")
|
||||
assert caps is not None
|
||||
assert caps.model_name == "anthropic/claude-opus-4.1"
|
||||
assert caps.model_name == "anthropic/claude-opus-4.5"
|
||||
assert caps.context_window == 200000 # Claude's context window
|
||||
|
||||
# Test using full model name
|
||||
# Test using full model name for 4.5
|
||||
caps = registry.get_capabilities("anthropic/claude-opus-4.5")
|
||||
assert caps is not None
|
||||
assert caps.model_name == "anthropic/claude-opus-4.5"
|
||||
|
||||
# Test opus4.5 alias
|
||||
caps = registry.get_capabilities("opus4.5")
|
||||
assert caps is not None
|
||||
assert caps.model_name == "anthropic/claude-opus-4.5"
|
||||
|
||||
# Test using full model name for 4.1
|
||||
caps = registry.get_capabilities("anthropic/claude-opus-4.1")
|
||||
assert caps is not None
|
||||
assert caps.model_name == "anthropic/claude-opus-4.1"
|
||||
|
||||
# Test opus4.1 alias still works
|
||||
caps = registry.get_capabilities("opus4.1")
|
||||
assert caps is not None
|
||||
assert caps.model_name == "anthropic/claude-opus-4.1"
|
||||
|
||||
# Test unknown model
|
||||
caps = registry.get_capabilities("non-existent-model")
|
||||
assert caps is None
|
||||
|
||||
@@ -88,8 +88,11 @@ class TestOpenRouterModelRegistry:
|
||||
|
||||
# Test various aliases
|
||||
test_cases = [
|
||||
("opus", "anthropic/claude-opus-4.1"),
|
||||
("OPUS", "anthropic/claude-opus-4.1"), # Case insensitive
|
||||
("opus", "anthropic/claude-opus-4.5"), # opus now points to 4.5
|
||||
("OPUS", "anthropic/claude-opus-4.5"), # Case insensitive
|
||||
("claude-opus", "anthropic/claude-opus-4.5"),
|
||||
("opus4.5", "anthropic/claude-opus-4.5"),
|
||||
("opus4.1", "anthropic/claude-opus-4.1"), # 4.1 still accessible
|
||||
("sonnet", "anthropic/claude-sonnet-4.5"),
|
||||
("o3", "openai/o3"),
|
||||
("deepseek", "deepseek/deepseek-r1-0528"),
|
||||
@@ -131,9 +134,10 @@ class TestOpenRouterModelRegistry:
|
||||
assert config is not None
|
||||
|
||||
# Registry now returns ModelCapabilities objects directly
|
||||
# opus alias now points to 4.5
|
||||
assert config.provider == ProviderType.OPENROUTER
|
||||
assert config.model_name == "anthropic/claude-opus-4.1"
|
||||
assert config.friendly_name == "OpenRouter (anthropic/claude-opus-4.1)"
|
||||
assert config.model_name == "anthropic/claude-opus-4.5"
|
||||
assert config.friendly_name == "OpenRouter (anthropic/claude-opus-4.5)"
|
||||
assert config.context_window == 200000
|
||||
assert not config.supports_extended_thinking
|
||||
|
||||
|
||||
Reference in New Issue
Block a user