Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: drop Final from loop locals to stay within the basedpyright budget

Thijmen Stavenuiterdb67bafd59a0
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index 5e4642d66a9..51b9ebf91d8 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -3555,7 +3555,7 @@ async def _attach_budget_limits_usage(key_info: dict, api_key_hash: str) -> None
return
for idx, window in enumerate(budget_limits):
- w: Final = _budget_window_to_dict(window)
+ w = _budget_window_to_dict(window)
if not w:
continue
budget_limits[idx] = w
@@ -3567,8 +3567,8 @@ async def _attach_budget_limits_usage(key_info: dict, api_key_hash: str) -> None
max_budget = float(max_budget) if max_budget is not None else None
except (TypeError, ValueError):
max_budget = None
- counter_key: Final = f"spend:key:{api_key_hash}:window:{duration}"
- spend: Final = await get_current_spend(
+ counter_key = f"spend:key:{api_key_hash}:window:{duration}"
+ spend = await get_current_spend(
counter_key=counter_key,
fallback_spend=0.0,
max_budget=max_budget,
diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts
index 3b4b96bdd4e..f4703202b18 100644
--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts
+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts
@@ -7020,6 +7020,9 @@ export interface paths {
* - model_max_budget: dict - Per-model budgets, e.g. {"gpt-4": {"budget_limit": 0.0005, "time_period": "30d"}}
* - model_max_budget_usage: dict | None - Current-window spend per model, present only when
* the key has per-model budgets
+ * - budget_limits: list | None - Concurrent budget windows. Each entry includes
+ * current_spend: spend accumulated in the window so far (read from the same cross-pod
+ * spend counter the budget enforcement uses)
* - models: list - Model_name's the key is allowed to call
* - tpm_limit / rpm_limit: int | None - Tokens and requests per minute limits
* - metadata: dict - Metadata for the key, e.g. {"team": "core-infra"}