From 35dcc332e2b83943f788f9e6576af84b712ee999 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 24 Sep 2026 14:10:39 -0400 Subject: [PATCH 1/2] fix(cost): update Bing Grounding pricing --- ...odel_prices_and_context_window_backup.json | 4 +-- model_prices_and_context_window.json | 4 +-- .../test_bing_grounding_pricing.py | 35 +++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 tests/test_litellm/test_bing_grounding_pricing.py diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 8088fa28b521..940ba83fbbe5 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -22126,11 +22126,11 @@ } }, "bing_grounding/search": { - "input_cost_per_query": 0.035, + "input_cost_per_query": 0.014, "litellm_provider": "bing_grounding", "mode": "search", "metadata": { - "notes": "Grounding with Bing Search (G1 SKU): $35 per 1,000 transactions. Tokens for the Foundry model deployment that runs the grounded search are billed separately on that deployment." + "notes": "Grounding with Bing Search (G1 SKU): $14 per 1,000 transactions. Tokens for the Foundry model deployment that runs the grounded search are billed separately on that deployment." } }, "tinyfish/search": { diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 8088fa28b521..940ba83fbbe5 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -22126,11 +22126,11 @@ } }, "bing_grounding/search": { - "input_cost_per_query": 0.035, + "input_cost_per_query": 0.014, "litellm_provider": "bing_grounding", "mode": "search", "metadata": { - "notes": "Grounding with Bing Search (G1 SKU): $35 per 1,000 transactions. Tokens for the Foundry model deployment that runs the grounded search are billed separately on that deployment." + "notes": "Grounding with Bing Search (G1 SKU): $14 per 1,000 transactions. Tokens for the Foundry model deployment that runs the grounded search are billed separately on that deployment." } }, "tinyfish/search": { diff --git a/tests/test_litellm/test_bing_grounding_pricing.py b/tests/test_litellm/test_bing_grounding_pricing.py new file mode 100644 index 000000000000..d52107c298aa --- /dev/null +++ b/tests/test_litellm/test_bing_grounding_pricing.py @@ -0,0 +1,35 @@ +import json +from pathlib import Path +from typing import Final + + +REPO_ROOT: Final = Path(__file__).parents[2] +MAIN_PATH: Final = REPO_ROOT / "model_prices_and_context_window.json" +BACKUP_PATH: Final = ( + REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json" +) + +MODEL: Final = "bing_grounding/search" +BING_GROUNDING_COST_PER_QUERY: Final = 0.014 + + +def _load(path: Path) -> dict[str, dict[str, object]]: + with open(path, encoding="utf-8") as f: + return json.load(f) + + +def test_bing_grounding_pricing(): + model_info = _load(MAIN_PATH)[MODEL] + + assert model_info["input_cost_per_query"] == BING_GROUNDING_COST_PER_QUERY + assert model_info["litellm_provider"] == "bing_grounding" + assert model_info["mode"] == "search" + + +def test_bing_grounding_backup_matches_main(): + main_cost = _load(MAIN_PATH) + backup_cost = _load(BACKUP_PATH) + + assert MODEL in main_cost + assert MODEL in backup_cost + assert backup_cost[MODEL] == main_cost[MODEL] \ No newline at end of file From 70addc0a7974e3d5be9ba755a149926363aff9da Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 24 Sep 2026 15:01:32 -0400 Subject: [PATCH 2/2] test(cost): update Bing Grounding runtime pricing assertion --- .../test_bing_grounding_search.py | 4 ++- .../test_bing_grounding_pricing.py | 35 ------------------- 2 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 tests/test_litellm/test_bing_grounding_pricing.py diff --git a/tests/search_tests/test_bing_grounding_search.py b/tests/search_tests/test_bing_grounding_search.py index 3d1737477a14..9be390dd09aa 100644 --- a/tests/search_tests/test_bing_grounding_search.py +++ b/tests/search_tests/test_bing_grounding_search.py @@ -196,4 +196,6 @@ def test_connection_mode_tracks_the_g1_cost(self, monkeypatch: pytest.MonkeyPatc ): response = litellm.search(query="pricing check", search_provider="bing_grounding") - assert response._hidden_params["response_cost"] == pytest.approx(0.035) + # Microsoft Grounding with Bing Search pricing, accessed 2026-09-24: + # https://www.microsoft.com/en-us/bing/apis/grounding-pricing + assert response._hidden_params["response_cost"] == pytest.approx(0.014) diff --git a/tests/test_litellm/test_bing_grounding_pricing.py b/tests/test_litellm/test_bing_grounding_pricing.py deleted file mode 100644 index d52107c298aa..000000000000 --- a/tests/test_litellm/test_bing_grounding_pricing.py +++ /dev/null @@ -1,35 +0,0 @@ -import json -from pathlib import Path -from typing import Final - - -REPO_ROOT: Final = Path(__file__).parents[2] -MAIN_PATH: Final = REPO_ROOT / "model_prices_and_context_window.json" -BACKUP_PATH: Final = ( - REPO_ROOT / "litellm" / "model_prices_and_context_window_backup.json" -) - -MODEL: Final = "bing_grounding/search" -BING_GROUNDING_COST_PER_QUERY: Final = 0.014 - - -def _load(path: Path) -> dict[str, dict[str, object]]: - with open(path, encoding="utf-8") as f: - return json.load(f) - - -def test_bing_grounding_pricing(): - model_info = _load(MAIN_PATH)[MODEL] - - assert model_info["input_cost_per_query"] == BING_GROUNDING_COST_PER_QUERY - assert model_info["litellm_provider"] == "bing_grounding" - assert model_info["mode"] == "search" - - -def test_bing_grounding_backup_matches_main(): - main_cost = _load(MAIN_PATH) - backup_cost = _load(BACKUP_PATH) - - assert MODEL in main_cost - assert MODEL in backup_cost - assert backup_cost[MODEL] == main_cost[MODEL] \ No newline at end of file