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 _reset_budget_for_key/team/user

Ishaan Jaff91f4d4d865d7
diff --git a/litellm/proxy/common_utils/reset_budget_job.py b/litellm/proxy/common_utils/reset_budget_job.py
index 810b8c08c4f..6a1842fc134 100644
--- a/litellm/proxy/common_utils/reset_budget_job.py
+++ b/litellm/proxy/common_utils/reset_budget_job.py
@@ -319,7 +319,7 @@ class ResetBudgetJob:
item: Union[LiteLLM_TeamTable, LiteLLM_UserTable, LiteLLM_VerificationToken],
current_time: datetime,
item_type: str,
- ) -> Union[LiteLLM_TeamTable, LiteLLM_UserTable, LiteLLM_VerificationToken]:
+ ):
"""
Common logic for resetting budget for a team, user, or key
"""
@@ -339,19 +339,19 @@ class ResetBudgetJob:
async def _reset_budget_for_team(
team: LiteLLM_TeamTable, current_time: datetime
) -> Optional[LiteLLM_TeamTable]:
- result = await ResetBudgetJob._reset_budget_common(team, current_time, "team")
- return result if isinstance(result, LiteLLM_TeamTable) else None
+ await ResetBudgetJob._reset_budget_common(team, current_time, "team")
+ return team
@staticmethod
async def _reset_budget_for_user(
user: LiteLLM_UserTable, current_time: datetime
) -> Optional[LiteLLM_UserTable]:
- result = await ResetBudgetJob._reset_budget_common(user, current_time, "user")
- return result if isinstance(result, LiteLLM_UserTable) else None
+ await ResetBudgetJob._reset_budget_common(user, current_time, "user")
+ return user
@staticmethod
async def _reset_budget_for_key(
key: LiteLLM_VerificationToken, current_time: datetime
) -> Optional[LiteLLM_VerificationToken]:
- result = await ResetBudgetJob._reset_budget_common(key, current_time, "key")
- return result if isinstance(result, LiteLLM_VerificationToken) else None
+ await ResetBudgetJob._reset_budget_common(key, current_time, "key")
+ return key