BerriAI/litellm · error · HTTPException
reset_to ({reset_to}) must be <= budget ({max_budget})
Error message
reset_to ({reset_to}) must be <= budget ({max_budget}) What it means
Error "reset_to ({reset_to}) must be <= budget ({max_budget})" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:5132
detail={"error": "reset_to must be >= 0"},
)
current_spend: Final = key_in_db.spend or 0.0
if reset_to > current_spend:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail={"error": f"reset_to ({reset_to}) must be <= current spend ({current_spend})"},
)
max_budget = key_in_db.max_budget
if key_in_db.litellm_budget_table is not None:
budget_max_budget: Final = getattr(key_in_db.litellm_budget_table, "max_budget", None)
if budget_max_budget is not None:
if max_budget is None or budget_max_budget < max_budget:
max_budget = budget_max_budget
if max_budget is not None and reset_to > max_budget:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail={"error": f"reset_to ({reset_to}) must be <= budget ({max_budget})"},
)
return reset_to
@router.post(
"/key/{key:path}/reset_spend",
tags=["key management"],
dependencies=[Depends(user_api_key_auth)],
)
@management_endpoint_wrapper
async def reset_key_spend_fn(
key: str,
data: ResetSpendRequest,
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
litellm_changed_by: str | None = Header(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Choose a reset_to value less than or equal to the key's max_budget.
- Raise the key's budget first if you need a higher spend ceiling.
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:5132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/c86674f522e6cc10.
Report an issue: GitHub.