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(pricing): sync flex/priority tier keys to dated OpenAI snapshot variants
mateo-berri629c228b40e8
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 02b3cde217a..cfd5bd8dfa0 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -22176,7 +22176,9 @@},"gpt-4.1-2025-04-14": {"cache_read_input_token_cost": 5e-07,+ "cache_read_input_token_cost_priority": 8.75e-07,"input_cost_per_token": 2e-06,+ "input_cost_per_token_priority": 3.5e-06,"input_cost_per_token_batches": 1e-06,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22184,6 +22186,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 8e-06,+ "output_cost_per_token_priority": 1.4e-05,"output_cost_per_token_batches": 4e-06,"supported_endpoints": ["/v1/chat/completions",@@ -22247,7 +22250,9 @@},"gpt-4.1-mini-2025-04-14": {"cache_read_input_token_cost": 1e-07,+ "cache_read_input_token_cost_priority": 1.75e-07,"input_cost_per_token": 4e-07,+ "input_cost_per_token_priority": 7e-07,"input_cost_per_token_batches": 2e-07,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22255,6 +22260,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 1.6e-06,+ "output_cost_per_token_priority": 2.8e-06,"output_cost_per_token_batches": 8e-07,"supported_endpoints": ["/v1/chat/completions",@@ -22317,7 +22323,9 @@},"gpt-4.1-nano-2025-04-14": {"cache_read_input_token_cost": 2.5e-08,+ "cache_read_input_token_cost_priority": 5e-08,"input_cost_per_token": 1e-07,+ "input_cost_per_token_priority": 2e-07,"input_cost_per_token_batches": 5e-08,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22325,6 +22333,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 4e-07,+ "output_cost_per_token_priority": 8e-07,"output_cost_per_token_batches": 2e-07,"supported_endpoints": ["/v1/chat/completions",@@ -22393,7 +22402,9 @@},"gpt-4o-2024-08-06": {"cache_read_input_token_cost": 1.25e-06,+ "cache_read_input_token_cost_priority": 2.125e-06,"input_cost_per_token": 2.5e-06,+ "input_cost_per_token_priority": 4.25e-06,"input_cost_per_token_batches": 1.25e-06,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22401,6 +22412,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 1e-05,+ "output_cost_per_token_priority": 1.7e-05,"output_cost_per_token_batches": 5e-06,"supports_function_calling": true,"supports_parallel_function_calling": true,@@ -22413,7 +22425,9 @@},"gpt-4o-2024-11-20": {"cache_read_input_token_cost": 1.25e-06,+ "cache_read_input_token_cost_priority": 2.125e-06,"input_cost_per_token": 2.5e-06,+ "input_cost_per_token_priority": 4.25e-06,"input_cost_per_token_batches": 1.25e-06,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22421,6 +22435,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 1e-05,+ "output_cost_per_token_priority": 1.7e-05,"output_cost_per_token_batches": 5e-06,"supports_function_calling": true,"supports_parallel_function_calling": true,@@ -22720,7 +22735,9 @@},"gpt-4o-mini-2024-07-18": {"cache_read_input_token_cost": 7.5e-08,+ "cache_read_input_token_cost_priority": 1.25e-07,"input_cost_per_token": 1.5e-07,+ "input_cost_per_token_priority": 2.5e-07,"input_cost_per_token_batches": 7.5e-08,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22728,6 +22745,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 6e-07,+ "output_cost_per_token_priority": 1e-06,"output_cost_per_token_batches": 3e-07,"search_context_cost_per_query": {"search_context_size_high": 0.03,@@ -25077,6 +25095,7 @@"cache_read_input_token_cost": 5e-09,"cache_read_input_token_cost_flex": 2.5e-09,"input_cost_per_token": 5e-08,+ "input_cost_per_token_priority": 2.5e-06,"input_cost_per_token_flex": 2.5e-08,"litellm_provider": "openai","max_input_tokens": 272000,@@ -29304,13 +29323,19 @@},"o3-2025-04-16": {"cache_read_input_token_cost": 5e-07,+ "cache_read_input_token_cost_flex": 2.5e-07,+ "cache_read_input_token_cost_priority": 8.75e-07,"input_cost_per_token": 2e-06,+ "input_cost_per_token_flex": 1e-06,+ "input_cost_per_token_priority": 3.5e-06,"litellm_provider": "openai","max_input_tokens": 200000,"max_output_tokens": 100000,"max_tokens": 100000,"mode": "chat","output_cost_per_token": 8e-06,+ "output_cost_per_token_flex": 4e-06,+ "output_cost_per_token_priority": 1.4e-05,"supported_endpoints": ["/v1/responses","/v1/chat/completions",@@ -29525,13 +29550,19 @@},"o4-mini-2025-04-16": {"cache_read_input_token_cost": 2.75e-07,+ "cache_read_input_token_cost_flex": 1.375e-07,+ "cache_read_input_token_cost_priority": 5e-07,"input_cost_per_token": 1.1e-06,+ "input_cost_per_token_flex": 5.5e-07,+ "input_cost_per_token_priority": 2e-06,"litellm_provider": "openai","max_input_tokens": 200000,"max_output_tokens": 100000,"max_tokens": 100000,"mode": "chat","output_cost_per_token": 4.4e-06,+ "output_cost_per_token_flex": 2.2e-06,+ "output_cost_per_token_priority": 8e-06,"supports_function_calling": true,"supports_parallel_function_calling": false,"supports_pdf_input": true,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex bc7330ec99c..b411a5fb483 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -22251,7 +22251,9 @@},"gpt-4.1-2025-04-14": {"cache_read_input_token_cost": 5e-07,+ "cache_read_input_token_cost_priority": 8.75e-07,"input_cost_per_token": 2e-06,+ "input_cost_per_token_priority": 3.5e-06,"input_cost_per_token_batches": 1e-06,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22259,6 +22261,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 8e-06,+ "output_cost_per_token_priority": 1.4e-05,"output_cost_per_token_batches": 4e-06,"supported_endpoints": ["/v1/chat/completions",@@ -22322,7 +22325,9 @@},"gpt-4.1-mini-2025-04-14": {"cache_read_input_token_cost": 1e-07,+ "cache_read_input_token_cost_priority": 1.75e-07,"input_cost_per_token": 4e-07,+ "input_cost_per_token_priority": 7e-07,"input_cost_per_token_batches": 2e-07,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22330,6 +22335,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 1.6e-06,+ "output_cost_per_token_priority": 2.8e-06,"output_cost_per_token_batches": 8e-07,"supported_endpoints": ["/v1/chat/completions",@@ -22392,7 +22398,9 @@},"gpt-4.1-nano-2025-04-14": {"cache_read_input_token_cost": 2.5e-08,+ "cache_read_input_token_cost_priority": 5e-08,"input_cost_per_token": 1e-07,+ "input_cost_per_token_priority": 2e-07,"input_cost_per_token_batches": 5e-08,"litellm_provider": "openai","max_input_tokens": 1047576,@@ -22400,6 +22408,7 @@"max_tokens": 32768,"mode": "chat","output_cost_per_token": 4e-07,+ "output_cost_per_token_priority": 8e-07,"output_cost_per_token_batches": 2e-07,"supported_endpoints": ["/v1/chat/completions",@@ -22468,7 +22477,9 @@},"gpt-4o-2024-08-06": {"cache_read_input_token_cost": 1.25e-06,+ "cache_read_input_token_cost_priority": 2.125e-06,"input_cost_per_token": 2.5e-06,+ "input_cost_per_token_priority": 4.25e-06,"input_cost_per_token_batches": 1.25e-06,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22476,6 +22487,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 1e-05,+ "output_cost_per_token_priority": 1.7e-05,"output_cost_per_token_batches": 5e-06,"supports_function_calling": true,"supports_parallel_function_calling": true,@@ -22488,7 +22500,9 @@},"gpt-4o-2024-11-20": {"cache_read_input_token_cost": 1.25e-06,+ "cache_read_input_token_cost_priority": 2.125e-06,"input_cost_per_token": 2.5e-06,+ "input_cost_per_token_priority": 4.25e-06,"input_cost_per_token_batches": 1.25e-06,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22496,6 +22510,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 1e-05,+ "output_cost_per_token_priority": 1.7e-05,"output_cost_per_token_batches": 5e-06,"supports_function_calling": true,"supports_parallel_function_calling": true,@@ -22795,7 +22810,9 @@},"gpt-4o-mini-2024-07-18": {"cache_read_input_token_cost": 7.5e-08,+ "cache_read_input_token_cost_priority": 1.25e-07,"input_cost_per_token": 1.5e-07,+ "input_cost_per_token_priority": 2.5e-07,"input_cost_per_token_batches": 7.5e-08,"litellm_provider": "openai","max_input_tokens": 128000,@@ -22803,6 +22820,7 @@"max_tokens": 16384,"mode": "chat","output_cost_per_token": 6e-07,+ "output_cost_per_token_priority": 1e-06,"output_cost_per_token_batches": 3e-07,"search_context_cost_per_query": {"search_context_size_high": 0.03,@@ -25152,6 +25170,7 @@"cache_read_input_token_cost": 5e-09,"cache_read_input_token_cost_flex": 2.5e-09,"input_cost_per_token": 5e-08,+ "input_cost_per_token_priority": 2.5e-06,"input_cost_per_token_flex": 2.5e-08,"litellm_provider": "openai","max_input_tokens": 272000,@@ -29379,13 +29398,19 @@},"o3-2025-04-16": {"cache_read_input_token_cost": 5e-07,+ "cache_read_input_token_cost_flex": 2.5e-07,+ "cache_read_input_token_cost_priority": 8.75e-07,"input_cost_per_token": 2e-06,+ "input_cost_per_token_flex": 1e-06,+ "input_cost_per_token_priority": 3.5e-06,"litellm_provider": "openai","max_input_tokens": 200000,"max_output_tokens": 100000,"max_tokens": 100000,"mode": "chat","output_cost_per_token": 8e-06,+ "output_cost_per_token_flex": 4e-06,+ "output_cost_per_token_priority": 1.4e-05,"supported_endpoints": ["/v1/responses","/v1/chat/completions",@@ -29600,13 +29625,19 @@},"o4-mini-2025-04-16": {"cache_read_input_token_cost": 2.75e-07,+ "cache_read_input_token_cost_flex": 1.375e-07,+ "cache_read_input_token_cost_priority": 5e-07,"input_cost_per_token": 1.1e-06,+ "input_cost_per_token_flex": 5.5e-07,+ "input_cost_per_token_priority": 2e-06,"litellm_provider": "openai","max_input_tokens": 200000,"max_output_tokens": 100000,"max_tokens": 100000,"mode": "chat","output_cost_per_token": 4.4e-06,+ "output_cost_per_token_flex": 2.2e-06,+ "output_cost_per_token_priority": 8e-06,"supports_function_calling": true,"supports_parallel_function_calling": false,"supports_pdf_input": true,diff --git a/tests/test_litellm/test_model_prices_schema.py b/tests/test_litellm/test_model_prices_schema.pyindex f6f1bf16742..ccb0541d318 100644--- a/tests/test_litellm/test_model_prices_schema.py+++ b/tests/test_litellm/test_model_prices_schema.py@@ -2,6 +2,7 @@ from __future__ import annotationsimport importlib.utilimport json+import refrom pathlib import Pathimport jsonschema@@ -97,3 +98,34 @@ def test_schema_accepts_minimal_and_unknown_optional_fields(committed_schema: divalidator = build_validator(committed_schema)assert validator.is_valid({"some-model": {"litellm_provider": "openai"}})assert validator.is_valid({"some-model": {"litellm_provider": "openai", "brand_new_field": {"nested": True}}})+++DATED_VARIANT = re.compile(r"^(.*?)-(\d{4}-\d{2}-\d{2})$")+SERVICE_TIER_SUFFIXES = ("_flex", "_priority")+++def tier_anchor(tier_key: str) -> str:+ matched = next(suffix for suffix in SERVICE_TIER_SUFFIXES if tier_key.endswith(suffix))+ return tier_key[: -len(matched)]+++def test_dated_variants_carry_base_alias_service_tier_pricing(prices: dict):+ drifted = [+ f"{name}: missing {tier_key}={base[tier_key]} (base alias {match.group(1)})"+ for name, entry in prices.items()+ if isinstance(entry, dict)+ for match in [DATED_VARIANT.match(name)]+ if match is not None+ for base in [prices.get(match.group(1))]+ if isinstance(base, dict)+ for tier_key in base+ if tier_key.endswith(SERVICE_TIER_SUFFIXES)+ and tier_anchor(tier_key) in base+ and entry.get(tier_anchor(tier_key)) == base[tier_anchor(tier_key)]+ and entry.get(tier_key) != base[tier_key]+ ]+ assert drifted == [], (+ "dated model variants are missing flex/priority pricing their base alias has; "+ "sync the tier keys so service-tier requests against pinned snapshots are not "+ "billed at standard rates:\n" + "\n".join(drifted)+ )