mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
test(model_prices): update data residency tests to use gpt-5.4 as the uplift model
The tests were using gpt-5 which no longer carries the regional processing uplift after correcting which models have it. Switch to gpt-5.4 (released 2026-03-05, the cutoff date) and add a regression parametrize covering all pre-cutoff models to pin that they stay uplift-free.
This commit is contained in:
parent
8900535d7c
commit
0f15f7857f
1 changed files with 26 additions and 8 deletions
|
|
@ -1499,19 +1499,20 @@ def _local_model_cost_map():
|
|||
|
||||
@pytest.mark.parametrize("data_residency", ["eu", "us"])
|
||||
def test_data_residency_applies_uplift(data_residency, _local_model_cost_map):
|
||||
"""gpt-5 should apply the regional processing uplift multiplier when
|
||||
data_residency is set."""
|
||||
"""gpt-5.4 should apply the regional processing uplift multiplier when
|
||||
data_residency is set. gpt-5.4+ (released 2026-03-05) carry the 10% uplift;
|
||||
gpt-5 and older models do not."""
|
||||
from litellm.types.utils import Usage
|
||||
|
||||
usage = Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
|
||||
|
||||
base = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
)
|
||||
regional = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
data_residency=data_residency,
|
||||
|
|
@ -1526,6 +1527,23 @@ def test_data_residency_applies_uplift(data_residency, _local_model_cost_map):
|
|||
assert regional[1] == pytest.approx(base[1] * 1.10, rel=1e-9)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model", ["gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-4o", "gpt-4.1"])
|
||||
def test_data_residency_no_uplift_for_pre_march_2026_models(model, _local_model_cost_map):
|
||||
"""Models released before 2026-03-05 must not have the regional uplift."""
|
||||
from litellm.types.utils import Usage
|
||||
|
||||
usage = Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
|
||||
|
||||
base = generic_cost_per_token(model=model, usage=usage, custom_llm_provider="openai")
|
||||
regional = generic_cost_per_token(
|
||||
model=model, usage=usage, custom_llm_provider="openai", data_residency="eu"
|
||||
)
|
||||
|
||||
assert base == regional, (
|
||||
f"{model} should not have a regional uplift, but cost changed with data_residency"
|
||||
)
|
||||
|
||||
|
||||
def test_data_residency_no_uplift_for_unmarked_model(_local_model_cost_map):
|
||||
"""A model without a regional_processing_uplift_multiplier_* entry should
|
||||
fall back to base pricing, not error."""
|
||||
|
|
@ -1555,12 +1573,12 @@ def test_data_residency_none_no_uplift(_local_model_cost_map):
|
|||
usage = Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
|
||||
|
||||
base = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
)
|
||||
explicit_none = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
data_residency=None,
|
||||
|
|
@ -1576,13 +1594,13 @@ def test_data_residency_composes_with_service_tier(_local_model_cost_map):
|
|||
usage = Usage(prompt_tokens=1000, completion_tokens=500, total_tokens=1500)
|
||||
|
||||
priority_base = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
service_tier="priority",
|
||||
)
|
||||
priority_eu = generic_cost_per_token(
|
||||
model="gpt-5",
|
||||
model="gpt-5.4",
|
||||
usage=usage,
|
||||
custom_llm_provider="openai",
|
||||
service_tier="priority",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue