Check for existing issues
What happened?
The max_end_user_budget_id feature doesn't respect budget reset configurations. While RPM, TPM, and max_budget are honored, an end-user's "spend" continuously increases without periodic resets, making true cost budgeting impossible. This essentially makes this feature unusable as the total customer spend will always be increasing and we cannot set a budget on cost.
Root Cause:
The system fetches total cumulative spend from /customer/info?end_user_id=xxx, which is then compared against max_budget without considering any reset schedule.
Relevant code link: if end_user_budget is not None and end_user_object.spend > end_user_budget:
Expected Behavior:
When max_end_user_budget_id is configured, the system should:
- Allow for the definition of a budget reset period (e.g., daily, weekly, monthly).
- Reset the end-user's "spend" counter at the beginning of each budget period.
- Enforce
max_budget against the spend accumulated within the current budget period.
Steps to Reproduce
- Create a new budget specifying
Max Budget (USD) and Reset Budget values.
- In LiteLLM Proxy config.yaml set
litellm_settings.max_end_user_budget_id to the id of the above created budget.
- (Optional) Set
litellm_settings.timezone to the appropriate timezone ("Asia/Kolakata" in my case)
- Start using LiteLLM and check how the budget doesn't reset after the specified period.
Relevant log output
What part of LiteLLM is this about?
Proxy
What LiteLLM version are you on ?
v1.81.12
Twitter / LinkedIn details
@venkivijay_ / https://linkedin.com/in/venkivijay
Check for existing issues
What happened?
The
max_end_user_budget_idfeature doesn't respect budget reset configurations. While RPM, TPM, and max_budget are honored, an end-user's "spend" continuously increases without periodic resets, making true cost budgeting impossible. This essentially makes this feature unusable as the total customer spend will always be increasing and we cannot set a budget on cost.Root Cause:
The system fetches total cumulative spend from /customer/info?end_user_id=xxx, which is then compared against max_budget without considering any reset schedule.
Relevant code link: if end_user_budget is not None and end_user_object.spend > end_user_budget:
Expected Behavior:
When
max_end_user_budget_idis configured, the system should:max_budgetagainst the spend accumulated within the current budget period.Steps to Reproduce
Max Budget (USD)andReset Budgetvalues.litellm_settings.max_end_user_budget_idto the id of the above created budget.litellm_settings.timezoneto the appropriate timezone ("Asia/Kolakata" in my case)Relevant log output
What part of LiteLLM is this about?
Proxy
What LiteLLM version are you on ?
v1.81.12
Twitter / LinkedIn details
@venkivijay_ / https://linkedin.com/in/venkivijay