Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit 850eebc

Browse files
authored
Merge pull request #106 from Not-Diamond/ENG-3520_add-support-claude-sonnet-4.5
feat: Add support for claude-sonnet-4.5 model
2 parents 73f4cf5 + 32af8f8 commit 850eebc

5 files changed

Lines changed: 364 additions & 0 deletions

File tree

notdiamond/llms/providers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class NDLLMProviders(Enum):
4242
CLAUDE_OPUS_4_20250514 (NDLLMProvider): refers to 'claude-opus-4-20250514' model by Anthropic
4343
CLAUDE_OPUS_4_1_20250805 (NDLLMProvider): refers to 'claude-opus-4-1-20250805' model by Anthropic
4444
CLAUDE_SONNET_4_20250514 (NDLLMProvider): refers to 'claude-sonnet-4-20250514' model by Anthropic
45+
CLAUDE_SONNET_4_5 (NDLLMProvider): refers to 'claude-sonnet-4-5' model by Anthropic
46+
CLAUDE_SONNET_4_5_20250929 (NDLLMProvider): refers to 'claude-sonnet-4-5-20250929' model by Anthropic
4547
CLAUDE_OPUS_4_0 (NDLLMProvider): refers to 'claude-opus-4-0' model by Anthropic
4648
CLAUDE_OPUS_4_1 (NDLLMProvider): refers to 'claude-opus-4-1' model by Anthropic
4749
CLAUDE_SONNET_4_0 (NDLLMProvider): refers to 'claude-sonnet-4-0' model by Anthropic
@@ -130,6 +132,8 @@ class NDLLMProviders(Enum):
130132
CLAUDE_OPUS_4_20250514 = ("anthropic", "claude-opus-4-20250514")
131133
CLAUDE_OPUS_4_1_20250805 = ("anthropic", "claude-opus-4-1-20250805")
132134
CLAUDE_SONNET_4_20250514 = ("anthropic", "claude-sonnet-4-20250514")
135+
CLAUDE_SONNET_4_5 = ("anthropic", "claude-sonnet-4-5")
136+
CLAUDE_SONNET_4_5_20250929 = ("anthropic", "claude-sonnet-4-5-20250929")
133137
CLAUDE_OPUS_4_0 = ("anthropic", "claude-opus-4-0")
134138
CLAUDE_OPUS_4_1 = ("anthropic", "claude-opus-4-1")
135139
CLAUDE_SONNET_4_0 = ("anthropic", "claude-sonnet-4-0")

notdiamond/settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@
156156
"claude-opus-4-20250514",
157157
"claude-opus-4-1-20250805",
158158
"claude-sonnet-4-20250514",
159+
"claude-sonnet-4-5",
160+
"claude-sonnet-4-5-20250929",
159161
"claude-opus-4-0",
160162
"claude-opus-4-1",
161163
"claude-sonnet-4-0",
@@ -174,6 +176,8 @@
174176
"claude-opus-4-20250514",
175177
"claude-opus-4-1-20250805",
176178
"claude-sonnet-4-20250514",
179+
"claude-sonnet-4-5",
180+
"claude-sonnet-4-5-20250929",
177181
"claude-opus-4-0",
178182
"claude-opus-4-1",
179183
"claude-sonnet-4-0",
@@ -195,6 +199,8 @@
195199
"claude-opus-4-20250514": "anthropic/claude-opus-4",
196200
"claude-opus-4-1-20250805": "anthropic/claude-opus-4-1-20250805",
197201
"claude-sonnet-4-20250514": "anthropic/claude-sonnet-4",
202+
"claude-sonnet-4-5": "anthropic/claude-sonnet-4-5",
203+
"claude-sonnet-4-5-20250929": "anthropic/claude-sonnet-4-5",
198204
"claude-opus-4-0": "anthropic/claude-opus-4",
199205
"claude-opus-4-1": "anthropic/claude-opus-4-1",
200206
"claude-sonnet-4-0": "anthropic/claude-sonnet-4",
@@ -213,6 +219,8 @@
213219
"claude-opus-4-20250514": {"input": 15.0, "output": 75.0},
214220
"claude-opus-4-1-20250805": {"input": 15.0, "output": 75.0},
215221
"claude-sonnet-4-20250514": {"input": 3.0, "output": 15.0},
222+
"claude-sonnet-4-5": {"input": 3.0, "output": 15.0},
223+
"claude-sonnet-4-5-20250929": {"input": 3.0, "output": 15.0},
216224
"claude-opus-4-0": {"input": 15.0, "output": 75.0},
217225
"claude-opus-4-1": {"input": 15.0, "output": 75.0},
218226
"claude-sonnet-4-0": {"input": 3.0, "output": 15.0},
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "How much is 3 + 5?"}], "llm_providers":
4+
[{"provider": "anthropic", "model": "claude-sonnet-4-5", "is_custom": false,
5+
"context_length": null, "input_price": null, "output_price": null, "latency":
6+
null}], "metric": "accuracy", "max_model_depth": 1, "hash_content": true, "tools":
7+
[{"type": "function", "function": {"name": "add_fct", "description": "Add two
8+
numbers", "parameters": {"type": "object", "properties": {"a": {"type": "integer",
9+
"description": "The first number"}, "b": {"type": "integer", "description":
10+
"The second number"}}, "required": ["a", "b"]}}}]}'
11+
headers:
12+
Accept:
13+
- '*/*'
14+
Accept-Encoding:
15+
- gzip, deflate, zstd
16+
Connection:
17+
- keep-alive
18+
Content-Length:
19+
- '608'
20+
User-Agent:
21+
- Python-SDK/0.4.6
22+
content-type:
23+
- application/json
24+
method: POST
25+
uri: https://staging-api.notdiamond.ai/v2/modelRouter/modelSelect
26+
response:
27+
body:
28+
string: '{"detail":"Provider claude-sonnet-4-5 not recognized."}'
29+
headers:
30+
CF-RAY:
31+
- 98c6e24f0e9c0547-OTP
32+
Connection:
33+
- keep-alive
34+
Content-Type:
35+
- application/json
36+
Date:
37+
- Fri, 10 Oct 2025 14:42:24 GMT
38+
Server:
39+
- cloudflare
40+
Transfer-Encoding:
41+
- chunked
42+
alt-svc:
43+
- h3=":443"; ma=86400
44+
cf-cache-status:
45+
- DYNAMIC
46+
rndr-id:
47+
- 0876ff1a-9b5a-4b8d
48+
vary:
49+
- Accept-Encoding
50+
x-render-origin-server:
51+
- uvicorn
52+
x-request-id:
53+
- 0876ff1a-9b5a-4b8d
54+
status:
55+
code: 400
56+
message: Bad Request
57+
- request:
58+
body: '{"max_tokens":200,"messages":[{"role":"user","content":"How much is 3 +
59+
5?"}],"model":"claude-sonnet-4-5","tools":[{"name":"add_fct","description":"Add
60+
two numbers","input_schema":{"type":"object","properties":{"a":{"type":"integer","description":"The
61+
first number"},"b":{"type":"integer","description":"The second number"}},"required":["a","b"]}}]}'
62+
headers:
63+
accept:
64+
- application/json
65+
accept-encoding:
66+
- gzip, deflate, zstd
67+
anthropic-version:
68+
- '2023-06-01'
69+
connection:
70+
- keep-alive
71+
content-length:
72+
- '349'
73+
content-type:
74+
- application/json
75+
host:
76+
- api.anthropic.com
77+
user-agent:
78+
- Anthropic/Python 0.49.0
79+
x-api-key:
80+
- REDACTED
81+
x-stainless-arch:
82+
- arm64
83+
x-stainless-async:
84+
- 'false'
85+
x-stainless-lang:
86+
- python
87+
x-stainless-os:
88+
- MacOS
89+
x-stainless-package-version:
90+
- 0.49.0
91+
x-stainless-read-timeout:
92+
- '120.0'
93+
x-stainless-retry-count:
94+
- '0'
95+
x-stainless-runtime:
96+
- CPython
97+
x-stainless-runtime-version:
98+
- 3.11.12
99+
x-stainless-timeout:
100+
- NOT_GIVEN
101+
method: POST
102+
uri: https://api.anthropic.com/v1/messages
103+
response:
104+
body:
105+
string: '{"model":"claude-sonnet-4-5-20250929","id":"msg_018RH9GR3icDmyGZgXN89e5a","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_01NDJdQv5LWScdEQTtPEsHKJ","name":"add_fct","input":{"a":3,"b":5}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":594,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":71,"service_tier":"standard"}}'
106+
headers:
107+
CF-RAY:
108+
- 98c6e256b8dfe441-OTP
109+
Connection:
110+
- keep-alive
111+
Content-Type:
112+
- application/json
113+
Date:
114+
- Fri, 10 Oct 2025 14:42:27 GMT
115+
Server:
116+
- cloudflare
117+
Transfer-Encoding:
118+
- chunked
119+
X-Robots-Tag:
120+
- none
121+
anthropic-organization-id:
122+
- a2610b2c-742e-455d-9552-6abe105b2a44
123+
anthropic-ratelimit-input-tokens-limit:
124+
- '2000000'
125+
anthropic-ratelimit-input-tokens-remaining:
126+
- '2000000'
127+
anthropic-ratelimit-input-tokens-reset:
128+
- '2025-10-10T14:42:26Z'
129+
anthropic-ratelimit-output-tokens-limit:
130+
- '400000'
131+
anthropic-ratelimit-output-tokens-remaining:
132+
- '400000'
133+
anthropic-ratelimit-output-tokens-reset:
134+
- '2025-10-10T14:42:27Z'
135+
anthropic-ratelimit-requests-limit:
136+
- '4000'
137+
anthropic-ratelimit-requests-remaining:
138+
- '3999'
139+
anthropic-ratelimit-requests-reset:
140+
- '2025-10-10T14:42:24Z'
141+
anthropic-ratelimit-tokens-limit:
142+
- '2400000'
143+
anthropic-ratelimit-tokens-remaining:
144+
- '2400000'
145+
anthropic-ratelimit-tokens-reset:
146+
- '2025-10-10T14:42:26Z'
147+
cf-cache-status:
148+
- DYNAMIC
149+
content-length:
150+
- '478'
151+
request-id:
152+
- req_011CTyhCuxKyzFdmUyckYkQt
153+
strict-transport-security:
154+
- max-age=31536000; includeSubDomains; preload
155+
via:
156+
- 1.1 google
157+
x-envoy-upstream-service-time:
158+
- '2541'
159+
status:
160+
code: 200
161+
message: OK
162+
version: 1
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
interactions:
2+
- request:
3+
body: '{"messages": [{"role": "user", "content": "How much is 3 + 5?"}], "llm_providers":
4+
[{"provider": "anthropic", "model": "claude-sonnet-4-5", "is_custom": false,
5+
"context_length": null, "input_price": null, "output_price": null, "latency":
6+
null}], "metric": "accuracy", "max_model_depth": 1, "hash_content": true, "tools":
7+
[{"type": "function", "function": {"name": "add_fct", "description": "Adds a
8+
and b.", "parameters": {"properties": {"a": {"type": "integer"}, "b": {"type":
9+
"integer"}}, "required": ["a", "b"], "type": "object"}}}]}'
10+
headers:
11+
Accept:
12+
- '*/*'
13+
Accept-Encoding:
14+
- gzip, deflate, zstd
15+
Connection:
16+
- keep-alive
17+
Content-Length:
18+
- '535'
19+
User-Agent:
20+
- Python-SDK/0.4.6
21+
content-type:
22+
- application/json
23+
method: POST
24+
uri: https://staging-api.notdiamond.ai/v2/modelRouter/modelSelect
25+
response:
26+
body:
27+
string: '{"detail":"Provider claude-sonnet-4-5 not recognized."}'
28+
headers:
29+
CF-RAY:
30+
- 98c6e2378e83f4c8-OTP
31+
Connection:
32+
- keep-alive
33+
Content-Type:
34+
- application/json
35+
Date:
36+
- Fri, 10 Oct 2025 14:42:20 GMT
37+
Server:
38+
- cloudflare
39+
Transfer-Encoding:
40+
- chunked
41+
alt-svc:
42+
- h3=":443"; ma=86400
43+
cf-cache-status:
44+
- DYNAMIC
45+
rndr-id:
46+
- 2f0bfe9a-ece0-4332
47+
vary:
48+
- Accept-Encoding
49+
x-render-origin-server:
50+
- uvicorn
51+
x-request-id:
52+
- 2f0bfe9a-ece0-4332
53+
status:
54+
code: 400
55+
message: Bad Request
56+
- request:
57+
body: '{"max_tokens":200,"messages":[{"role":"user","content":"How much is 3 +
58+
5?"}],"model":"claude-sonnet-4-5","tools":[{"name":"add_fct","description":"Adds
59+
a and b.","input_schema":{"properties":{"a":{"type":"integer"},"b":{"type":"integer"}},"required":["a","b"],"type":"object"}}]}'
60+
headers:
61+
accept:
62+
- application/json
63+
accept-encoding:
64+
- gzip, deflate, zstd
65+
anthropic-version:
66+
- '2023-06-01'
67+
connection:
68+
- keep-alive
69+
content-length:
70+
- '280'
71+
content-type:
72+
- application/json
73+
host:
74+
- api.anthropic.com
75+
user-agent:
76+
- Anthropic/Python 0.49.0
77+
x-api-key:
78+
- REDACTED
79+
x-stainless-arch:
80+
- arm64
81+
x-stainless-async:
82+
- 'false'
83+
x-stainless-lang:
84+
- python
85+
x-stainless-os:
86+
- MacOS
87+
x-stainless-package-version:
88+
- 0.49.0
89+
x-stainless-read-timeout:
90+
- '120.0'
91+
x-stainless-retry-count:
92+
- '0'
93+
x-stainless-runtime:
94+
- CPython
95+
x-stainless-runtime-version:
96+
- 3.11.12
97+
x-stainless-timeout:
98+
- NOT_GIVEN
99+
method: POST
100+
uri: https://api.anthropic.com/v1/messages
101+
response:
102+
body:
103+
string: '{"model":"claude-sonnet-4-5-20250929","id":"msg_01StJ39QiZdUGC7E3Fh8egWe","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_013TiR2TGDYy3NgUcM54SMKi","name":"add_fct","input":{"a":3,"b":5}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":580,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":71,"service_tier":"standard"}}'
104+
headers:
105+
CF-RAY:
106+
- 98c6e23e088b48d5-OTP
107+
Connection:
108+
- keep-alive
109+
Content-Type:
110+
- application/json
111+
Date:
112+
- Fri, 10 Oct 2025 14:42:23 GMT
113+
Server:
114+
- cloudflare
115+
Transfer-Encoding:
116+
- chunked
117+
X-Robots-Tag:
118+
- none
119+
anthropic-organization-id:
120+
- a2610b2c-742e-455d-9552-6abe105b2a44
121+
anthropic-ratelimit-input-tokens-limit:
122+
- '2000000'
123+
anthropic-ratelimit-input-tokens-remaining:
124+
- '2000000'
125+
anthropic-ratelimit-input-tokens-reset:
126+
- '2025-10-10T14:42:22Z'
127+
anthropic-ratelimit-output-tokens-limit:
128+
- '400000'
129+
anthropic-ratelimit-output-tokens-remaining:
130+
- '400000'
131+
anthropic-ratelimit-output-tokens-reset:
132+
- '2025-10-10T14:42:22Z'
133+
anthropic-ratelimit-requests-limit:
134+
- '4000'
135+
anthropic-ratelimit-requests-remaining:
136+
- '3999'
137+
anthropic-ratelimit-requests-reset:
138+
- '2025-10-10T14:42:20Z'
139+
anthropic-ratelimit-tokens-limit:
140+
- '2400000'
141+
anthropic-ratelimit-tokens-remaining:
142+
- '2400000'
143+
anthropic-ratelimit-tokens-reset:
144+
- '2025-10-10T14:42:22Z'
145+
cf-cache-status:
146+
- DYNAMIC
147+
content-length:
148+
- '478'
149+
request-id:
150+
- req_011CTyhCd4aSLGxzcDbVsRCP
151+
strict-transport-security:
152+
- max-age=31536000; includeSubDomains; preload
153+
via:
154+
- 1.1 google
155+
x-envoy-upstream-service-time:
156+
- '2403'
157+
status:
158+
code: 200
159+
message: OK
160+
version: 1

0 commit comments

Comments
 (0)