diff --git a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx
index 7702488f5bf..e2b1149fdfd 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx
@@ -915,7 +915,7 @@ describe("UsagePage", () => {
expect(screen.getByText("UniqueUser (user-unique)")).toBeInTheDocument();
});
- it("should pass selected userId to aggregated call", async () => {
+ it("should include the current UTC day in global usage", async () => {
renderWithProviders();
await waitFor(() => {
@@ -928,6 +928,7 @@ describe("UsagePage", () => {
expect.any(Date),
expect.any(Date),
null,
+ true,
);
});
});
@@ -1020,6 +1021,7 @@ describe("UsagePage", () => {
expect.any(Date),
expect.any(Date),
"user-123",
+ true,
);
});
});
@@ -1133,10 +1135,24 @@ describe("UsagePage", () => {
});
// Verify first page call
- expect(mockUserDailyActivityCall).toHaveBeenCalledWith("test-token", expect.any(Date), expect.any(Date), 1, null);
+ expect(mockUserDailyActivityCall).toHaveBeenCalledWith(
+ "test-token",
+ expect.any(Date),
+ expect.any(Date),
+ 1,
+ null,
+ true,
+ );
// Verify second page call
- expect(mockUserDailyActivityCall).toHaveBeenCalledWith("test-token", expect.any(Date), expect.any(Date), 2, null);
+ expect(mockUserDailyActivityCall).toHaveBeenCalledWith(
+ "test-token",
+ expect.any(Date),
+ expect.any(Date),
+ 2,
+ null,
+ true,
+ );
});
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx
index 018dfc84740..a10538bfa3f 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.tsx
@@ -192,7 +192,7 @@ const UsagePage: React.FC = ({ teams, organizations }) => {
const rangeKey = currentAggregatedRangeKey;
setAggregatedLoading(true);
- userDailyActivityAggregatedCall(accessToken, startTime, endTime, effectiveUserId)
+ userDailyActivityAggregatedCall(accessToken, startTime, endTime, effectiveUserId, true)
.then((data) => {
if (aggregatedFetchIdRef.current !== fetchId) return;
setAggregatedData({ rangeKey, value: data });
@@ -237,7 +237,7 @@ const UsagePage: React.FC = ({ teams, organizations }) => {
// Paginated fallback — only enabled when aggregated endpoint fails
const paginatedResult = usePaginatedDailyActivity({
fetchFn: userDailyActivityCall,
- args: [accessToken, startTime, endTime, effectiveUserId],
+ args: [accessToken, startTime, endTime, effectiveUserId, true],
enabled: aggregatedFailed && !!accessToken && !!startTime && !!endTime,
});
diff --git a/ui/litellm-dashboard/src/components/networking.test.ts b/ui/litellm-dashboard/src/components/networking.test.ts
index b964231804e..f64823ab2d6 100644
--- a/ui/litellm-dashboard/src/components/networking.test.ts
+++ b/ui/litellm-dashboard/src/components/networking.test.ts
@@ -776,11 +776,12 @@ describe("daily activity api_key filter", () => {
const originalFetch = global.fetch;
const captureFetch = () => {
- const mockFetch = vi.fn().mockResolvedValue(
- new Response(JSON.stringify({ results: [], metadata: {} }), {
- status: 200,
- headers: { "Content-Type": "application/json" },
- }),
+ const mockFetch = vi.fn().mockImplementation(
+ async () =>
+ new Response(JSON.stringify({ results: [], metadata: {} }), {
+ status: 200,
+ headers: { "Content-Type": "application/json" },
+ }),
);
global.fetch = mockFetch;
return mockFetch;
@@ -795,6 +796,24 @@ describe("daily activity api_key filter", () => {
global.fetch = originalFetch;
});
+ it.each([false, true])(
+ "serializes the current UTC day opt-in (%s) on both user activity routes",
+ async (includeCurrentUtcDay) => {
+ const mockFetch = captureFetch();
+
+ await Networking.userDailyActivityCall("sk-key", start, end, 1, "user-123", includeCurrentUtcDay);
+ await Networking.userDailyActivityAggregatedCall("sk-key", start, end, "user-123", includeCurrentUtcDay);
+
+ expect(mockFetch).toHaveBeenCalledTimes(2);
+ for (const [input] of mockFetch.mock.calls) {
+ const url = new URL(String(input), "http://localhost");
+ expect(url.searchParams.get("include_current_utc_day")).toBe(includeCurrentUtcDay ? "true" : null);
+ expect(url.searchParams.get("user_id")).toBe("user-123");
+ expect(url.searchParams.get("timezone")).toBe(String(new Date().getTimezoneOffset()));
+ }
+ },
+ );
+
it("sends the key hash as api_key from the paginated caller", async () => {
const mockFetch = captureFetch();