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]

use _check_valid_ip

Ishaan Jaffb94c982ec96b
diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.py
index 2e74d311062..5df9674172d 100644
--- a/litellm/proxy/auth/user_api_key_auth.py
+++ b/litellm/proxy/auth/user_api_key_auth.py
@@ -1225,8 +1225,6 @@ def _check_valid_ip(
client_ip = request.headers["x-forwarded-for"]
elif request.client is not None:
client_ip = request.client.host
- else:
- client_ip = None
# Check if IP address is allowed
if client_ip not in allowed_ips: