mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(cost-map): add US data residency uplift to claude-sonnet-4-6 and mythos entries
This commit is contained in:
parent
cdb60af024
commit
a2cd2d8a4b
3 changed files with 56 additions and 6 deletions
|
|
@ -12515,7 +12515,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_output_config": true,
|
||||
"prompt_cache_min_tokens": 1024
|
||||
"prompt_cache_min_tokens": 1024,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"claude-sonnet-4-5-20250929-v1:0": {
|
||||
"cache_creation_input_token_cost": 3.75e-06,
|
||||
|
|
@ -50825,7 +50828,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_xhigh_reasoning_effort": true,
|
||||
"supports_native_structured_output": true
|
||||
"supports_native_structured_output": true,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"claude-mythos-preview": {
|
||||
"cache_creation_input_token_cost": 1.25e-05,
|
||||
|
|
@ -50860,7 +50866,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_xhigh_reasoning_effort": true,
|
||||
"supports_native_structured_output": true
|
||||
"supports_native_structured_output": true,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"gemini/gemini-robotics-er-2-streaming-preview": {
|
||||
"input_cost_per_audio_token": 2e-06,
|
||||
|
|
|
|||
|
|
@ -12515,7 +12515,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_output_config": true,
|
||||
"prompt_cache_min_tokens": 1024
|
||||
"prompt_cache_min_tokens": 1024,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"claude-sonnet-4-5-20250929-v1:0": {
|
||||
"cache_creation_input_token_cost": 3.75e-06,
|
||||
|
|
@ -50825,7 +50828,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_xhigh_reasoning_effort": true,
|
||||
"supports_native_structured_output": true
|
||||
"supports_native_structured_output": true,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"claude-mythos-preview": {
|
||||
"cache_creation_input_token_cost": 1.25e-05,
|
||||
|
|
@ -50860,7 +50866,10 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_xhigh_reasoning_effort": true,
|
||||
"supports_native_structured_output": true
|
||||
"supports_native_structured_output": true,
|
||||
"provider_specific_entry": {
|
||||
"us": 1.1
|
||||
}
|
||||
},
|
||||
"gemini/gemini-robotics-er-2-streaming-preview": {
|
||||
"input_cost_per_audio_token": 2e-06,
|
||||
|
|
|
|||
|
|
@ -2840,6 +2840,38 @@ def test_anthropic_geo_and_fast_multipliers_compose(_local_model_cost_map, monke
|
|||
assert completion_cost == pytest.approx(500 * 25e-6 * 2.0 * 1.1)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model",
|
||||
["claude-sonnet-4-6", "claude-mythos-5", "claude-mythos-preview"],
|
||||
)
|
||||
def test_anthropic_us_data_residency_uplift_on_claude_4_6_and_later_models(_local_model_cost_map, monkeypatch, model):
|
||||
"""
|
||||
Anthropic bills every Claude 4.6+ model served with ``inference_geo="us"`` at
|
||||
1.1x, and echoes that geo back in the response usage, so each of these real
|
||||
cost-map entries has to carry the ``us`` multiplier or US-pinned traffic is
|
||||
under-reported by 10%.
|
||||
"""
|
||||
from litellm.llms.anthropic.cost_calculation import (
|
||||
cost_per_token as anthropic_cost_per_token,
|
||||
)
|
||||
from litellm.types.utils import Usage
|
||||
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
|
||||
|
||||
def make_usage() -> "Usage":
|
||||
return Usage(prompt_tokens=1_000, completion_tokens=100, total_tokens=1_100)
|
||||
|
||||
base_prompt_cost, base_completion_cost = anthropic_cost_per_token(model=model, usage=make_usage())
|
||||
|
||||
geo_usage = make_usage()
|
||||
geo_usage.inference_geo = "us"
|
||||
geo_prompt_cost, geo_completion_cost = anthropic_cost_per_token(model=model, usage=geo_usage)
|
||||
|
||||
assert base_prompt_cost > 0
|
||||
assert geo_prompt_cost == pytest.approx(base_prompt_cost * 1.1)
|
||||
assert geo_completion_cost == pytest.approx(base_completion_cost * 1.1)
|
||||
|
||||
|
||||
def test_gemini_cache_tokens_details_no_negative_values():
|
||||
"""
|
||||
Test for Issue #18750: Negative text_tokens with Gemini caching
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue