fix(proxy): clear budget_reset_at when budget_duration set to null on team update

This commit is contained in:
PRABHU KIRAN VANDRANKI 2026-05-19 19:17:28 -04:00
parent 05542d9b60
commit 0abed249c2

View file

@ -1881,11 +1881,16 @@ async def update_team( # noqa: PLR0915
def _set_budget_reset_at(data: UpdateTeamRequest, updated_kv: dict) -> None:
"""Set budget_reset_at in updated_kv if budget_duration is provided."""
if "budget_duration" not in data.model_fields_set:
return
if data.budget_duration is not None:
from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time
reset_at = get_budget_reset_time(budget_duration=data.budget_duration)
updated_kv["budget_reset_at"] = reset_at
else:
# budget_duration explicitly set to null: clear the field and reset time
updated_kv["budget_reset_at"] = None
if data.budget_limits is not None and len(data.budget_limits) > 0:
from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time