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]

style: use 'is not None' for port check (handle port 0 explicitly)

useraa2f05f8c966
diff --git a/litellm/litellm_core_utils/url_utils.py b/litellm/litellm_core_utils/url_utils.py
index d22f92642a3..b55882819de 100644
--- a/litellm/litellm_core_utils/url_utils.py
+++ b/litellm/litellm_core_utils/url_utils.py
@@ -170,7 +170,7 @@ def validate_url(url: str) -> Tuple[str, str]:
is_ipv6 = addrinfo[0][0] == socket.AF_INET6
ip_host = f"[{validated_ip}]" if is_ipv6 else validated_ip
- if port:
+ if port is not None:
new_netloc = f"{ip_host}:{port}"
else:
new_netloc = ip_host