The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(cost-map): add US data residency uplift to claude-sonnet-4-6 and mythos entries
mateo-berria2cd2d8a4b37
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 9ca8d9e1bac..6e3b12e29cb 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -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,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 9ca8d9e1bac..6e3b12e29cb 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -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,diff --git a/tests/test_litellm/test_cost_calculator.py b/tests/test_litellm/test_cost_calculator.pyindex 1f1c9be973f..952e6c46f38 100644--- a/tests/test_litellm/test_cost_calculator.py+++ b/tests/test_litellm/test_cost_calculator.py@@ -2840,6 +2840,38 @@ def test_anthropic_geo_and_fast_multipliers_compose(_local_model_cost_map, monkeassert completion_cost == pytest.approx(500 * 25e-6 * 2.0 * 1.1)+ "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