Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Fix Unbounded pagination

Alejandro Tapiaf44c36f9802b
diff --git a/ui/litellm-dashboard/src/components/key_team_helpers/filter_helpers.ts b/ui/litellm-dashboard/src/components/key_team_helpers/filter_helpers.ts
index 08eccc4ed2c..dd3766592bf 100644
--- a/ui/litellm-dashboard/src/components/key_team_helpers/filter_helpers.ts
+++ b/ui/litellm-dashboard/src/components/key_team_helpers/filter_helpers.ts
@@ -25,6 +25,8 @@ export const fetchTeamFilterOptions = async (
const organizationIds = new Set<string>();
const userMap = new Map<string, string>(); // user_id -> user_email
+ const MAX_PAGES = 1; // Cap at 20 keys on load to avoid heavy fetches
+ const PAGE_SIZE = 20;
let page = 1;
let totalPages = 1;
@@ -37,7 +39,7 @@ export const fetchTeamFilterOptions = async (
null,
null,
page,
- 100,
+ PAGE_SIZE,
null,
null,
"user",
@@ -64,7 +66,7 @@ export const fetchTeamFilterOptions = async (
}
page++;
- } while (page <= totalPages);
+ } while (page <= totalPages && page <= MAX_PAGES);
return {
keyAliases: Array.from(keyAliases).sort(),
diff --git a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
index ddbffa118b1..13d7885d672 100644
--- a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
@@ -122,6 +122,7 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
queryKey: ["teamFilterOptions", teamId],
queryFn: async () => fetchTeamFilterOptions(accessToken, teamId),
enabled: !!accessToken && !!teamId,
+ staleTime: 30000, // 30 seconds - align with useKeys
});
const teamFilterOptions = teamFilterOptionsQuery.data || {
keyAliases: [],