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/litellm_team_member_temp_budget_increase' into litellm_team_member_temp_budget_increase

yassin1f8f7529e85d
diff --cc tests/test_litellm/models/test_models.py
index 46648efdfff,9b803c14062..4845dd8a7df
--- a/tests/test_litellm/models/test_models.py
+++ b/tests/test_litellm/models/test_models.py
@@@ -71,27 -71,6 +71,25 @@@ class TestBudget
assert budget.max_budget is None
assert budget.allowed_models is None
+ def test_effective_max_budget_applies_unexpired_increase(self):
+ budget = LiteLLM_BudgetTable(
+ max_budget=100.0,
+ temp_budget_increase=50.0,
+ temp_budget_expiry=datetime(2100, 1, 1),
+ )
+ assert budget.effective_max_budget(now=datetime(2026, 1, 1, tzinfo=timezone.utc)) == 150.0
+
+ def test_effective_max_budget_ignores_expired_increase(self):
- budget = LiteLLM_BudgetTable(
- max_budget=100.0,
- temp_budget_increase=50.0,
- temp_budget_expiry=datetime(2020, 1, 1, tzinfo=timezone.utc),
- )
++ expiry = datetime(2020, 1, 1, tzinfo=timezone.utc)
++ budget = LiteLLM_BudgetTable(max_budget=100.0, temp_budget_increase=50.0, temp_budget_expiry=expiry)
+ assert budget.effective_max_budget(now=datetime(2026, 1, 1, tzinfo=timezone.utc)) == 100.0
++ assert budget.effective_max_budget(now=expiry) == 100.0
+
+ def test_effective_max_budget_without_increase(self):
+ now = datetime(2026, 1, 1, tzinfo=timezone.utc)
+ assert LiteLLM_BudgetTable(max_budget=100.0).effective_max_budget(now=now) == 100.0
+ assert LiteLLM_BudgetTable(max_budget=None, temp_budget_increase=50.0).effective_max_budget(now=now) is None
+
class TestCredentials:
def test_credentials_creation(self):