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]

fix(management_v1): report a zero team default as no cap

ryan-crabbe-berri4f6dfb0480a7
diff --git a/litellm/proxy/management_helpers/bulk_team_member_budgets.py b/litellm/proxy/management_helpers/bulk_team_member_budgets.py
index 4116ea2b513..449ff5487e0 100644
--- a/litellm/proxy/management_helpers/bulk_team_member_budgets.py
+++ b/litellm/proxy/management_helpers/bulk_team_member_budgets.py
@@ -92,7 +92,7 @@ def _result(
)
budget: Final = budget_of.get(user_id)
own_max_budget: Final = budget.max_budget if budget is not None else None
- inherits: Final = own_max_budget is None and team_default_max_budget is not None
+ inherits: Final = own_max_budget is None and team_default_max_budget is not None and team_default_max_budget > 0
return TeamMemberBudgetUpdateResult(
user_id=user_id,
user_email=member.user_email,
diff --git a/tests/test_litellm/proxy/management_endpoints/management_v1/test_teams.py b/tests/test_litellm/proxy/management_endpoints/management_v1/test_teams.py
index 948b9a31a69..ad22b030283 100644
--- a/tests/test_litellm/proxy/management_endpoints/management_v1/test_teams.py
+++ b/tests/test_litellm/proxy/management_endpoints/management_v1/test_teams.py
@@ -542,6 +542,20 @@ async def test_a_team_with_no_default_budget_reports_no_effective_cap_for_a_memb
assert (results[0].tpm_limit, results[0].rpm_limit) == (5, 3)
+async def test_a_zero_team_default_reports_no_cap_because_enforcement_reads_zero_there_as_uncapped():
+ prisma = _FakePrisma(
+ teams=[_team("m1", default_budget_id="team-default")],
+ memberships=[_membership("m1", None)],
+ budgets=[_budget("team-default", max_budget=0.0)],
+ )
+
+ results = await _bulk_update(prisma, [{"user_id": "m1", "tpm_limit": 9}])
+
+ assert [(r.success, r.max_budget, r.max_budget_source) for r in results] == [(True, None, None)]
+ assert results[0].tpm_limit == 9
+
+
@pytest.mark.asyncio
async def test_a_row_that_names_nobody_on_the_team_reports_no_cap_and_no_source():
prisma = _FakePrisma(