Skip to content

Commit 483c67e

Browse files
authored
Merge pull request #350 from brt-h/feat/add-opus-4.5-openrouter
feat: Add Claude Opus 4.5 model via OpenRouter
2 parents cb97a89 + cf63fd2 commit 483c67e

3 files changed

Lines changed: 49 additions & 12 deletions

File tree

conf/openrouter_models.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@
2424
}
2525
},
2626
"models": [
27+
{
28+
"model_name": "anthropic/claude-opus-4.5",
29+
"aliases": [
30+
"opus",
31+
"opus4.5",
32+
"claude-opus"
33+
],
34+
"context_window": 200000,
35+
"max_output_tokens": 64000,
36+
"supports_extended_thinking": false,
37+
"supports_json_mode": false,
38+
"supports_function_calling": false,
39+
"supports_images": true,
40+
"max_image_size_mb": 5.0,
41+
"description": "Claude Opus 4.5 - Anthropic's frontier reasoning model for complex software engineering and agentic workflows",
42+
"intelligence_score": 18
43+
},
2744
{
2845
"model_name": "anthropic/claude-sonnet-4.5",
2946
"aliases": [
@@ -43,8 +60,7 @@
4360
{
4461
"model_name": "anthropic/claude-opus-4.1",
4562
"aliases": [
46-
"opus",
47-
"claude-opus"
63+
"opus4.1"
4864
],
4965
"context_window": 200000,
5066
"max_output_tokens": 64000,
@@ -53,7 +69,7 @@
5369
"supports_function_calling": false,
5470
"supports_images": true,
5571
"max_image_size_mb": 5.0,
56-
"description": "Claude Opus 4.1 - Our most capable and intelligent model yet",
72+
"description": "Claude Opus 4.1 - Last generation flagship model with strong coding and reasoning",
5773
"intelligence_score": 14
5874
},
5975
{

tests/test_openrouter_provider.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def test_model_alias_resolution(self):
7979
provider = OpenRouterProvider(api_key="test-key")
8080

8181
# Test alias resolution
82-
assert provider._resolve_model_name("opus") == "anthropic/claude-opus-4.1"
82+
assert provider._resolve_model_name("opus") == "anthropic/claude-opus-4.5"
83+
assert provider._resolve_model_name("opus4.5") == "anthropic/claude-opus-4.5"
84+
assert provider._resolve_model_name("opus4.1") == "anthropic/claude-opus-4.1"
8385
assert provider._resolve_model_name("sonnet") == "anthropic/claude-sonnet-4.5"
8486
assert provider._resolve_model_name("sonnet4.1") == "anthropic/claude-sonnet-4.1"
8587
assert provider._resolve_model_name("o3") == "openai/o3"
@@ -96,7 +98,7 @@ def test_model_alias_resolution(self):
9698
assert provider._resolve_model_name("r1") == "deepseek/deepseek-r1-0528"
9799

98100
# Test case-insensitive
99-
assert provider._resolve_model_name("OPUS") == "anthropic/claude-opus-4.1"
101+
assert provider._resolve_model_name("OPUS") == "anthropic/claude-opus-4.5"
100102
assert provider._resolve_model_name("SONNET") == "anthropic/claude-sonnet-4.5"
101103
assert provider._resolve_model_name("O3") == "openai/o3"
102104
assert provider._resolve_model_name("Mistral") == "mistralai/mistral-large-2411"
@@ -305,17 +307,32 @@ def test_registry_capabilities(self):
305307

306308
registry = OpenRouterModelRegistry()
307309

308-
# Test known model
310+
# Test known model (opus alias now points to 4.5)
309311
caps = registry.get_capabilities("opus")
310312
assert caps is not None
311-
assert caps.model_name == "anthropic/claude-opus-4.1"
313+
assert caps.model_name == "anthropic/claude-opus-4.5"
312314
assert caps.context_window == 200000 # Claude's context window
313315

314-
# Test using full model name
316+
# Test using full model name for 4.5
317+
caps = registry.get_capabilities("anthropic/claude-opus-4.5")
318+
assert caps is not None
319+
assert caps.model_name == "anthropic/claude-opus-4.5"
320+
321+
# Test opus4.5 alias
322+
caps = registry.get_capabilities("opus4.5")
323+
assert caps is not None
324+
assert caps.model_name == "anthropic/claude-opus-4.5"
325+
326+
# Test using full model name for 4.1
315327
caps = registry.get_capabilities("anthropic/claude-opus-4.1")
316328
assert caps is not None
317329
assert caps.model_name == "anthropic/claude-opus-4.1"
318330

331+
# Test opus4.1 alias still works
332+
caps = registry.get_capabilities("opus4.1")
333+
assert caps is not None
334+
assert caps.model_name == "anthropic/claude-opus-4.1"
335+
319336
# Test unknown model
320337
caps = registry.get_capabilities("non-existent-model")
321338
assert caps is None

tests/test_openrouter_registry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ def test_alias_resolution(self):
8888

8989
# Test various aliases
9090
test_cases = [
91-
("opus", "anthropic/claude-opus-4.1"),
92-
("OPUS", "anthropic/claude-opus-4.1"), # Case insensitive
91+
("opus", "anthropic/claude-opus-4.5"), # opus now points to 4.5
92+
("OPUS", "anthropic/claude-opus-4.5"), # Case insensitive
93+
("claude-opus", "anthropic/claude-opus-4.5"),
94+
("opus4.5", "anthropic/claude-opus-4.5"),
95+
("opus4.1", "anthropic/claude-opus-4.1"), # 4.1 still accessible
9396
("sonnet", "anthropic/claude-sonnet-4.5"),
9497
("o3", "openai/o3"),
9598
("deepseek", "deepseek/deepseek-r1-0528"),
@@ -131,9 +134,10 @@ def test_model_capabilities_conversion(self):
131134
assert config is not None
132135

133136
# Registry now returns ModelCapabilities objects directly
137+
# opus alias now points to 4.5
134138
assert config.provider == ProviderType.OPENROUTER
135-
assert config.model_name == "anthropic/claude-opus-4.1"
136-
assert config.friendly_name == "OpenRouter (anthropic/claude-opus-4.1)"
139+
assert config.model_name == "anthropic/claude-opus-4.5"
140+
assert config.friendly_name == "OpenRouter (anthropic/claude-opus-4.5)"
137141
assert config.context_window == 200000
138142
assert not config.supports_extended_thinking
139143

0 commit comments

Comments
 (0)