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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
feat: add UI banner warning for detailed debug mode (#21527)
Krish Dholakia4b9aba8facc4
diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.pyindex f3bed3656f6..4496ad92631 100644--- a/litellm/proxy/health_endpoints/_health_endpoints.py+++ b/litellm/proxy/health_endpoints/_health_endpoints.py@@ -1,5 +1,6 @@import asyncioimport copy+import loggingimport osimport timeimport traceback@@ -10,8 +11,9 @@ import fastapifrom fastapi import APIRouter, Depends, HTTPException, Request, Response, statusimport litellm-from litellm._logging import verbose_proxy_logger+from litellm._logging import verbose_logger, verbose_proxy_loggerfrom litellm.constants import HEALTH_CHECK_TIMEOUT_SECONDS+from litellm.litellm_core_utils.custom_logger_registry import CustomLoggerRegistryfrom litellm.llms.custom_httpx.http_handler import AsyncHTTPHandlerfrom litellm.proxy._types import (AlertType,@@ -32,7 +34,6 @@ from litellm.proxy.health_check import (run_with_timeout,)from litellm.secret_managers.main import get_secret-from litellm.litellm_core_utils.custom_logger_registry import CustomLoggerRegistry#### Health ENDPOINTS ####@@ -1025,10 +1026,7 @@ async def shared_health_check_status_endpoint(def _read_license_data() -> Optional[Dict[str, Any]]:- from litellm.proxy.proxy_server import (- _license_check,- premium_user_data,- )+ from litellm.proxy.proxy_server import _license_check, premium_user_datalicense_data: Optional[EnterpriseLicenseData] = (premium_user_data or _license_check.airgapped_license_data@@ -1072,10 +1070,7 @@ async def health_license_endpoint(user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),):"""Return metadata about the configured LiteLLM license without exposing the key."""- from litellm.proxy.proxy_server import (- _license_check,- premium_user,- )+ from litellm.proxy.proxy_server import _license_check, premium_userlicense_data = _read_license_data()has_license = bool(getattr(_license_check, "license_str", None))@@ -1269,6 +1264,10 @@ async def health_readiness():index_info = "index does not exist - error: " + str(e)cache_type = {"type": cache_type, "index_info": index_info}+ # check log level+ log_level_name = logging.getLevelName(verbose_logger.getEffectiveLevel())+ is_detailed_debug = verbose_logger.isEnabledFor(logging.DEBUG)+# check DBif prisma_client is not None: # if db passed in, check if it's connecteddb_health_status = await _db_health_readiness_check()@@ -1279,6 +1278,8 @@ async def health_readiness():"litellm_version": version,"success_callbacks": success_callback_names,"use_aiohttp_transport": AsyncHTTPHandler._should_use_aiohttp_transport(),+ "log_level": log_level_name,+ "is_detailed_debug": is_detailed_debug,**db_health_status,}else:@@ -1289,6 +1290,8 @@ async def health_readiness():"litellm_version": version,"success_callbacks": success_callback_names,"use_aiohttp_transport": AsyncHTTPHandler._should_use_aiohttp_transport(),+ "log_level": log_level_name,+ "is_detailed_debug": is_detailed_debug,}except Exception as e:raise HTTPException(status_code=503, detail=f"Service Unhealthy ({str(e)})")diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/healthReadiness/useHealthReadiness.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/healthReadiness/useHealthReadiness.tsindex db394b9f7f8..10d29d86ad7 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/healthReadiness/useHealthReadiness.ts+++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/healthReadiness/useHealthReadiness.ts@@ -6,6 +6,8 @@ const healthReadinessKeys = createQueryKeys("healthReadiness");interface HealthReadinessResponse {litellm_version?: string;+ log_level?: string;+ is_detailed_debug?: boolean;[key: string]: any;}diff --git a/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx b/ui/litellm-dashboard/src/app/(dashboard)/layout.tsxindex b387380ff72..1cf7adf1ea9 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx@@ -6,6 +6,7 @@ import { ThemeProvider } from "@/contexts/ThemeContext";import Sidebar2 from "@/app/(dashboard)/components/Sidebar2";import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";import { useRouter, useSearchParams } from "next/navigation";+import { DebugWarningBanner } from "@/components/DebugWarningBanner";/** ---- BASE URL HELPERS ---- */function normalizeBasePrefix(raw: string | undefined | null): string {@@ -61,6 +62,7 @@ function LayoutContent({ children }: { children: React.ReactNode }) {isDarkMode={false}toggleDarkMode={() => { }}/>+ <DebugWarningBanner /><div className="flex flex-1 overflow-auto"><div className="mt-2"><Sidebar2 defaultSelectedKey={page} accessToken={accessToken} userRole={userRole} />diff --git a/ui/litellm-dashboard/src/components/DebugWarningBanner.tsx b/ui/litellm-dashboard/src/components/DebugWarningBanner.tsxnew file mode 100644index 00000000000..e4b2ab69a18--- /dev/null+++ b/ui/litellm-dashboard/src/components/DebugWarningBanner.tsx@@ -0,0 +1,32 @@+"use client";++import React from "react";+import { Alert } from "antd";+import { useHealthReadiness } from "@/app/(dashboard)/hooks/healthReadiness/useHealthReadiness";++export const DebugWarningBanner: React.FC = () => {+ const { data: healthData } = useHealthReadiness();++ // Only show banner if detailed debug mode is explicitly enabled+ if (!healthData?.is_detailed_debug) {+ return null;+ }++ return (+ <Alert+ message="Performance Warning: Detailed Debug Mode Active"+ description={+ <>+ Detailed debug logging (<code>LITELLM_LOG=DEBUG</code>) is currently+ enabled. This mode logs extensive diagnostic information and will+ significantly degrade performance. It should only be used for+ troubleshooting and disabled in production environments.+ </>+ }+ type="warning"+ showIcon+ banner+ style={{ marginBottom: 0, borderRadius: 0 }}+ />+ );+};