From 118d8114f8d606faa40f7802765f53ffce37762c Mon Sep 17 00:00:00 2001 From: Harshit28j Date: Fri, 13 Mar 2026 15:37:13 +0530 Subject: [PATCH] Include time window in export filename to prevent Vantage overwrites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vantage deduplicates by filename — uploading the same filename overwrites previous data. Changed _build_filename to include the time window (e.g. usage_20240102T050000Z_20240102T060000Z.csv) so each hourly/daily export has a unique filename. Co-Authored-By: Claude Opus 4.6 --- litellm/integrations/focus/export_engine.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/litellm/integrations/focus/export_engine.py b/litellm/integrations/focus/export_engine.py index 1f51e1bac96..8b77fad9e17 100644 --- a/litellm/integrations/focus/export_engine.py +++ b/litellm/integrations/focus/export_engine.py @@ -101,13 +101,17 @@ class FocusExportEngine: await self._destination.deliver( content=payload, time_window=window, - filename=self._build_filename(), + filename=self._build_filename(window), ) - def _build_filename(self) -> str: + def _build_filename(self, window: FocusTimeWindow) -> str: if not self._serializer.extension: raise ValueError("Serializer must declare a file extension") - return f"usage.{self._serializer.extension}" + # Include time window in filename so Vantage (which deduplicates + # by filename) doesn't overwrite previous uploads. + start_str = window.start_time.strftime("%Y%m%dT%H%M%SZ") + end_str = window.end_time.strftime("%Y%m%dT%H%M%SZ") + return f"usage_{start_str}_{end_str}.{self._serializer.extension}" @staticmethod def _sum_column(frame: pl.DataFrame, column: str) -> float: