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
perf: Optimize strip_trailing_slash with O(1) index check (#19679)
ryan-crabbe0133d50a45e7
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex d3bcfe8200e..72ebced05d9 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -4652,7 +4652,10 @@ class StandardLoggingPayloadSetup:@staticmethoddef strip_trailing_slash(api_base: Optional[str]) -> Optional[str]:if api_base:- return api_base.rstrip("/")+ if api_base.endswith("//"):+ return api_base.rstrip("/")+ if api_base[-1] == "/":+ return api_base[:-1]return api_base@staticmethod