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
address greptile review: move early return before pre_call, trim comments
michelligabriele583bdb279b36
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex 24fcbde1a0b..d091a263df7 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -2923,7 +2923,7 @@ class Logging(LiteLLMLoggingBaseClass):isinstance(callback, CustomLogger)and is_sync_requestand self.call_type- != CallTypes.pass_through.value # pass-through endpoints call async_log_failure_event+ != CallTypes.pass_through.value): # custom logger classcallback.log_failure_event(start_time=start_time,diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.pyindex 871d9848aba..0aa99685209 100644--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py@@ -961,8 +961,6 @@ async def pass_through_request( # noqa: PLR0915if kwargs:for key, value in kwargs.items():request_payload[key] = value- # Ensure the original logging_obj is in request_payload so- # _handle_logging_proxy_only_error reuses it (preserving call_type)if logging_obj is not None:request_payload["litellm_logging_obj"] = logging_objdiff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.pyindex 695f75b86e9..b0d709abbb6 100644--- a/litellm/proxy/utils.py+++ b/litellm/proxy/utils.py@@ -1877,19 +1877,16 @@ class ProxyLogging:litellm_logging_obj.model_call_details["input"] = inputif litellm_logging_obj.call_type != CallTypes.pass_through.value:litellm_logging_obj.call_type = CallTypes.aembedding.value+ # Pass-through endpoints are logged via the callback loop's+ # async_post_call_failure_hook — skip pre_call and failure handlers.+ if litellm_logging_obj.call_type == CallTypes.pass_through.value:+ return+litellm_logging_obj.pre_call(input=input,api_key="",)- # For pass-through endpoints, skip async_failure_handler and- # failure_handler here. The callback loop in post_call_failure_hook- # will call async_post_call_failure_hook on each CustomLogger,- # which handles logging. Firing both paths would produce duplicate- # entries in Datadog, Arize, and other callback integrations.- if litellm_logging_obj.call_type == CallTypes.pass_through.value:- return-# log the custom exceptionawait litellm_logging_obj.async_failure_handler(exception=original_exception,