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]

Update litellm/proxy/utils.py

Harshit Jaind90f3d558ed7
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index 4084284f7d0..f7e32869a23 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -2075,11 +2075,8 @@ async def _lookup_deprecated_key(
now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS,
)
return deprecated_row.active_token_id
- # Cache negative result to avoid repeated DB lookups for invalid tokens
- _deprecated_key_cache[hashed_token] = (
- None,
- now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS,
- )
+ # Only cache positive results; negative lookups are fast on indexed columns
+ # and caching them risks evicting real deprecated key entries.
except Exception as e:
verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e)