Skip to content

Commit b30c7cb

Browse files
committed
Fix the Pricing changes for claude models
1 parent 5300a83 commit b30c7cb

File tree

1 file changed

+53
-45
lines changed

1 file changed

+53
-45
lines changed

tests/test_litellm/test_claude_opus_4_6_config.py

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,70 +24,82 @@ def test_claude_4_6_australia_region_uses_au_prefix_not_apac():
2424
Related: The 'apac.' prefix is valid for Asia-Pacific (Singapore) region models,
2525
but should not be used for Australia which has its own 'au.' prefix.
2626
"""
27-
json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json")
27+
json_path = os.path.join(
28+
os.path.dirname(__file__), "../../model_prices_and_context_window.json"
29+
)
2830
with open(json_path) as f:
2931
model_data = json.load(f)
3032

3133
# Verify au.anthropic.claude-opus-4-6-v1 exists (correct)
32-
assert "au.anthropic.claude-opus-4-6-v1" in model_data, \
33-
"Missing Australia region model: au.anthropic.claude-opus-4-6-v1"
34+
assert (
35+
"au.anthropic.claude-opus-4-6-v1" in model_data
36+
), "Missing Australia region model: au.anthropic.claude-opus-4-6-v1"
3437

3538
# Verify apac.anthropic.claude-opus-4-6-v1 does NOT exist (incorrect)
36-
assert "apac.anthropic.claude-opus-4-6-v1" not in model_data, \
37-
"Incorrect model entry exists: apac.anthropic.claude-opus-4-6-v1 should be au.anthropic.claude-opus-4-6-v1"
39+
assert (
40+
"apac.anthropic.claude-opus-4-6-v1" not in model_data
41+
), "Incorrect model entry exists: apac.anthropic.claude-opus-4-6-v1 should be au.anthropic.claude-opus-4-6-v1"
3842

3943
# Verify au.anthropic.claude-sonnet-4-6 exists (correct)
40-
assert "au.anthropic.claude-sonnet-4-6" in model_data, \
41-
"Missing Australia region model: au.anthropic.claude-sonnet-4-6"
44+
assert (
45+
"au.anthropic.claude-sonnet-4-6" in model_data
46+
), "Missing Australia region model: au.anthropic.claude-sonnet-4-6"
4247

4348
# Verify apac.anthropic.claude-sonnet-4-6 does NOT exist (incorrect)
44-
assert "apac.anthropic.claude-sonnet-4-6" not in model_data, \
45-
"Incorrect model entry exists: apac.anthropic.claude-sonnet-4-6 should be au.anthropic.claude-sonnet-4-6"
49+
assert (
50+
"apac.anthropic.claude-sonnet-4-6" not in model_data
51+
), "Incorrect model entry exists: apac.anthropic.claude-sonnet-4-6 should be au.anthropic.claude-sonnet-4-6"
4652

4753
# Verify the au. model is registered in bedrock_converse_models
48-
assert "au.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models, \
49-
"au.anthropic.claude-opus-4-6-v1 not registered in bedrock_converse_models"
54+
assert (
55+
"au.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models
56+
), "au.anthropic.claude-opus-4-6-v1 not registered in bedrock_converse_models"
5057

5158
# Verify apac. is NOT registered for this model
52-
assert "apac.anthropic.claude-opus-4-6-v1" not in litellm.bedrock_converse_models, \
53-
"apac.anthropic.claude-opus-4-6-v1 should not be in bedrock_converse_models"
59+
assert (
60+
"apac.anthropic.claude-opus-4-6-v1" not in litellm.bedrock_converse_models
61+
), "apac.anthropic.claude-opus-4-6-v1 should not be in bedrock_converse_models"
5462

5563
# Verify the au. model is registered in bedrock_converse_models
56-
assert "au.anthropic.claude-sonnet-4-6" in litellm.bedrock_converse_models, \
57-
"au.anthropic.claude-sonnet-4-6 not registered in bedrock_converse_models"
64+
assert (
65+
"au.anthropic.claude-sonnet-4-6" in litellm.bedrock_converse_models
66+
), "au.anthropic.claude-sonnet-4-6 not registered in bedrock_converse_models"
5867

5968
# Verify apac. is NOT registered for this model
60-
assert "apac.anthropic.claude-sonnet-4-6" not in litellm.bedrock_converse_models, \
61-
"apac.anthropic.claude-sonnet-4-6 should not be in bedrock_converse_models"
69+
assert (
70+
"apac.anthropic.claude-sonnet-4-6" not in litellm.bedrock_converse_models
71+
), "apac.anthropic.claude-sonnet-4-6 should not be in bedrock_converse_models"
6272

6373

6474
def test_opus_4_6_model_pricing_and_capabilities():
65-
json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json")
75+
json_path = os.path.join(
76+
os.path.dirname(__file__), "../../model_prices_and_context_window.json"
77+
)
6678
with open(json_path) as f:
6779
model_data = json.load(f)
6880

6981
expected_models = {
7082
"claude-opus-4-6": {
7183
"provider": "anthropic",
72-
"has_long_context_pricing": True,
84+
"has_long_context_pricing": False,
7385
"tool_use_system_prompt_tokens": 346,
7486
"max_input_tokens": 1000000,
7587
},
7688
"claude-opus-4-6-20260205": {
7789
"provider": "anthropic",
78-
"has_long_context_pricing": True,
90+
"has_long_context_pricing": False,
7991
"tool_use_system_prompt_tokens": 346,
8092
"max_input_tokens": 1000000,
8193
},
8294
"anthropic.claude-opus-4-6-v1": {
8395
"provider": "bedrock_converse",
84-
"has_long_context_pricing": True,
96+
"has_long_context_pricing": False,
8597
"tool_use_system_prompt_tokens": 346,
8698
"max_input_tokens": 1000000,
8799
},
88100
"vertex_ai/claude-opus-4-6": {
89101
"provider": "vertex_ai-anthropic_models",
90-
"has_long_context_pricing": True,
102+
"has_long_context_pricing": False,
91103
"tool_use_system_prompt_tokens": 346,
92104
"max_input_tokens": 1000000,
93105
},
@@ -119,18 +131,28 @@ def test_opus_4_6_model_pricing_and_capabilities():
119131
assert info["output_cost_per_token_above_200k_tokens"] == 3.75e-05
120132
assert info["cache_creation_input_token_cost_above_200k_tokens"] == 1.25e-05
121133
assert info["cache_read_input_token_cost_above_200k_tokens"] == 1e-06
134+
else:
135+
assert "input_cost_per_token_above_200k_tokens" not in info
136+
assert "output_cost_per_token_above_200k_tokens" not in info
137+
assert "cache_creation_input_token_cost_above_200k_tokens" not in info
138+
assert "cache_read_input_token_cost_above_200k_tokens" not in info
122139

123140
assert info["supports_assistant_prefill"] is False
124141
assert info["supports_function_calling"] is True
125142
assert info["supports_prompt_caching"] is True
126143
assert info["supports_reasoning"] is True
127144
assert info["supports_tool_choice"] is True
128145
assert info["supports_vision"] is True
129-
assert info["tool_use_system_prompt_tokens"] == config["tool_use_system_prompt_tokens"]
146+
assert (
147+
info["tool_use_system_prompt_tokens"]
148+
== config["tool_use_system_prompt_tokens"]
149+
)
130150

131151

132152
def test_opus_4_6_bedrock_regional_model_pricing():
133-
json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json")
153+
json_path = os.path.join(
154+
os.path.dirname(__file__), "../../model_prices_and_context_window.json"
155+
)
134156
with open(json_path) as f:
135157
model_data = json.load(f)
136158

@@ -140,40 +162,24 @@ def test_opus_4_6_bedrock_regional_model_pricing():
140162
"output_cost_per_token": 2.5e-05,
141163
"cache_creation_input_token_cost": 6.25e-06,
142164
"cache_read_input_token_cost": 5e-07,
143-
"input_cost_per_token_above_200k_tokens": 1e-05,
144-
"output_cost_per_token_above_200k_tokens": 3.75e-05,
145-
"cache_creation_input_token_cost_above_200k_tokens": 1.25e-05,
146-
"cache_read_input_token_cost_above_200k_tokens": 1e-06,
147165
},
148166
"us.anthropic.claude-opus-4-6-v1": {
149167
"input_cost_per_token": 5.5e-06,
150168
"output_cost_per_token": 2.75e-05,
151169
"cache_creation_input_token_cost": 6.875e-06,
152170
"cache_read_input_token_cost": 5.5e-07,
153-
"input_cost_per_token_above_200k_tokens": 1.1e-05,
154-
"output_cost_per_token_above_200k_tokens": 4.125e-05,
155-
"cache_creation_input_token_cost_above_200k_tokens": 1.375e-05,
156-
"cache_read_input_token_cost_above_200k_tokens": 1.1e-06,
157171
},
158172
"eu.anthropic.claude-opus-4-6-v1": {
159173
"input_cost_per_token": 5.5e-06,
160174
"output_cost_per_token": 2.75e-05,
161175
"cache_creation_input_token_cost": 6.875e-06,
162176
"cache_read_input_token_cost": 5.5e-07,
163-
"input_cost_per_token_above_200k_tokens": 1.1e-05,
164-
"output_cost_per_token_above_200k_tokens": 4.125e-05,
165-
"cache_creation_input_token_cost_above_200k_tokens": 1.375e-05,
166-
"cache_read_input_token_cost_above_200k_tokens": 1.1e-06,
167177
},
168178
"au.anthropic.claude-opus-4-6-v1": {
169179
"input_cost_per_token": 5.5e-06,
170180
"output_cost_per_token": 2.75e-05,
171181
"cache_creation_input_token_cost": 6.875e-06,
172182
"cache_read_input_token_cost": 5.5e-07,
173-
"input_cost_per_token_above_200k_tokens": 1.1e-05,
174-
"output_cost_per_token_above_200k_tokens": 4.125e-05,
175-
"cache_creation_input_token_cost_above_200k_tokens": 1.375e-05,
176-
"cache_read_input_token_cost_above_200k_tokens": 1.1e-06,
177183
},
178184
}
179185

@@ -186,12 +192,18 @@ def test_opus_4_6_bedrock_regional_model_pricing():
186192
assert info["max_tokens"] == 128000
187193
assert info["supports_assistant_prefill"] is False
188194
assert info["tool_use_system_prompt_tokens"] == 346
195+
assert "input_cost_per_token_above_200k_tokens" not in info
196+
assert "output_cost_per_token_above_200k_tokens" not in info
197+
assert "cache_creation_input_token_cost_above_200k_tokens" not in info
198+
assert "cache_read_input_token_cost_above_200k_tokens" not in info
189199
for key, value in expected.items():
190200
assert info[key] == value
191201

192202

193203
def test_opus_4_6_alias_and_dated_metadata_match():
194-
json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json")
204+
json_path = os.path.join(
205+
os.path.dirname(__file__), "../../model_prices_and_context_window.json"
206+
)
195207
with open(json_path) as f:
196208
model_data = json.load(f)
197209

@@ -207,10 +219,6 @@ def test_opus_4_6_alias_and_dated_metadata_match():
207219
"cache_creation_input_token_cost",
208220
"cache_creation_input_token_cost_above_1hr",
209221
"cache_read_input_token_cost",
210-
"input_cost_per_token_above_200k_tokens",
211-
"output_cost_per_token_above_200k_tokens",
212-
"cache_creation_input_token_cost_above_200k_tokens",
213-
"cache_read_input_token_cost_above_200k_tokens",
214222
"supports_assistant_prefill",
215223
"tool_use_system_prompt_tokens",
216224
]

0 commit comments

Comments
 (0)