Skip to content

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]

Merge remote-tracking branch 'origin/main' into litellm_registry_audit_2026_09_14

Devin AIae5451b07d8e
diff --cc tests/test_litellm/llms/gemini/test_cost_calculator.py
index 85d62030c00,2d56757c601..8ad27411ce3
--- a/tests/test_litellm/llms/gemini/test_cost_calculator.py
+++ b/tests/test_litellm/llms/gemini/test_cost_calculator.py
@@@ -452,67 -452,6 +452,40 @@@ def test_map_traffic_type_to_service_ti
)
- @pytest.mark.parametrize(
- "model,custom_llm_provider,expected_cache_read_cost",
- [
- ("gemini/gemini-flash-latest", "gemini", 7.5e-08),
- ("gemini/gemini-flash-lite-latest", "gemini", 3e-08),
- ("gemini/gemini-2.5-flash-preview-09-2025", "gemini", 3e-08),
- ("gemini/gemini-2.5-flash-lite-preview-06-17", "gemini", 1e-08),
- ("vertex_ai/gemini-2.5-flash-preview-09-2025", "vertex_ai", 3e-08),
- ("vertex_ai/gemini-2.5-flash-lite-preview-06-17", "vertex_ai", 1e-08),
- ],
- )
- def test_flash_alias_cache_read_is_ten_percent_of_input(
- monkeypatch, model, custom_llm_provider, expected_cache_read_cost
- ):
- monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
- monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
-
- model_info = litellm.get_model_info(
- model=model, custom_llm_provider=custom_llm_provider
- )
-
- assert model_info["cache_read_input_token_cost"] == expected_cache_read_cost
- assert model_info["cache_read_input_token_cost"] == pytest.approx(
- 0.10 * model_info["input_cost_per_token"]
- )
-
-
+ "alias,target",
+ [
+ ("gemini/gemini-flash-latest", "gemini/gemini-3.8-flash"),
+ ("gemini/gemini-flash-lite-latest", "gemini/gemini-3.5-flash-lite"),
+ ("gemini/gemini-pro-latest", "gemini/gemini-3.1-pro-preview"),
+ ],
+)
+def test_latest_aliases_cost_the_same_as_their_current_target(
+ monkeypatch, alias, target
+):
+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+
+ usage = Usage(
+ prompt_tokens=1_000,
+ completion_tokens=500,
+ total_tokens=1_500,
+ prompt_tokens_details=PromptTokensDetailsWrapper(cached_tokens=400),
+ )
+
+ def cost_of(model: str) -> float:
+ return completion_cost(
+ completion_response=ModelResponse(model=model, usage=usage),
+ model=model,
+ custom_llm_provider="gemini",
+ )
+
+ alias_cost = cost_of(alias)
+ target_cost = cost_of(target)
+ assert alias_cost == pytest.approx(target_cost)
+ assert alias_cost > 0
+
+
@pytest.mark.parametrize(
"prefixed,bare",
[