diff --git a/litellm/constants.py b/litellm/constants.py index 3900a62b30b..c106be688e4 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -65,10 +65,6 @@ DEFAULT_MAX_RETRIES: Final = int(os.getenv("DEFAULT_MAX_RETRIES", 2)) # Max records accepted in one POST /v1/callbacks/logs batch. Bounds the blast # radius: each record fans out to spend logs + every callback integration. MAX_CALLBACK_LOG_RECORDS: Final = 1000 -# Top keys by spend that get per-key rows in the aggregated usage response. -# Six of its GROUPING SETS are keyed on api_key, so an uncapped result grows -# with every distinct key and the prisma query engine OOMs buffering it. -MAX_API_KEYS_IN_USAGE_BREAKDOWN: Final = 100 DEFAULT_MAX_RECURSE_DEPTH: Final = int(os.getenv("DEFAULT_MAX_RECURSE_DEPTH", 100)) DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER = int(os.getenv("DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER", 10)) DEFAULT_FAILURE_THRESHOLD_PERCENT: Final = float( diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.py index 9d3fdee90c1..17a4b4c9a3b 100644 --- a/litellm/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/proxy/management_endpoints/common_daily_activity.py @@ -9,7 +9,7 @@ from fastapi import HTTPException, status from typing_extensions import ReadOnly, TypedDict from litellm._logging import verbose_proxy_logger -from litellm.constants import MAX_API_KEYS_IN_USAGE_BREAKDOWN, PTU_SENTINEL_API_KEY +from litellm.constants import PTU_SENTINEL_API_KEY from litellm.proxy._types import CommonProxyErrors from litellm.proxy.spend_tracking.key_metadata_recovery import ( attach_user_emails, @@ -52,6 +52,8 @@ _PRISMA_TO_PG_TABLE: Final[Mapping[str, str]] = { "litellm_dailytagspend": "LiteLLM_DailyTagSpend", } +MAX_API_KEYS_IN_USAGE_BREAKDOWN: Final = 100 + class DailySpendRecord(Protocol): @property diff --git a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py index 068c0271f10..c4967ebeeca 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py +++ b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py @@ -9,8 +9,8 @@ import pytest from psycopg.rows import dict_row from pytest_postgresql import factories -from litellm.constants import MAX_API_KEYS_IN_USAGE_BREAKDOWN from litellm.proxy.management_endpoints.common_daily_activity import ( + MAX_API_KEYS_IN_USAGE_BREAKDOWN, _adjust_dates_for_timezone, _build_aggregated_sql_query, _build_entity_rollup_sql_query,