Merge pull request #41154 from BerriAI/litellm-providers/price-sync

chore(prices): sync Azure, Azure AI, Gemini, OpenAI, Bedrock, Together AI, Fireworks and Vertex prices: 278 models, 59 new, 30 deprecated
This commit is contained in:
kerry-berri 2026-09-16 10:37:21 -07:00 committed by GitHub
commit 4e996400e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 2672 additions and 597 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -38,37 +38,6 @@ def use_local_model_cost_map():
monkeypatch.undo()
@pytest.mark.parametrize(
"model_name,expected_prompt,expected_completion",
[
("FW-Kimi-K2.6", 1.045, 4.4),
("FW-DeepSeek-V4-Pro", 1.925, 3.828),
("FW-GLM-5.2", 1.54, 4.84),
("FW-Kimi-K3", 3.3, 16.5),
("FW-MiniMax-M2.5", 0.33, 1.32),
("FW-Inkling", 1.0, 4.05),
("FW-Nemotron-3-Ultra-NVFP4", 0.6, 2.4),
("FW-Nemotron-Lightning-3.5-30B-A3B", 0.06, 0.22),
],
)
def test_azure_ai_fw_cost_per_token(
use_local_model_cost_map, model_name, expected_prompt, expected_completion
):
from litellm.llms.azure_ai.cost_calculator import cost_per_token
from litellm.types.utils import Usage
usage = Usage(
prompt_tokens=1_000_000,
completion_tokens=1_000_000,
total_tokens=2_000_000,
)
prompt_cost, completion_cost = cost_per_token(model=model_name, usage=usage)
assert prompt_cost == pytest.approx(expected_prompt)
assert completion_cost == pytest.approx(expected_completion)
def test_azure_ai_fw_nemotron_lightning_supports_tool_choice(use_local_model_cost_map):
from litellm.llms.azure_ai.chat.transformation import AzureAIStudioConfig

View file

@ -356,29 +356,6 @@ def test_openai_style_cache_write_tokens_are_netted_out():
)
def test_sub_input_cache_write_price_is_an_extra_saving():
"""A few models price writes below input; there the premium is a real credit.
Clamping the premium at zero would silently undercount these, so the subtraction
stays signed. ``azure/eu/gpt-4o-2024-11-20`` ships a write price at ~0.5x input.
"""
model = "azure/eu/gpt-4o-2024-11-20"
info = litellm.get_model_info(model=model)
input_cost = info["input_cost_per_token"]
cheap_write = info["cache_creation_input_token_cost"]
assert 0 < cheap_write < input_cost, "fixture drifted: this test needs a model pricing cache writes below input"
result = compute_savings_spend(
model=model,
custom_llm_provider=None,
compression_saved_tokens=0,
gateway_injected_cache=True,
usage_object=_caching_usage(read=1000, written=4000),
)
assert result.prompt_caching == pytest.approx(4000 * (input_cost - cheap_write))
assert result.prompt_caching > 0
def test_negative_cache_write_count_clamps_to_zero():
"""A malformed negative write count must not be read as a saving."""
input_cost, cache_read_cost = _anthropic_costs("claude-sonnet-5")

View file

@ -1616,73 +1616,6 @@ def test_azure_ai_cache_cost_calculation(_local_model_cost_map):
)
AZURE_GPT_5_6_MAP_KEYS = (
"azure/gpt-5.6",
"azure/gpt-5.6-sol",
"azure/gpt-5.6-terra",
"azure/gpt-5.6-luna",
"azure/us/gpt-5.6",
"azure/us/gpt-5.6-sol",
"azure/us/gpt-5.6-terra",
"azure/us/gpt-5.6-luna",
"azure/eu/gpt-5.6",
"azure/eu/gpt-5.6-sol",
"azure/eu/gpt-5.6-terra",
"azure/eu/gpt-5.6-luna",
)
def test_azure_gpt_5_6_cache_write_tokens_are_billed(_local_model_cost_map):
"""
Azure bills gpt-5.6 prompt cache writes at 1.25x the input rate on every
tier, but the azure entries carried no ``cache_creation_input_token_cost``,
so cache-write tokens were billed at the plain input rate instead.
"""
from litellm.litellm_core_utils.llm_cost_calc.utils import generic_cost_per_token
from litellm.types.utils import PromptTokensDetailsWrapper, Usage
usage = Usage(
completion_tokens=100,
prompt_tokens=2000,
total_tokens=2100,
prompt_tokens_details=PromptTokensDetailsWrapper(cached_tokens=0, text_tokens=687),
cache_creation_input_tokens=1313,
)
input_cost, output_cost = generic_cost_per_token(
model="azure/gpt-5.6-luna", usage=usage, custom_llm_provider="azure"
)
assert input_cost == pytest.approx(687 * 2e-07 + 1313 * 2.5e-07)
assert output_cost == pytest.approx(100 * 1.2e-06)
@pytest.mark.parametrize("model", AZURE_GPT_5_6_MAP_KEYS)
def test_azure_gpt_5_6_rates_match_azure_price_page(_local_model_cost_map, model):
"""
Per the Azure OpenAI price page (rendered 2026-08-26): cache writes cost
1.25x input on every gpt-5.6 tier, and Data Zone costs 1.1x Global for
standard and priority alike (us/eu priority rates previously sat at 1.25x).
"""
entry = litellm.model_cost[model]
input_keys = [key for key in entry if key.startswith("input_cost_per_token")]
assert input_keys
for key in input_keys:
suffix = key[len("input_cost_per_token") :]
assert entry["cache_creation_input_token_cost" + suffix] == pytest.approx(entry[key] * 1.25)
zone = model.split("/")[1]
if zone in ("us", "eu"):
global_entry = litellm.model_cost["azure/" + model.split("/", 2)[2]]
prefixes = ("input_cost_per_token", "output_cost_per_token", "cache_read", "cache_creation")
token_cost_keys = [key for key in entry if key.startswith(prefixes)]
global_token_cost_keys = [key for key in global_entry if key.startswith(prefixes)]
assert len(token_cost_keys) >= 9
assert sorted(token_cost_keys) == sorted(global_token_cost_keys)
for key in token_cost_keys:
assert entry[key] == pytest.approx(global_entry[key] * 1.1), key
def test_vertex_regional_deployment_costs_uplift_over_global(monkeypatch):
"""
Regression for https://github.com/BerriAI/litellm/issues/34393: two Vertex