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(databricks): price Sonnet 5 at standard rates past the introductory window
mateo-berri6c23f5ffba4f
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 0bbb4b7e377..e296e828b92 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -14895,20 +14895,20 @@"supports_tool_choice": true},"databricks/databricks-claude-sonnet-5": {- "cache_creation_input_token_cost": 2.4999625e-06,- "cache_read_input_token_cost": 1.9999700000000004e-07,- "input_cost_per_token": 1.9999700000000004e-06,- "input_dbu_cost_per_token": 2.8571e-05,+ "cache_creation_input_token_cost": 3.7499875e-06,+ "cache_read_input_token_cost": 2.9999900000000006e-07,+ "input_cost_per_token": 2.9999900000000002e-06,+ "input_dbu_cost_per_token": 4.2857e-05,"litellm_provider": "databricks","max_input_tokens": 1000000,"max_output_tokens": 128000,"max_tokens": 128000,"metadata": {- "notes": "Input/output cost per token is dbu cost * $0.070. Number provided for reference, '*_dbu_cost_per_token' used in actual calculation. Claude Sonnet 5 DBU rates are Anthropic's introductory launch pricing, in effect through 2026-08-31, after which the standard Sonnet 5 rates (equal to Sonnet 4.5 / 4.6) take effect."+ "notes": "Input/output cost per token is dbu cost * $0.070. Number provided for reference, '*_dbu_cost_per_token' used in actual calculation. Anthropic's introductory launch rates (28.571 input / 142.857 output DBU) run through 2026-08-31. The standard rates listed here, equal to Sonnet 4.5 / 4.6, are used instead because pricing carries no expiry date, and undercharging past the window would let spend outrun enforced budgets."},"mode": "chat",- "output_cost_per_token": 9.999990000000002e-06,- "output_dbu_cost_per_token": 0.000142857,+ "output_cost_per_token": 1.5000020000000002e-05,+ "output_dbu_cost_per_token": 0.000214286,"prompt_cache_min_tokens": 1024,"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving","supports_adaptive_thinking": true,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 0bbb4b7e377..e296e828b92 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -14895,20 +14895,20 @@"supports_tool_choice": true},"databricks/databricks-claude-sonnet-5": {- "cache_creation_input_token_cost": 2.4999625e-06,- "cache_read_input_token_cost": 1.9999700000000004e-07,- "input_cost_per_token": 1.9999700000000004e-06,- "input_dbu_cost_per_token": 2.8571e-05,+ "cache_creation_input_token_cost": 3.7499875e-06,+ "cache_read_input_token_cost": 2.9999900000000006e-07,+ "input_cost_per_token": 2.9999900000000002e-06,+ "input_dbu_cost_per_token": 4.2857e-05,"litellm_provider": "databricks","max_input_tokens": 1000000,"max_output_tokens": 128000,"max_tokens": 128000,"metadata": {- "notes": "Input/output cost per token is dbu cost * $0.070. Number provided for reference, '*_dbu_cost_per_token' used in actual calculation. Claude Sonnet 5 DBU rates are Anthropic's introductory launch pricing, in effect through 2026-08-31, after which the standard Sonnet 5 rates (equal to Sonnet 4.5 / 4.6) take effect."+ "notes": "Input/output cost per token is dbu cost * $0.070. Number provided for reference, '*_dbu_cost_per_token' used in actual calculation. Anthropic's introductory launch rates (28.571 input / 142.857 output DBU) run through 2026-08-31. The standard rates listed here, equal to Sonnet 4.5 / 4.6, are used instead because pricing carries no expiry date, and undercharging past the window would let spend outrun enforced budgets."},"mode": "chat",- "output_cost_per_token": 9.999990000000002e-06,- "output_dbu_cost_per_token": 0.000142857,+ "output_cost_per_token": 1.5000020000000002e-05,+ "output_dbu_cost_per_token": 0.000214286,"prompt_cache_min_tokens": 1024,"source": "https://www.databricks.com/product/pricing/proprietary-foundation-model-serving","supports_adaptive_thinking": true,diff --git a/tests/test_litellm/llms/databricks/test_databricks_cost_calculator.py b/tests/test_litellm/llms/databricks/test_databricks_cost_calculator.pyindex e2be7812c1b..9353292c668 100644--- a/tests/test_litellm/llms/databricks/test_databricks_cost_calculator.py+++ b/tests/test_litellm/llms/databricks/test_databricks_cost_calculator.py@@ -1,14 +1,15 @@+from collections.abc import Iteratorfrom typing import Finalimport pytestimport litellmfrom litellm.llms.databricks.cost_calculator import cost_per_token-from litellm.types.utils import Usage+from litellm.types.utils import ModelInfo, Usage@pytest.fixture-def local_model_cost_map(monkeypatch):+def local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))litellm.get_model_info.cache_clear()@@ -16,7 +17,7 @@ def local_model_cost_map(monkeypatch):litellm.get_model_info.cache_clear()-def _model_info(model: str) -> dict:+def _model_info(model: str) -> ModelInfo:return litellm.get_model_info(model=model, custom_llm_provider="databricks")@@ -28,7 +29,7 @@ def _model_info(model: str) -> dict:"databricks/databricks-claude-sonnet-5",],)-def test_cached_tokens_bill_at_cache_rates(local_model_cost_map, model):+def test_cached_tokens_bill_at_cache_rates(local_model_cost_map: None, model: str) -> None:info: Final = _model_info(model)usage: Final = Usage(prompt_tokens=11000,@@ -49,7 +50,7 @@ def test_cached_tokens_bill_at_cache_rates(local_model_cost_map, model):assert prompt_cost < 11000 * info["input_cost_per_token"]-def test_uncached_request_bills_every_prompt_token_at_the_input_rate(local_model_cost_map):+def test_uncached_request_bills_every_prompt_token_at_the_input_rate(local_model_cost_map: None) -> None:model: Final = "databricks/databricks-claude-sonnet-5"info: Final = _model_info(model)usage: Final = Usage(prompt_tokens=1000, completion_tokens=200, total_tokens=1200)@@ -60,7 +61,7 @@ def test_uncached_request_bills_every_prompt_token_at_the_input_rate(local_modelassert completion_cost == pytest.approx(200 * info["output_cost_per_token"])-def test_legacy_endpoint_names_still_resolve(local_model_cost_map):+def test_legacy_endpoint_names_still_resolve(local_model_cost_map: None) -> None:info: Final = _model_info("databricks/databricks-mixtral-8x7b-instruct")usage: Final = Usage(prompt_tokens=100, completion_tokens=100, total_tokens=200)@@ -80,7 +81,7 @@ def test_legacy_endpoint_names_still_resolve(local_model_cost_map):"databricks/databricks-claude-fable-5",],)-def test_new_models_carry_cache_pricing(local_model_cost_map, model):+def test_new_models_carry_cache_pricing(local_model_cost_map: None, model: str) -> None:info: Final = _model_info(model)assert info["input_cost_per_token"] > 0@@ -88,3 +89,13 @@ def test_new_models_carry_cache_pricing(local_model_cost_map, model):assert info["cache_creation_input_token_cost"] == pytest.approx(1.25 * info["input_cost_per_token"], rel=1e-4)assert info["cache_read_input_token_cost"] == pytest.approx(0.1 * info["input_cost_per_token"], rel=1e-4)assert info["supports_prompt_caching"] is True+++def test_sonnet_5_ships_standard_rates_not_introductory(local_model_cost_map: None) -> None:+ sonnet_5: Final = _model_info("databricks/databricks-claude-sonnet-5")+ sonnet_4_6: Final = _model_info("databricks/databricks-claude-sonnet-4-6")++ assert sonnet_5["input_cost_per_token"] == pytest.approx(sonnet_4_6["input_cost_per_token"])+ assert sonnet_5["output_cost_per_token"] == pytest.approx(sonnet_4_6["output_cost_per_token"])+ assert sonnet_5["cache_creation_input_token_cost"] == pytest.approx(sonnet_4_6["cache_creation_input_token_cost"])+ assert sonnet_5["cache_read_input_token_cost"] == pytest.approx(sonnet_4_6["cache_read_input_token_cost"])