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]

Add INFO-level session reuse logging per request (#20597)

Alexsander Hamir5733f6213b5e
diff --git a/litellm/proxy/route_llm_request.py b/litellm/proxy/route_llm_request.py
index 92fb88f7147..6baa2047d73 100644
--- a/litellm/proxy/route_llm_request.py
+++ b/litellm/proxy/route_llm_request.py
@@ -97,10 +97,18 @@ def add_shared_session_to_data(data: dict) -> None:
data: Dictionary to add the shared session to
"""
try:
+ from litellm._logging import verbose_proxy_logger
from litellm.proxy.proxy_server import shared_aiohttp_session
if shared_aiohttp_session is not None and not shared_aiohttp_session.closed:
data["shared_session"] = shared_aiohttp_session
+ verbose_proxy_logger.info(
+ f"SESSION REUSE: Attached shared aiohttp session to request (ID: {id(shared_aiohttp_session)})"
+ )
+ else:
+ verbose_proxy_logger.info(
+ "SESSION REUSE: No shared session available for this request"
+ )
except Exception:
# Silently continue without session reuse if import fails or session unavailable
pass