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(proxy): apply temp budget increase at member spend admission and reservation checks

Devin AI32d1dd0cde1f
diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.py
index 4cbd4213463..c2dc9b16735 100644
--- a/litellm/proxy/auth/user_api_key_auth.py
+++ b/litellm/proxy/auth/user_api_key_auth.py
@@ -46,6 +46,7 @@ from litellm.proxy.auth.auth_checks import (
_can_object_call_model,
_check_end_user_budget,
_delete_cache_key_object,
+ _effective_team_member_budget,
_get_user_role,
_is_model_cost_zero,
_is_user_proxy_admin,
@@ -2248,7 +2249,10 @@ async def _user_api_key_auth_builder(
)
if team_member_info is not None and team_member_info.litellm_budget_table is not None:
- team_member_budget: Final = team_member_info.litellm_budget_table.max_budget
+ team_member_budget: Final = _effective_team_member_budget(
+ team_member_info.litellm_budget_table,
+ now=datetime.now(timezone.utc),
+ )
if team_member_budget is not None and team_member_budget > 0:
# Read from cross-pod counter (Redis-first) if available
from litellm.proxy.proxy_server import get_current_spend
diff --git a/litellm/proxy/spend_tracking/budget_reservation.py b/litellm/proxy/spend_tracking/budget_reservation.py
index 373f2d0fe36..1c6f20e515b 100644
--- a/litellm/proxy/spend_tracking/budget_reservation.py
+++ b/litellm/proxy/spend_tracking/budget_reservation.py
@@ -690,7 +690,12 @@ async def _get_team_member_budget_counter(
team_member_budget: float | None = None
if team_membership is not None and team_membership.litellm_budget_table is not None:
- team_member_budget = team_membership.litellm_budget_table.max_budget
+ from litellm.proxy.auth.auth_checks import _effective_team_member_budget
+
+ team_member_budget = _effective_team_member_budget(
+ team_membership.litellm_budget_table,
+ now=datetime.now(timezone.utc),
+ )
else:
default_budget_id: Final = (team_object.metadata or {}).get("team_member_budget_id")
if isinstance(default_budget_id, str):