From 16e5642c25aa6aedc068f0f55f0ac41b12ecd732 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Tue, 15 Sep 2026 13:04:45 -0500 Subject: [PATCH] fix(router): type per-key spend totals without loop Final bindings --- litellm/router_strategy/budget_limiter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/router_strategy/budget_limiter.py b/litellm/router_strategy/budget_limiter.py index 6fd2a2534ce..fe736c56b5e 100644 --- a/litellm/router_strategy/budget_limiter.py +++ b/litellm/router_strategy/budget_limiter.py @@ -677,12 +677,12 @@ class RouterBudgetLimiting(CustomLogger): for key, value in redis_values.items(): if value is None: continue - pending_spend: Final = sum( + pending_spend = sum( # rebind-ok: each cache key has independent queued spend operation["increment_value"] for operation in self.redis_increment_operation_queue if operation["key"] == key ) - updated_spend: Final = float(value) + pending_spend + updated_spend = float(value) + pending_spend # rebind-ok: each cache key has an independent total await self.dual_cache.in_memory_cache.async_set_cache(key=key, value=updated_spend) verbose_router_logger.debug("Updated in-memory cache for %s: %s", key, updated_spend)