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 assistants logging
Ishaan Jaff9316dd5c736e
diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.pyindex 9b514b102d8..d6ab121096e 100644--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py@@ -201,20 +201,11 @@ class OpenAIPassthroughLoggingHandler(BasePassthroughLoggingHandler):)if not (is_chat_completions or is_image_generation or is_image_editing):- # For unsupported endpoints, use the base handler without cost tracking- base_handler = OpenAIPassthroughLoggingHandler()- return base_handler.passthrough_chat_handler(- httpx_response=httpx_response,- response_body=response_body,- logging_obj=logging_obj,- url_route=url_route,- result=result,- start_time=start_time,- end_time=end_time,- cache_hit=cache_hit,- request_body=request_body,- **kwargs,- )+ # For unsupported endpoints, return None to let the system fall back to generic behavior+ return {+ "result": None,+ "kwargs": kwargs,+ }# Extract model from request or responsemodel = request_body.get("model", response_body.get("model", ""))diff --git a/litellm/proxy/pass_through_endpoints/success_handler.py b/litellm/proxy/pass_through_endpoints/success_handler.pyindex 5b54f94f8b5..58fda370d93 100644--- a/litellm/proxy/pass_through_endpoints/success_handler.py+++ b/litellm/proxy/pass_through_endpoints/success_handler.py@@ -162,7 +162,7 @@ class PassThroughEndpointLogging:cohere_passthrough_logging_handler_result["result"])kwargs = cohere_passthrough_logging_handler_result["kwargs"]- elif self.is_openai_route(url_route):+ elif self.is_openai_route(url_route) and self._is_supported_openai_endpoint(url_route):from .llm_provider_handlers.openai_passthrough_logging_handler import (OpenAIPassthroughLoggingHandler,)@@ -319,6 +319,18 @@ class PassThroughEndpointLogging:or "openai.azure.com" in parsed_url.hostname)+ def _is_supported_openai_endpoint(self, url_route: str) -> bool:+ """Check if the OpenAI endpoint is supported by the passthrough logging handler."""+ from .llm_provider_handlers.openai_passthrough_logging_handler import (+ OpenAIPassthroughLoggingHandler,+ )++ return (+ OpenAIPassthroughLoggingHandler.is_openai_chat_completions_route(url_route) or+ OpenAIPassthroughLoggingHandler.is_openai_image_generation_route(url_route) or+ OpenAIPassthroughLoggingHandler.is_openai_image_editing_route(url_route)+ )+def _set_cost_per_request(self,logging_obj: LiteLLMLoggingObj,