From bb5e71447dabfd94ce6277478419a1402dc03631 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 13 Sep 2025 18:15:34 -0700 Subject: [PATCH 1/3] fix(spend_management_endpoints.py): add end user filtering --- litellm/constants.py | 2 +- .../spend_tracking/spend_management_endpoints.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/litellm/constants.py b/litellm/constants.py index e40f1a5da2..c0ce0f265b 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -15,7 +15,7 @@ DEFAULT_SQS_FLUSH_INTERVAL_SECONDS = int( os.getenv("DEFAULT_SQS_FLUSH_INTERVAL_SECONDS", 10) ) DEFAULT_NUM_WORKERS_LITELLM_PROXY = int( - os.getenv("DEFAULT_NUM_WORKERS_LITELLM_PROXY", 4) + os.getenv("DEFAULT_NUM_WORKERS_LITELLM_PROXY", 1) ) DEFAULT_SQS_BATCH_SIZE = int(os.getenv("DEFAULT_SQS_BATCH_SIZE", 512)) SQS_SEND_MESSAGE_ACTION = "SendMessage" diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.py index e7d28bc317..16985d76b3 100644 --- a/litellm/proxy/spend_tracking/spend_management_endpoints.py +++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py @@ -10,7 +10,6 @@ from fastapi import APIRouter, Depends, HTTPException, status import litellm from litellm._logging import verbose_proxy_logger -from litellm.router_strategy.budget_limiter import RouterBudgetLimiting from litellm.proxy._types import * from litellm.proxy._types import ProviderBudgetResponse, ProviderBudgetResponseObject from litellm.proxy.auth.user_api_key_auth import user_api_key_auth @@ -18,6 +17,7 @@ from litellm.proxy.spend_tracking.spend_tracking_utils import ( get_spend_by_team_and_customer, ) from litellm.proxy.utils import handle_exception_on_proxy +from litellm.router_strategy.budget_limiter import RouterBudgetLimiting if TYPE_CHECKING: from litellm.proxy.proxy_server import PrismaClient @@ -1663,6 +1663,9 @@ async def ui_view_spend_logs( # noqa: PLR0915 key_alias: Optional[str] = fastapi.Query( default=None, description="Filter logs by key alias" ), + end_user: Optional[str] = fastapi.Query( + default=None, description="Filter logs by end user" + ), ): """ View spend logs for UI with pagination support @@ -1730,13 +1733,16 @@ async def ui_view_spend_logs( # noqa: PLR0915 if model is not None: where_conditions["model"] = model - + if key_alias is not None: where_conditions["metadata"] = { "path": ["user_api_key_alias"], - "string_contains": key_alias + "string_contains": key_alias, } + if end_user is not None: + where_conditions["end_user"] = end_user + if min_spend is not None or max_spend is not None: where_conditions["spend"] = {} if min_spend is not None: From 84f934bf36f79b6151d0c9f6805c3611e0effbce Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 13 Sep 2025 18:20:07 -0700 Subject: [PATCH 2/3] fix(user_edit_view.tsx): use shared component to prevent accidental setting of edit user budget --- ui/litellm-dashboard/src/components/user_edit_view.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/user_edit_view.tsx b/ui/litellm-dashboard/src/components/user_edit_view.tsx index bfe00290eb..4c99e29bbe 100644 --- a/ui/litellm-dashboard/src/components/user_edit_view.tsx +++ b/ui/litellm-dashboard/src/components/user_edit_view.tsx @@ -1,5 +1,6 @@ import React from "react"; import { Form, InputNumber, Select, Tooltip } from "antd"; +import NumericalInput from "./shared/numerical_input"; import { TextInput, Textarea, SelectItem } from "@tremor/react"; import { Button } from "@tremor/react"; import { getModelDisplayName } from "./key_team_helpers/fetch_available_models_team_key"; @@ -150,7 +151,7 @@ export function UserEditView({ label="Max Budget (USD)" name="max_budget" > - Date: Sat, 13 Sep 2025 18:42:42 -0700 Subject: [PATCH 3/3] fix(fetch_mcp_tools.tsx): fix load mcp tools --- .../src/components/chat_ui/llm_calls/fetch_mcp_tools.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/chat_ui/llm_calls/fetch_mcp_tools.tsx b/ui/litellm-dashboard/src/components/chat_ui/llm_calls/fetch_mcp_tools.tsx index cd9368460e..782bc962a6 100644 --- a/ui/litellm-dashboard/src/components/chat_ui/llm_calls/fetch_mcp_tools.tsx +++ b/ui/litellm-dashboard/src/components/chat_ui/llm_calls/fetch_mcp_tools.tsx @@ -28,7 +28,6 @@ export async function fetchAvailableMCPTools( return data.tools || []; } catch (error) { console.error("Error fetching MCP tools:", error); - NotificationManager.fromBackend("Failed to fetch MCP tools"); return []; } } \ No newline at end of file