From 9f25236425f8bc9ed0ca5adfef893f2347ed5da1 Mon Sep 17 00:00:00 2001 From: jesus Date: Sat, 12 Sep 2026 16:49:50 +0000 Subject: [PATCH] fix(proxy): break top api_key ties deterministically Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/management_endpoints/common_daily_activity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.py index c982fa2de64..d37e32c37bb 100644 --- a/litellm/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/proxy/management_endpoints/common_daily_activity.py @@ -720,7 +720,7 @@ def _build_aggregated_sql_query( FROM "{pg_table}" WHERE {where_clause} GROUP BY api_key - ORDER BY SUM(spend) DESC + ORDER BY SUM(spend) DESC, api_key LIMIT {_MAX_API_KEYS_IN_BREAKDOWN} ) SELECT