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
fix get_request_route
Ishaan Jaff6d2063d1cb55
diff --git a/litellm/proxy/auth/auth_utils.py b/litellm/proxy/auth/auth_utils.pyindex aa48a6396ab..d1e1b170983 100644--- a/litellm/proxy/auth/auth_utils.py+++ b/litellm/proxy/auth/auth_utils.py@@ -86,10 +86,16 @@ def get_request_route(request: Request) -> str:remove base url from path if set e.g. `/genai/chat/completions` -> `/chat/completions"""- if request.url.path.startswith(request.base_url.path):- # remove base_url from path- return request.url.path[len(request.base_url.path) - 1 :]- else:+ try:+ if request.url.path.startswith(request.base_url.path):+ # remove base_url from path+ return request.url.path[len(request.base_url.path) - 1 :]+ else:+ return request.url.path+ except Exception as e:+ verbose_proxy_logger.warning(+ f"error on get_request_route: {str(e)}, defaulting to request.url.path"+ )return request.url.path