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]

docs(redis): say why async paths cannot reuse redis_connect_func

mateo-berribfe54eb013c6
diff --git a/litellm/_redis.py b/litellm/_redis.py
index b78ab285ac5..8c0ce1e7a3b 100644
--- a/litellm/_redis.py
+++ b/litellm/_redis.py
@@ -577,8 +577,10 @@ def _init_async_redis_sentinel(redis_kwargs) -> async_redis.Redis:
def _async_credential_provider(redis_connect_func: object | None) -> CredentialProvider | None:
- """Async redis-py never calls ``redis_connect_func``; it authenticates through a
- ``CredentialProvider``, which it consults per connection so the token refreshes."""
+ """``redis_connect_func`` runs the AUTH exchange with the blocking client API, so on an
+ async connection its ``send_command``/``read_response`` calls return coroutines nobody
+ awaits and every connect fails. Async paths authenticate through a ``CredentialProvider``
+ instead, which redis-py consults per connection so the token stays fresh."""
gcp_service_account: Final = getattr(redis_connect_func, "_gcp_service_account", None)
if gcp_service_account is not None:
return GCPIAMCredentialProvider(gcp_service_account)