mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-07 14:25:13 +00:00
* Schedule budget resets at expectable times (#10331) * Enhance budget reset functionality with timezone support and standardized reset times - Added `get_next_standardized_reset_time` function to calculate budget reset times based on specified durations and timezones. - Introduced `timezone_utils.py` to manage timezone retrieval and budget reset time calculations. - Updated budget reset logic in `reset_budget_job.py`, `internal_user_endpoints.py`, `key_management_endpoints.py`, and `team_endpoints.py` to utilize the new timezone-aware reset time calculations. - Added unit tests for the new reset time functionality in `test_duration_parser.py`. - Updated `.gitignore` to include `test.py` and made minor formatting adjustments in `docker-compose.yml` for consistency. * Fixed linting * Fix for mypy * Fixed testcase for reset * fix(duration_parser.py): move off zoneinfo - doesn't work with python 3.8 * test: update test * refactor: improve budget reset time calculation and update related tests for accuracy * clean up imports in team_endpoints.py * test: update budget remaining hours assertions to reflect new reset time logic * build(model_prices_and_context_window.json): update model --------- Co-authored-by: Prathamesh Saraf <pratamesh1867@gmail.com>
This commit is contained in:
co-authored by
Prathamesh Saraf
parent
d783190e04
commit
290e2528cd
@@ -0,0 +1,33 @@
|
||||
## Budget Reset Times and Timezones
|
||||
|
||||
LiteLLM now supports predictable budget reset times that align with natural calendar boundaries:
|
||||
|
||||
- All budgets reset at midnight (00:00:00) in the configured timezone
|
||||
- Special handling for common durations:
|
||||
- Daily (24h/1d): Reset at midnight every day
|
||||
- Weekly (7d): Reset on Monday at midnight
|
||||
- Monthly (30d): Reset on the 1st of each month at midnight
|
||||
|
||||
### Configuring the Timezone
|
||||
|
||||
You can specify the timezone for all budget resets in your configuration file:
|
||||
|
||||
```yaml
|
||||
litellm_settings:
|
||||
max_budget: 100 # (float) sets max budget as $100 USD
|
||||
budget_duration: 30d # (number)(s/m/h/d)
|
||||
timezone: "US/Eastern" # Any valid timezone string
|
||||
```
|
||||
|
||||
This ensures that all budget resets happen at midnight in your specified timezone rather than in UTC.
|
||||
If no timezone is specified, UTC will be used by default.
|
||||
|
||||
Common timezone values:
|
||||
|
||||
- `UTC` - Coordinated Universal Time
|
||||
- `US/Eastern` - Eastern Time
|
||||
- `US/Pacific` - Pacific Time
|
||||
- `Europe/London` - UK Time
|
||||
- `Asia/Kolkata` - Indian Standard Time (IST)
|
||||
- `Asia/Tokyo` - Japan Standard Time
|
||||
- `Australia/Sydney` - Australian Eastern Time
|
||||
Reference in New Issue
Block a user