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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
feat log use_x_forwarded_for
Ishaan Jaff0c6c350c2347
diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.pyindex 13f9475c5c7..990cb52337c 100644--- a/litellm/proxy/litellm_pre_call_utils.py+++ b/litellm/proxy/litellm_pre_call_utils.py@@ -177,7 +177,17 @@ async def add_litellm_data_to_request(requester_ip_address = ""if premium_user is True:# Only set the IP Address for Enterprise Users++ # logic for tracking IP Addressif (+ general_settings is not None+ and general_settings.get("use_x_forwarded_for") is True+ and request is not None+ and hasattr(request, "headers")+ and "x-forwarded-for" in request.headers+ ):+ requester_ip_address = request.headers["x-forwarded-for"]+ elif (request is not Noneand hasattr(request, "client")and hasattr(request.client, "host")