BerriAI/litellm · error · ValueError
temp_budget_increase and temp_budget_expiry must be set toge
Error message
temp_budget_increase and temp_budget_expiry must be set together
What it means
Model validator on KeyUpdateFields: only one of temp_budget_increase / temp_budget_expiry was set. Temporary budget grants are a pair (amount plus when it expires), so specifying just one is rejected to prevent an unexpiring or amount-less grant.
Source
Thrown at litellm/types/proxy/management_endpoints/key_management_endpoints.py:82
rpm_limit_type: Literal["guaranteed_throughput", "best_effort_throughput", "dynamic"] | None = None
tpm_limit_type: Literal["guaranteed_throughput", "best_effort_throughput", "dynamic"] | None = None
# Temporary budget grants (auto-expire). `spend` deliberately omitted — bulk-zeroing it bypasses budget enforcement; admin-only via /key/update.
temp_budget_increase: float | None = None
temp_budget_expiry: datetime | None = None
# Expiry
duration: str | None = None
# Operational metadata
tags: list[str] | None = None
metadata: dict[str, Any] | None = None
@model_validator(mode="after")
def validate_temp_budget(self) -> "KeyUpdateFields":
if self.temp_budget_increase is not None or self.temp_budget_expiry is not None:
if self.temp_budget_increase is None or self.temp_budget_expiry is None:
raise ValueError("temp_budget_increase and temp_budget_expiry must be set together")
return self
@model_validator(mode="after")
def require_at_least_one_field(self) -> "KeyUpdateFields":
# Reject empty payload — would iterate every key with no-op writes.
if not self.model_fields_set:
raise ValueError("update_fields must specify at least one field to update.")
return self
class BulkUpdateTeamKeysRequest(BaseModel):
"""Apply one update payload to many keys inside a team; provide either `key_ids` or `all_keys_in_team=True`."""
team_id: str
key_ids: list[str] | None = None
all_keys_in_team: bool = False
update_fields: KeyUpdateFields
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set both temp_budget_increase and temp_budget_expiry, or neither.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/types/proxy/management_endpoints/key_management_endpoints.py:82 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/fb58d4ff637a6a6e.
Report an issue: GitHub.