diff --git a/litellm/proxy/common_utils/reset_budget_job.py b/litellm/proxy/common_utils/reset_budget_job.py index 611926ca3fd..36c6c75591a 100644 --- a/litellm/proxy/common_utils/reset_budget_job.py +++ b/litellm/proxy/common_utils/reset_budget_job.py @@ -547,11 +547,16 @@ class ResetBudgetJob: try: from litellm.proxy.proxy_server import spend_counter_cache - cache_kwargs: Final = {"key": counter_key, "value": new_spend, **({"ttl": ttl} if ttl is not None else {})} - spend_counter_cache.in_memory_cache.set_cache(**cache_kwargs) + if ttl is None: + spend_counter_cache.in_memory_cache.set_cache(key=counter_key, value=new_spend) + else: + spend_counter_cache.in_memory_cache.set_cache(key=counter_key, value=new_spend, ttl=ttl) if spend_counter_cache.redis_cache is not None: try: - await spend_counter_cache.redis_cache.async_set_cache(**cache_kwargs) + if ttl is None: + await spend_counter_cache.redis_cache.async_set_cache(key=counter_key, value=new_spend) + else: + await spend_counter_cache.redis_cache.async_set_cache(key=counter_key, value=new_spend, ttl=ttl) except Exception as redis_err: verbose_proxy_logger.warning( "Failed to reset spend counter %s in Redis: %s. "