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(model_prices): bill muse spark web search grounding per query
mateo-berri39a5ede2d988
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 77645f7ba2d..d3f9c52bd08 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -27473,6 +27473,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 4.25e-06,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",@@ -27509,6 +27514,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 4.25e-06,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",@@ -27545,6 +27555,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 2e-07,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 77645f7ba2d..d3f9c52bd08 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -27473,6 +27473,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 4.25e-06,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",@@ -27509,6 +27514,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 4.25e-06,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",@@ -27545,6 +27555,11 @@"max_tokens": 131072,"mode": "chat","output_cost_per_token": 2e-07,+ "search_context_cost_per_query": {+ "search_context_size_high": 0.0025,+ "search_context_size_low": 0.0025,+ "search_context_size_medium": 0.0025+ },"source": "https://dev.meta.ai/docs/getting-started/pricing-rate-limits","supported_endpoints": ["/v1/chat/completions",diff --git a/tests/test_litellm/test_muse_spark_1_2_model_metadata.py b/tests/test_litellm/test_muse_spark_1_2_model_metadata.pyindex dcce92b0c17..20aa4b11dcd 100644--- a/tests/test_litellm/test_muse_spark_1_2_model_metadata.py+++ b/tests/test_litellm/test_muse_spark_1_2_model_metadata.py@@ -6,9 +6,11 @@ import pytestimport litellmfrom litellm.cost_calculator import cost_per_tokenfrom litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider+from litellm.litellm_core_utils.llm_cost_calc.tool_call_cost_tracking import StandardBuiltInToolCostTrackingMUSE_SPARK_STANDARD = "meta/muse-spark-1.2"MUSE_SPARK_CONTRIBUTOR = "meta/muse-spark-1.2-contributor"+WEB_SEARCH_COST_PER_QUERY = 0.0025PRICING = ((MUSE_SPARK_STANDARD, 1.25e-06, 1.5e-07, 4.25e-06),@@ -68,6 +70,12 @@ def test_muse_spark_1_2_model_info(model: str, input_cost: float, cached_cost: fassert info["supported_modalities"] == ["text", "image", "video"]assert info["supported_output_modalities"] == ["text"]+ assert info["search_context_cost_per_query"] == {+ "search_context_size_high": WEB_SEARCH_COST_PER_QUERY,+ "search_context_size_low": WEB_SEARCH_COST_PER_QUERY,+ "search_context_size_medium": WEB_SEARCH_COST_PER_QUERY,+ }+@pytest.mark.parametrize("model, input_cost, cached_cost, output_cost", PRICING)def test_muse_spark_1_2_cost_per_token(@@ -88,6 +96,13 @@ def test_muse_spark_1_2_routes_to_meta_model_api(model: str):assert api_base == "https://api.meta.ai/v1"[email protected]("model", (MUSE_SPARK_STANDARD, MUSE_SPARK_CONTRIBUTOR))+def test_muse_spark_1_2_web_search_cost_per_query(local_model_cost_map, model: str):+ info = litellm.get_model_info(model=model)++ assert StandardBuiltInToolCostTracking.get_cost_for_web_search(model_info=info) == WEB_SEARCH_COST_PER_QUERY++@pytest.mark.parametrize("model", (MUSE_SPARK_STANDARD, MUSE_SPARK_CONTRIBUTOR))def test_muse_spark_1_2_backup_matches_main(model: str):"""Ensure the bundled model cost map stays in sync with the canonical file."""