From 742e0feb124e7a3d58dc9d5b462d641ee2fdbaa1 Mon Sep 17 00:00:00 2001 From: factnn <166481866+factnn@users.noreply.github.com> Date: Thu, 18 Jun 2026 18:44:02 +0800 Subject: [PATCH] fix: remove start_time from self.data to avoid snapshot test pollution start_time was not needed for overhead computation on non-chat routes because llm_api_duration_ms is also not available. Use end_time for both start and end; the guard prevents affecting chat completions. Fixes #30566 --- litellm/proxy/common_request_processing.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.py index 428f8688aa1..919e9dc0633 100644 --- a/litellm/proxy/common_request_processing.py +++ b/litellm/proxy/common_request_processing.py @@ -1366,8 +1366,6 @@ class ProxyBaseLLMRequestProcessing: llm_router=llm_router, ) - self.data["start_time"] = datetime.now() - # Defer async logging when post-call guardrails are configured so the # StandardLoggingPayload is built after guardrails write to metadata. # Cache the result to avoid scanning litellm.callbacks twice. @@ -1442,7 +1440,7 @@ class ProxyBaseLLMRequestProcessing: logging_obj=self.data.get("litellm_logging_obj"), model=self.data.get("model"), kwargs=self.data, - start_time=self.data.get("start_time", end_time), + start_time=end_time, end_time=end_time, )