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]

chore(ci): merge dev branch (#28657)

yuneng-jiangd98ada8c3f7f
diff --git a/litellm/litellm_core_utils/sensitive_data_masker.py b/litellm/litellm_core_utils/sensitive_data_masker.py
index d7803455b4a..4928dd08386 100644
--- a/litellm/litellm_core_utils/sensitive_data_masker.py
+++ b/litellm/litellm_core_utils/sensitive_data_masker.py
@@ -146,6 +146,37 @@ class SensitiveDataMasker:
return masked_data
+_default_masker = SensitiveDataMasker()
+
+
+def mask_sensitive_keys(
+ data: Dict[str, Any], sensitive_fields: Set[str]
+) -> Dict[str, Any]:
+ """Return a new dict with values masked for keys listed in ``sensitive_fields``.
+
+ Unlike :meth:`SensitiveDataMasker.mask_dict`, this does exact key-name
+ matching (not segment matching), so callers explicitly enumerate which
+ fields to mask. Non-string and None values are passed through unchanged.
+
+ Values shorter than ``visible_prefix + visible_suffix`` (8 by default)
+ fall outside :meth:`SensitiveDataMasker._mask_value`'s partial-reveal
+ range and are replaced with a fixed-length all-mask string, so a short
+ credential is never returned verbatim.
+ """
+ masked: Dict[str, Any] = {}
+ mask_char = _default_masker.mask_char
+ min_visible = _default_masker.visible_prefix + _default_masker.visible_suffix
+ for key, value in data.items():
+ if value is not None and key in sensitive_fields and isinstance(value, str):
+ if len(value) < min_visible:
+ masked[key] = mask_char * len(value) if value else value
+ else:
+ masked[key] = _default_masker._mask_value(value)
+ else:
+ masked[key] = value
+ return masked
+
+
# Usage example:
"""
masker = SensitiveDataMasker()
diff --git a/litellm/proxy/management_endpoints/cache_settings_endpoints.py b/litellm/proxy/management_endpoints/cache_settings_endpoints.py
index 55eb321185c..0a26b23beff 100644
--- a/litellm/proxy/management_endpoints/cache_settings_endpoints.py
+++ b/litellm/proxy/management_endpoints/cache_settings_endpoints.py
@@ -19,6 +19,7 @@ from pydantic import BaseModel, Field
import litellm
from litellm._logging import verbose_proxy_logger
from litellm._uuid import uuid
+from litellm.litellm_core_utils.sensitive_data_masker import mask_sensitive_keys
from litellm.proxy._types import (
AUDIT_ACTIONS,
LiteLLM_AuditLogs,
@@ -34,6 +35,10 @@ from litellm.types.management_endpoints import (
router = APIRouter()
+# Cache fields holding credentials. Masked on read so plaintext Redis /
+# Sentinel passwords never leave the server in a GET response.
+_CACHE_SENSITIVE_FIELDS: set = {"password", "sentinel_password"}
+
_REDACTED_VALUE = "***REDACTED***"
@@ -295,7 +300,11 @@ async def get_cache_settings(
else:
decrypted_settings["redis_type"] = "node"
- current_values = decrypted_settings
+ # Mask credential fields so the GET response never carries
+ # plaintext Redis / Sentinel passwords off the server.
+ current_values = mask_sensitive_keys(
+ decrypted_settings, _CACHE_SENSITIVE_FIELDS
+ )
# Update field values with current values
for field in cache_fields:
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 4af7caead0e..814111762b6 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -241,7 +241,10 @@ from litellm.litellm_core_utils.core_helpers import (
)
from litellm.litellm_core_utils.credential_accessor import CredentialAccessor
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
-from litellm.litellm_core_utils.sensitive_data_masker import SensitiveDataMasker
+from litellm.litellm_core_utils.sensitive_data_masker import (
+ SensitiveDataMasker,
+ mask_sensitive_keys,
+)
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
from litellm.llms.vertex_ai.vertex_llm_base import VertexBase
from litellm.proxy._types import *
@@ -990,6 +993,15 @@ _OPENAPI_HTTP_METHODS = {
}
+# Credentials surfaced by `/get/config/callbacks` in the alerting block: the
+# full Slack incoming-webhook URL is itself a credential, and the SMTP
+# password is a service password. Masked on read so plaintext never reaches
+# the UI. Kept here at module scope to match the analogous
+# `_SSO_SENSITIVE_FIELDS` / `_CACHE_SENSITIVE_FIELDS` constants in the SSO
+# and cache endpoint files.
+_ALERTING_SENSITIVE_VARS: Set[str] = {"SLACK_WEBHOOK_URL", "SMTP_PASSWORD"}
+
+
def _strip_operation_id_method_suffix(operation_id: str) -> str:
base, separator, suffix = operation_id.rpartition("_")
if separator and suffix in _OPENAPI_HTTP_METHODS:
@@ -14708,6 +14720,9 @@ async def get_config(): # noqa: PLR0915
value=env_variable, key=_var
)
_slack_env_vars[_var] = _decrypted_value
+ _slack_env_vars = mask_sensitive_keys(
+ _slack_env_vars, _ALERTING_SENSITIVE_VARS
+ )
_alerting_types = proxy_logging_obj.slack_alerting_instance.alert_types
_all_alert_types = (
@@ -14744,6 +14759,7 @@ async def get_config(): # noqa: PLR0915
# decode + decrypt the value
_decrypted_value = decrypt_value_helper(value=env_variable, key=_var)
_email_env_vars[_var] = _decrypted_value
+ _email_env_vars = mask_sensitive_keys(_email_env_vars, _ALERTING_SENSITIVE_VARS)
alerting_data.append(
{
diff --git a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
index db3ae9ad942..07e2ca71950 100644
--- a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
+++ b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
@@ -9,6 +9,7 @@ from pydantic.fields import FieldInfo
import litellm
from litellm._logging import verbose_proxy_logger
+from litellm.litellm_core_utils.sensitive_data_masker import mask_sensitive_keys
from litellm.proxy._types import *
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
from litellm.types.proxy.management_endpoints.ui_sso import (
@@ -19,6 +20,16 @@ from litellm.types.proxy.management_endpoints.ui_sso import (
router = APIRouter()
+# SSO secret fields returned by /get/sso_settings. These are masked on read so
+# the UI can show "(set)" without ever transporting the plaintext OAuth secret
+# off the server, matching the write-once + masked-on-read contract used for
+# the HashiCorp Vault config override.
+_SSO_SENSITIVE_FIELDS: Set[str] = {
+ "google_client_secret",
+ "microsoft_client_secret",
+ "generic_client_secret",
+}
+
class IPAddress(BaseModel):
ip: str
@@ -728,8 +739,9 @@ async def get_sso_settings():
schema = TypeAdapter(SSOConfig).json_schema(by_alias=True)
- # Convert to dict for response
- sso_dict = sso_config.model_dump()
+ # Convert to dict for response, masking OAuth client secrets so plaintext
+ # is never sent to the UI.
+ sso_dict = mask_sensitive_keys(sso_config.model_dump(), _SSO_SENSITIVE_FIELDS)
# Add descriptions to the response
result = {
diff --git a/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py b/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py
index c27d7eedcdb..ae217aca16e 100644
--- a/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py
+++ b/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py
@@ -360,11 +360,15 @@ class TestProxySettingEndpoints:
assert "proxy_base_url" in values
assert "user_email" in values
- # Verify values match our mock config
+ # Verify non-secret values match our mock config. OAuth client
+ # secrets are masked on read so the GET response never carries
+ # plaintext credentials.
assert values["google_client_id"] == "test_google_client_id"
- assert values["google_client_secret"] == "test_google_client_secret"
+ assert values["google_client_secret"] != "test_google_client_secret"
+ assert "*" in values["google_client_secret"]
assert values["microsoft_client_id"] == "test_microsoft_client_id"
- assert values["microsoft_client_secret"] == "test_microsoft_client_secret"
+ assert values["microsoft_client_secret"] != "test_microsoft_client_secret"
+ assert "*" in values["microsoft_client_secret"]
assert values["proxy_base_url"] == "https://example.com"
assert values["user_email"] == "[email protected]"
@@ -1321,10 +1325,12 @@ class TestProxySettingEndpoints:
assert "values" in data
assert "field_schema" in data
- # Verify decrypted values are returned
+ # Verify decrypted values are returned. OAuth client secrets are
+ # masked on read so plaintext is never sent to the UI.
values = data["values"]
assert values["google_client_id"] == "decrypted_google_id"
- assert values["google_client_secret"] == "decrypted_google_secret"
+ assert values["google_client_secret"] != "decrypted_google_secret"
+ assert "*" in values["google_client_secret"]
assert values["microsoft_client_id"] == "decrypted_microsoft_id"
assert values["proxy_base_url"] == "https://decrypted.example.com"
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useHideAgentPlatformBanner.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useHideAgentPlatformBanner.ts
new file mode 100644
index 00000000000..15b44a5abc6
--- /dev/null
+++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useHideAgentPlatformBanner.ts
@@ -0,0 +1,36 @@
+// hooks/useHideAgentPlatformBanner.ts
+import { useSyncExternalStore } from "react";
+import { getLocalStorageItem, LOCAL_STORAGE_EVENT } from "@/utils/localStorageUtils";
+
+export const HIDE_AGENT_PLATFORM_BANNER_KEY = "litellmHideAgentPlatformBanner";
+
+function subscribe(callback: () => void) {
+ const onStorage = (e: StorageEvent) => {
+ if (e.key === HIDE_AGENT_PLATFORM_BANNER_KEY) {
+ callback();
+ }
+ };
+
+ const onCustom = (e: Event) => {
+ const { key } = (e as CustomEvent).detail;
+ if (key === HIDE_AGENT_PLATFORM_BANNER_KEY) {
+ callback();
+ }
+ };
+
+ window.addEventListener("storage", onStorage);
+ window.addEventListener(LOCAL_STORAGE_EVENT, onCustom);
+
+ return () => {
+ window.removeEventListener("storage", onStorage);
+ window.removeEventListener(LOCAL_STORAGE_EVENT, onCustom);
+ };
+}
+
+function getSnapshot() {
+ return getLocalStorageItem(HIDE_AGENT_PLATFORM_BANNER_KEY) === "true";
+}
+
+export function useHideAgentPlatformBanner() {
+ return useSyncExternalStore(subscribe, getSnapshot);
+}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx b/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx
index 13e93798def..7f331d06e59 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/layout.tsx
@@ -37,7 +37,7 @@ const MIGRATED_PAGES: Record<string, string> = {
function LayoutContent({ children }: { children: React.ReactNode }) {
const router = useRouter();
const searchParams = useSearchParams();
- const { accessToken, userRole, userId, userEmail, premiumUser } = useAuthorized();
+ const { accessToken } = useAuthorized();
const [sidebarCollapsed, setSidebarCollapsed] = React.useState(false);
const [page, setPage] = useState(() => {
return searchParams.get("page") || "api-keys";
@@ -70,15 +70,9 @@ function LayoutContent({ children }: { children: React.ReactNode }) {
isPublicPage={false}
sidebarCollapsed={sidebarCollapsed}
onToggleSidebar={toggleSidebar}
- userID={userId}
- userEmail={userEmail}
- userRole={userRole}
- premiumUser={premiumUser}
proxySettings={undefined}
setProxySettings={() => { }}
accessToken={accessToken}
- isDarkMode={false}
- toggleDarkMode={() => { }}
/>
<DebugWarningBanner accessToken={accessToken} />
<div className="flex flex-1 overflow-auto">
diff --git a/ui/litellm-dashboard/src/app/page.tsx b/ui/litellm-dashboard/src/app/page.tsx
index 06bf3b68d05..a7ea6831de6 100644
--- a/ui/litellm-dashboard/src/app/page.tsx
+++ b/ui/litellm-dashboard/src/app/page.tsx
@@ -473,18 +473,12 @@ function CreateKeyPageContent() {
) : (
<div className="flex flex-col min-h-screen">
<Navbar
- userID={userID}
- userRole={userRole}
- premiumUser={premiumUser}
- userEmail={userEmail}
setProxySettings={setProxySettings}
proxySettings={proxySettings}
accessToken={accessToken}
isPublicPage={false}
sidebarCollapsed={sidebarCollapsed}
onToggleSidebar={toggleSidebar}
- isDarkMode={isDarkMode}
- toggleDarkMode={toggleDarkMode}
/>
<div className="flex flex-1">
<div className="mt-2">
diff --git a/ui/litellm-dashboard/src/components/Navbar/BlogDropdown/BlogDropdown.tsx b/ui/litellm-dashboard/src/components/Navbar/BlogDropdown/BlogDropdown.tsx
index ddb2a33cdaa..657e5a39bab 100644
--- a/ui/litellm-dashboard/src/components/Navbar/BlogDropdown/BlogDropdown.tsx
+++ b/ui/litellm-dashboard/src/components/Navbar/BlogDropdown/BlogDropdown.tsx
@@ -1,6 +1,7 @@
import { useDisableBlogPosts } from "@/app/(dashboard)/hooks/useDisableBlogPosts";
import { useBlogPosts, type BlogPost } from "@/app/(dashboard)/hooks/blogPosts/useBlogPosts";
-import { LoadingOutlined } from "@ant-design/icons";
+import { NAV_PRODUCT_LINK_CLASS } from "@/components/Navbar/navProductLinkClass";
+import { DownOutlined, LoadingOutlined } from "@ant-design/icons";
import { Button, Dropdown, Space, Typography } from "antd";
import type { MenuProps } from "antd";
import React from "react";
@@ -74,9 +75,13 @@ export const BlogDropdown: React.FC = () => {
];
}
+ // Blog opens a post list; Docs is a single outbound link — navbar adds a layout-only chevron there for alignment.
return (
<Dropdown menu={{ items }} trigger={["hover"]} placement="bottomRight">
- <Button type="text">Blog</Button>
+ <Button type="text" className={`${NAV_PRODUCT_LINK_CLASS} !border-0 !bg-transparent`}>
+ Blog
+ <DownOutlined className="text-[10px] text-gray-500" aria-hidden />
+ </Button>
</Dropdown>
);
};
diff --git a/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.test.tsx b/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.test.tsx
index 6994def858b..4f07f0e2daa 100644
--- a/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.test.tsx
+++ b/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.test.tsx
@@ -29,14 +29,14 @@ describe("CommunityEngagementButtons", () => {
expect(joinSlackLink).toHaveAttribute("rel", "noopener noreferrer");
});
- it("should render Star us on GitHub button with correct link", () => {
+ it("should render GitHub link with correct href", () => {
renderWithProviders(<CommunityEngagementButtons />);
- const starOnGithubLink = screen.getByRole("link", { name: /star us on github/i });
- expect(starOnGithubLink).toBeInTheDocument();
- expect(starOnGithubLink).toHaveAttribute("href", "https://github.com/BerriAI/litellm");
- expect(starOnGithubLink).toHaveAttribute("target", "_blank");
- expect(starOnGithubLink).toHaveAttribute("rel", "noopener noreferrer");
+ const githubLink = screen.getByRole("link", { name: /litellm on github/i });
+ expect(githubLink).toBeInTheDocument();
+ expect(githubLink).toHaveAttribute("href", "https://github.com/BerriAI/litellm");
+ expect(githubLink).toHaveAttribute("target", "_blank");
+ expect(githubLink).toHaveAttribute("rel", "noopener noreferrer");
});
it("should not render buttons when prompts are disabled", () => {
@@ -45,6 +45,6 @@ describe("CommunityEngagementButtons", () => {
renderWithProviders(<CommunityEngagementButtons />);
expect(screen.queryByRole("link", { name: /join slack/i })).not.toBeInTheDocument();
- expect(screen.queryByRole("link", { name: /star us on github/i })).not.toBeInTheDocument();
+ expect(screen.queryByRole("link", { name: /litellm on github/i })).not.toBeInTheDocument();
});
});
diff --git a/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx b/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx
index 649bcc0b589..f6a43196a32 100644
--- a/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx
+++ b/ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx
@@ -1,36 +1,45 @@
import { useDisableShowPrompts } from "@/app/(dashboard)/hooks/useDisableShowPrompts";
import { GithubOutlined, SlackOutlined } from "@ant-design/icons";
-import { Button } from "antd";
+import { Tooltip } from "antd";
import React from "react";
+const iconBtnClass =
+ "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 cursor-pointer";
+
export const CommunityEngagementButtons: React.FC = () => {
const disableShowPrompts = useDisableShowPrompts();
- // Hide buttons if prompts are disabled
if (disableShowPrompts) {
return null;
}
return (
- <>
- <Button
- href="https://www.litellm.ai/support"
- target="_blank"
- rel="noopener noreferrer"
- icon={<SlackOutlined />}
- className="shadow-md shadow-indigo-500/20 hover:shadow-indigo-500/50 transition-shadow"
- >
- Join Slack
- </Button>
- <Button
- href="https://github.com/BerriAI/litellm"
- target="_blank"
- rel="noopener noreferrer"
- className="shadow-md shadow-indigo-500/20 hover:shadow-indigo-500/50 transition-shadow"
- icon={<GithubOutlined />}
- >
- Star us on GitHub
- </Button>
- </>
+ <div
+ className="flex items-center gap-0.5 rounded-md border border-gray-200/80 bg-gray-50 px-0.5 py-0"
+ aria-label="Community links"
+ >
+ <Tooltip title="LiteLLM Slack community">
+ <a
+ href="https://www.litellm.ai/support"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={iconBtnClass}
+ aria-label="Join Slack"
+ >
+ <SlackOutlined className="text-lg" />
+ </a>
+ </Tooltip>
+ <Tooltip title="LiteLLM on GitHub">
+ <a
+ href="https://github.com/BerriAI/litellm"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={iconBtnClass}
+ aria-label="LiteLLM on GitHub"
+ >
+ <GithubOutlined className="text-lg" />
+ </a>
+ </Tooltip>
+ </div>
);
};
diff --git a/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.test.tsx b/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.test.tsx
new file mode 100644
index 00000000000..4ead085d977
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.test.tsx
@@ -0,0 +1,69 @@
+import { renderWithProviders, screen } from "../../../../tests/test-utils";
+import { NotificationsBell, AGENT_PLATFORM_URL } from "./NotificationsBell";
+import React from "react";
+import userEvent from "@testing-library/user-event";
+
+describe("NotificationsBell", () => {
+ beforeEach(() => {
+ localStorage.clear();
+ });
+
+ it("should open notifications with Agent Platform details and GitHub link", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NotificationsBell />);
+ await user.click(screen.getByRole("button", { name: /^notifications$/i }));
+ expect(screen.getByText(/LiteLLM Agent Platform/i)).toBeInTheDocument();
+ const githubBtn = screen.getByRole("link", { name: /^GitHub$/i });
+ expect(githubBtn).toHaveAttribute("href", AGENT_PLATFORM_URL);
+ expect(githubBtn).toHaveAttribute("target", "_blank");
+ expect(githubBtn).toHaveAttribute("rel", "noopener noreferrer");
+ });
+
+ it("should offer mark as read when announcement is unread", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NotificationsBell />);
+ await user.click(screen.getByRole("button", { name: /^notifications$/i }));
+ expect(screen.getByRole("button", { name: /^mark as read$/i })).toBeInTheDocument();
+ });
+
+ it("should hide mark as read and persist after marking read", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(<NotificationsBell />);
+ await user.click(screen.getByRole("button", { name: /^notifications$/i }));
+ await user.click(screen.getByRole("button", { name: /^mark as read$/i }));
+ expect(localStorage.getItem("litellmHideAgentPlatformBanner")).toBe("true");
+ await user.click(screen.getByRole("button", { name: /^notifications$/i }));
+ expect(screen.queryByRole("button", { name: /^mark as read$/i })).not.toBeInTheDocument();
+ });
+
+ it("should not show mark as read when previously dismissed", async () => {
+ localStorage.setItem("litellmHideAgentPlatformBanner", "true");
+ const user = userEvent.setup();
+ renderWithProviders(<NotificationsBell />);
+ await user.click(screen.getByRole("button", { name: /^notifications$/i }));
+ expect(screen.queryByRole("button", { name: /^mark as read$/i })).not.toBeInTheDocument();
+ });
+
+ it("should sync sibling instances when one is dismissed", async () => {
+ const user = userEvent.setup();
+ renderWithProviders(
+ <>
+ <div data-testid="bell-a">
+ <NotificationsBell />
+ </div>
+ <div data-testid="bell-b">
+ <NotificationsBell />
+ </div>
+ </>,
+ );
+
+ // Both bells start unread → both render the "Mark as read" affordance once opened.
+ const [bellA, bellB] = screen.getAllByRole("button", { name: /^notifications$/i });
+ await user.click(bellA);
+ await user.click(screen.getByRole("button", { name: /^mark as read$/i }));
+
+ // Dismissing in bell A must also clear bell B without a remount.
+ await user.click(bellB);
+ expect(screen.queryByRole("button", { name: /^mark as read$/i })).not.toBeInTheDocument();
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.tsx b/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.tsx
new file mode 100644
index 00000000000..a3b7678e1e7
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Navbar/NotificationsBell/NotificationsBell.tsx
@@ -0,0 +1,59 @@
+"use client";
+
+import {
+ HIDE_AGENT_PLATFORM_BANNER_KEY,
+ useHideAgentPlatformBanner,
+} from "@/app/(dashboard)/hooks/useHideAgentPlatformBanner";
+import { emitLocalStorageChange, setLocalStorageItem } from "@/utils/localStorageUtils";
+import { BellOutlined } from "@ant-design/icons";
+import { Badge, Button, Popover, Typography } from "antd";
+import React, { useState } from "react";
+
+export const AGENT_PLATFORM_URL = "https://github.com/BerriAI/litellm-agent-platform";
+
+export const NotificationsBell: React.FC = () => {
+ const hidden = useHideAgentPlatformBanner();
+ const hasUnread = !hidden;
+ const [open, setOpen] = useState(false);
+
+ const markDismissed = () => {
+ setLocalStorageItem(HIDE_AGENT_PLATFORM_BANNER_KEY, "true");
+ emitLocalStorageChange(HIDE_AGENT_PLATFORM_BANNER_KEY);
+ setOpen(false);
+ };
+
+ const content = (
+ <div className="max-w-[280px]">
+ <Typography.Title level={5} className="!mt-0 !mb-2">
+ LiteLLM Agent Platform
+ </Typography.Title>
+ <Typography.Paragraph type="secondary" className="!mb-3 text-sm leading-snug">
+ Open-source agent infra — sandboxes, durable sessions, and workers on AWS Fargate.
+ </Typography.Paragraph>
+ <div className="flex flex-wrap items-center gap-2">
+ <Button type="primary" size="small" href={AGENT_PLATFORM_URL} target="_blank" rel="noopener noreferrer">
+ GitHub
+ </Button>
+ {hasUnread ? (
+ <Button type="link" size="small" className="!px-1" onClick={markDismissed}>
+ Mark as read
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ );
+
+ return (
+ <Popover content={content} trigger="click" open={open} onOpenChange={setOpen} placement="bottomRight">
+ <Button
+ type="text"
+ className="!flex !h-9 !w-9 items-center justify-center !rounded-md text-gray-600 transition-colors hover:!bg-gray-100 hover:!text-gray-900"
+ aria-label="Notifications"
+ >
+ <Badge dot={hasUnread} color="#1677ff" size="small" offset={[8, 2]}>
+ <BellOutlined className="text-base" aria-hidden />
+ </Badge>
+ </Button>
+ </Popover>
+ );
+};
diff --git a/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.test.tsx b/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.test.tsx
index de853303c15..31ddae31798 100644
--- a/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.test.tsx
+++ b/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.test.tsx
@@ -37,6 +37,8 @@ vi.mock("@/utils/localStorageUtils", () => ({
describe("UserDropdown", () => {
const mockOnLogout = vi.fn();
+ const getAccountTrigger = () => screen.getByRole("button", { name: /account menu/i });
+
beforeEach(() => {
vi.clearAllMocks();
mockUseAuthorizedImpl = () => ({
@@ -55,22 +57,23 @@ describe("UserDropdown", () => {
it("should render", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- expect(screen.getByRole("button")).toBeInTheDocument();
+ expect(getAccountTrigger()).toBeInTheDocument();
});
- it("should display user button with User text", () => {
+ it("should surface initials and account menu affordance", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- expect(screen.getByText("User")).toBeInTheDocument();
+ expect(getAccountTrigger()).toBeInTheDocument();
+ expect(screen.getByText("TE")).toBeInTheDocument();
});
it("should show user email when dropdown is opened", async () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
});
@@ -78,7 +81,7 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
expect(screen.getByText("test-user-id")).toBeInTheDocument();
@@ -89,10 +92,10 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("Admin")).toBeInTheDocument();
+ expect(screen.getAllByText("Admin").length).toBeGreaterThan(0);
});
});
@@ -100,7 +103,7 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
expect(screen.getByText("Standard")).toBeInTheDocument();
@@ -118,7 +121,7 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
expect(screen.getByText("Premium")).toBeInTheDocument();
@@ -129,10 +132,10 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
await user.click(screen.getByText("Logout"));
@@ -144,10 +147,10 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
const toggle = screen.getByLabelText("Toggle hide new feature indicators");
@@ -169,10 +172,10 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
const toggle = screen.getByLabelText("Toggle hide new feature indicators");
@@ -189,10 +192,10 @@ describe("UserDropdown", () => {
const user = userEvent.setup();
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
const toggle = screen.getByLabelText("Toggle hide all prompts");
@@ -215,10 +218,10 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
const toggle = screen.getByLabelText("Toggle hide all prompts");
@@ -231,6 +234,17 @@ describe("UserDropdown", () => {
expect(localStorageUtils.emitLocalStorageChange).toHaveBeenCalledWith("disableShowPrompts");
});
+ it("should show Account in the trigger when user id is the default placeholder", () => {
+ mockUseAuthorizedImpl = () => ({
+ userId: "default_user_id",
+ userEmail: null as any,
+ userRole: "Admin",
+ premiumUser: false,
+ });
+ renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
+ expect(screen.getByText("Account")).toBeInTheDocument();
+ });
+
it("should display dash when user email is not available", async () => {
const user = userEvent.setup();
mockUseAuthorizedImpl = () => ({
@@ -242,7 +256,7 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
expect(screen.getByText("-")).toBeInTheDocument();
@@ -260,7 +274,7 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
const dashElements = screen.getAllByText("-");
@@ -277,10 +291,10 @@ describe("UserDropdown", () => {
renderWithProviders(<UserDropdown onLogout={mockOnLogout} />);
- await user.click(screen.getByText("User"));
+ await user.click(getAccountTrigger());
await waitFor(() => {
- expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
});
const toggle = screen.getByLabelText("Toggle hide new feature indicators");
diff --git a/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx b/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx
index 6490cd32fa7..64a2f1260ba 100644
--- a/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx
+++ b/ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx
@@ -9,6 +9,7 @@ import {
removeLocalStorageItem,
setLocalStorageItem,
} from "@/utils/localStorageUtils";
+import { navAccountDisplayName } from "@/components/Navbar/navDisplayName";
import {
CrownOutlined,
DownOutlined,
@@ -23,6 +24,39 @@ import React, { useEffect, useState } from "react";
const { Text } = Typography;
+function hueFromString(seed: string): number {
+ let h = 0;
+ for (let i = 0; i < seed.length; i += 1) {
+ h = seed.charCodeAt(i) + ((h << 5) - h);
+ }
+ return Math.abs(h) % 360;
+}
+
+function initialsFromIdentity(email: string | null, userId: string | null): string {
+ const local = email?.split("@")[0]?.trim();
+ if (local) {
+ const parts = local
+ .replace(/[^a-zA-Z0-9]+/g, " ")
+ .trim()
+ .split(/\s+/)
+ .filter(Boolean);
+ if (parts.length >= 2) {
+ return `${parts[0]!.charAt(0)}${parts[1]!.charAt(0)}`.toUpperCase();
+ }
+ if (parts.length === 1) {
+ const p = parts[0]!;
+ return p.length >= 2 ? p.slice(0, 2).toUpperCase() : `${p.charAt(0)}`.toUpperCase();
+ }
+ }
+ if (userId && userId.length >= 2) {
+ return userId.slice(0, 2).toUpperCase();
+ }
+ if (userId && userId.length === 1) {
+ return `${userId.toUpperCase()}•`;
+ }
+ return "?";
+}
+
interface UserDropdownProps {
onLogout: () => void;
}
@@ -61,19 +95,12 @@ const UserDropdown: React.FC<UserDropdownProps> = ({ onLogout }) => {
<Text type="secondary">{userEmail || "-"}</Text>
</Space>
{premiumUser ? (
- <Tag
- icon={<CrownOutlined />}
- color="gold"
- >
+ <Tag icon={<CrownOutlined />} color="gold">
Premium
</Tag>
) : (
<Tooltip title="Upgrade to Premium for advanced features" placement="left">
- <Tag
- icon={<CrownOutlined />}
- >
- Standard
- </Tag>
+ <Tag icon={<CrownOutlined />}>Standard</Tag>
</Tooltip>
)}
</Space>
@@ -83,12 +110,7 @@ const UserDropdown: React.FC<UserDropdownProps> = ({ onLogout }) => {
<UserOutlined />
<Text type="secondary">User ID</Text>
</Space>
- <Text
- copyable
- ellipsis
- style={{ maxWidth: "150px" }}
- title={userId || "-"}
- >
+ <Text copyable ellipsis style={{ maxWidth: "150px" }} title={userId || "-"}>
{userId || "-"}
</Text>
</Space>
@@ -189,13 +211,17 @@ const UserDropdown: React.FC<UserDropdownProps> = ({ onLogout }) => {
</Space>
);
+ const seed = userEmail || userId || "user";
+ const initials = initialsFromIdentity(userEmail, userId);
+ const hue = hueFromString(seed);
+ const displayName = navAccountDisplayName(userEmail, userId);
+
return (
<Dropdown
+ trigger={["click"]}
menu={{ items: userItems }}
popupRender={(menu) => (
- <div
- className="bg-white rounded-lg shadow-lg"
- >
+ <div className="rounded-lg bg-white shadow-lg">
{renderUserInfoSection()}
<Divider style={{ margin: 0 }} />
{React.cloneElement(menu as React.ReactElement, {
@@ -204,12 +230,23 @@ const UserDropdown: React.FC<UserDropdownProps> = ({ onLogout }) => {
</div>
)}
>
- <Button type="text" >
- <Space>
- <UserOutlined />
- <Text>User</Text>
- <DownOutlined />
- </Space>
+ <Button
+ type="text"
+ className="!flex max-w-[min(200px,34vw)] items-center gap-2 !rounded-md !py-0.5 !pl-1 !pr-2 transition-colors hover:!bg-gray-100"
+ aria-label={`Account menu — ${userRole ?? "Unknown role"} — signed in as ${userEmail || userId || "unknown"}`}
+ aria-haspopup="menu"
+ >
+ <span
+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-semibold text-white shadow-inner ring-1 ring-black/5"
+ style={{ backgroundColor: `hsl(${hue} 46% 38%)` }}
+ aria-hidden
+ >
+ {initials}
+ </span>
+ <span className="hidden min-w-0 truncate text-left text-sm font-medium leading-none text-gray-900 md:inline">
+ {displayName}
+ </span>
+ <DownOutlined className="hidden shrink-0 text-[10px] text-gray-400 md:inline" aria-hidden />
</Button>
</Dropdown>
);
diff --git a/ui/litellm-dashboard/src/components/Navbar/navDisplayName.test.ts b/ui/litellm-dashboard/src/components/Navbar/navDisplayName.test.ts
new file mode 100644
index 00000000000..96e768c5d31
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Navbar/navDisplayName.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from "vitest";
+import { navAccountDisplayName } from "./navDisplayName";
+
+describe("navAccountDisplayName", () => {
+ it("should prefer email when present", () => {
+ expect(navAccountDisplayName("[email protected]", "ignored")).toBe("[email protected]");
+ });
+
+ it("should map default_user_id placeholder to Account", () => {
+ expect(navAccountDisplayName(null, "default_user_id")).toBe("Account");
+ expect(navAccountDisplayName(null, "DEFAULT_USER_ID")).toBe("Account");
+ });
+
+ it("should show a sensible token when user id is non-placeholder", () => {
+ expect(navAccountDisplayName(null, "user-uuid-123")).toBe("user-uuid-123");
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/Navbar/navDisplayName.ts b/ui/litellm-dashboard/src/components/Navbar/navDisplayName.ts
new file mode 100644
index 00000000000..d6f51dc37a8
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Navbar/navDisplayName.ts
@@ -0,0 +1,15 @@
+/** Primary label for the navbar account control — avoids raw placeholder JWT/user IDs in the UI. */
+export function navAccountDisplayName(userEmail: string | null, userId: string | null): string {
+ const email = userEmail?.trim();
+ if (email) {
+ return email;
+ }
+ const id = userId?.trim();
+ if (!id) {
+ return "Account";
+ }
+ if (/^default[_\s-]?user[_\s-]?id$/i.test(id)) {
+ return "Account";
+ }
+ return id;
+}
diff --git a/ui/litellm-dashboard/src/components/Navbar/navProductLinkClass.ts b/ui/litellm-dashboard/src/components/Navbar/navProductLinkClass.ts
new file mode 100644
index 00000000000..ca4b2e5d1f3
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Navbar/navProductLinkClass.ts
@@ -0,0 +1,3 @@
+/** Shared styling for Docs / Blog in the top nav (product navigation zone). */
+export const NAV_PRODUCT_LINK_CLASS =
+ "inline-flex h-9 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-sm font-medium leading-none text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-950";
diff --git a/ui/litellm-dashboard/src/components/navbar.test.tsx b/ui/litellm-dashboard/src/components/navbar.test.tsx
index 2e122164969..274e81db527 100644
--- a/ui/litellm-dashboard/src/components/navbar.test.tsx
+++ b/ui/litellm-dashboard/src/components/navbar.test.tsx
@@ -30,6 +30,7 @@ const mockUserDropdownData = vi.hoisted(() => ({
vi.mock("./Navbar/UserDropdown/UserDropdown", async (importOriginal) => {
const React = await import("react");
const { useState } = React;
+ const { Button } = await import("antd");
const localStorageUtils = await import("@/utils/localStorageUtils");
return {
default: function MockUserDropdown({ onLogout }: { onLogout: () => void }) {
@@ -37,9 +38,9 @@ vi.mock("./Navbar/UserDropdown/UserDropdown", async (importOriginal) => {
const [open, setOpen] = useState(false);
return (
<div>
- <button type="button" onClick={() => setOpen(!open)}>
- User
- </button>
+ <Button type="text" aria-label="Open account menu" onClick={() => setOpen(!open)}>
+ Account
+ </Button>
{open && (
<div data-testid="user-dropdown-content">
<span>{userId}</span>
@@ -136,30 +137,25 @@ Object.defineProperty(window, "location", {
describe("Navbar", () => {
const defaultProps = {
- userID: "test-user",
- userEmail: "[email protected]",
- userRole: "Admin",
- premiumUser: false,
proxySettings: {},
setProxySettings: vi.fn(),
accessToken: "test-token",
isPublicPage: false,
- isDarkMode: false,
- toggleDarkMode: vi.fn(),
};
it("should render without crashing", () => {
renderWithProviders(<Navbar {...defaultProps} />);
+ expect(screen.getByRole("button", { name: /^notifications$/i })).toBeInTheDocument();
expect(screen.getByText("Docs")).toBeInTheDocument();
- expect(screen.getByText("User")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /open account menu/i })).toBeInTheDocument();
});
it("should display user information in dropdown", async () => {
const user = userEvent.setup();
renderWithProviders(<Navbar {...defaultProps} />);
- await user.click(screen.getByText("User"));
+ await user.click(screen.getByRole("button", { name: /open account menu/i }));
await waitFor(() => {
expect(screen.getByText("test-user")).toBeInTheDocument();
@@ -198,7 +194,7 @@ describe("Navbar", () => {
});
renderWithProviders(<Navbar {...defaultProps} />);
- await user.click(screen.getByText("User"));
+ await user.click(screen.getByRole("button", { name: /open account menu/i }));
await waitFor(() => {
expect(screen.getByText("Premium")).toBeInTheDocument();
@@ -247,11 +243,12 @@ describe("Navbar", () => {
mockUseThemeImpl = () => ({ logoUrl: null });
});
- it("should hide user dropdown on public pages", () => {
+ it("should hide user dropdown and notifications on public pages", () => {
const publicPageProps = { ...defaultProps, isPublicPage: true };
renderWithProviders(<Navbar {...publicPageProps} />);
- expect(screen.queryByText("User")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /open account menu/i })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /^notifications$/i })).not.toBeInTheDocument();
});
it("should handle hide new features toggle", async () => {
@@ -265,7 +262,7 @@ describe("Navbar", () => {
renderWithProviders(<Navbar {...defaultProps} />);
- await user.click(screen.getByText("User"));
+ await user.click(screen.getByRole("button", { name: /open account menu/i }));
await waitFor(() => {
expect(screen.getByText("test-user")).toBeInTheDocument();
@@ -290,7 +287,7 @@ describe("Navbar", () => {
renderWithProviders(<Navbar {...defaultProps} />);
- await user.click(screen.getByText("User"));
+ await user.click(screen.getByRole("button", { name: /open account menu/i }));
await waitFor(() => {
expect(screen.getByText("test-user")).toBeInTheDocument();
diff --git a/ui/litellm-dashboard/src/components/navbar.tsx b/ui/litellm-dashboard/src/components/navbar.tsx
index 055038b6d88..e5a1490788c 100644
--- a/ui/litellm-dashboard/src/components/navbar.tsx
+++ b/ui/litellm-dashboard/src/components/navbar.tsx
@@ -1,47 +1,39 @@
import { useHealthReadinessDetails } from "@/app/(dashboard)/hooks/healthReadiness/useHealthReadinessDetails";
import { useDisableBouncingIcon } from "@/app/(dashboard)/hooks/useDisableBouncingIcon";
+import { useDisableShowPrompts } from "@/app/(dashboard)/hooks/useDisableShowPrompts";
+import { useWorker } from "@/hooks/useWorker";
import { getProxyBaseUrl } from "@/components/networking";
import { useTheme } from "@/contexts/ThemeContext";
import { clearTokenCookies } from "@/utils/cookieUtils";
import { clearStoredReturnUrl } from "@/utils/returnUrlUtils";
import { fetchProxySettings } from "@/utils/proxyUtils";
-import { MenuFoldOutlined, MenuUnfoldOutlined, MoonOutlined, SunOutlined } from "@ant-design/icons";
-import { Button, Switch, Tag } from "antd";
+import { DownOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
+import { Tag } from "antd";
import Link from "next/link";
import React, { useEffect, useState } from "react";
import { BlogDropdown } from "./Navbar/BlogDropdown/BlogDropdown";
import { CommunityEngagementButtons } from "./Navbar/CommunityEngagementButtons/CommunityEngagementButtons";
+import { NAV_PRODUCT_LINK_CLASS } from "./Navbar/navProductLinkClass";
+import { NotificationsBell } from "./Navbar/NotificationsBell/NotificationsBell";
import UserDropdown from "./Navbar/UserDropdown/UserDropdown";
import WorkerDropdown from "./Navbar/WorkerDropdown/WorkerDropdown";
interface NavbarProps {
- userID: string | null;
- userEmail: string | null;
- userRole: string | null;
- premiumUser: boolean;
proxySettings: any;
setProxySettings: React.Dispatch<React.SetStateAction<any>>;
accessToken: string | null;
isPublicPage: boolean;
sidebarCollapsed?: boolean;
onToggleSidebar?: () => void;
- isDarkMode: boolean;
- toggleDarkMode: () => void;
}
const Navbar: React.FC<NavbarProps> = ({
- userID,
- userEmail,
- userRole,
- premiumUser,
proxySettings,
setProxySettings,
accessToken,
isPublicPage = false,
sidebarCollapsed = false,
onToggleSidebar,
- isDarkMode,
- toggleDarkMode,
}) => {
const baseUrl = getProxyBaseUrl();
const [logoutUrl, setLogoutUrl] = useState("");
@@ -49,8 +41,10 @@ const Navbar: React.FC<NavbarProps> = ({
const { data: healthData } = useHealthReadinessDetails(accessToken);
const version = healthData?.litellm_version;
const disableBouncingIcon = useDisableBouncingIcon();
+ const hideCommunityLinks = useDisableShowPrompts();
+ const { isControlPlane, selectedWorker } = useWorker();
+ const showWorkerSwitch = isControlPlane && selectedWorker !== null;
- // Simple logo URL: use custom logo if available, otherwise default
const imageUrl = logoUrl || `${baseUrl}/get_image`;
useEffect(() => {
@@ -87,14 +81,14 @@ const Navbar: React.FC<NavbarProps> = ({
};
return (
- <nav className="bg-white border-b border-gray-200 sticky top-0 z-10">
+ <nav className="sticky top-0 z-10 border-b border-gray-200 bg-white">
<div className="w-full">
- <div className="flex items-center h-14 px-4">
- <div className="flex items-center flex-shrink-0">
+ <div className="flex h-14 items-center px-4">
+ <div className="flex flex-shrink-0 items-center">
{onToggleSidebar && (
<button
onClick={onToggleSidebar}
- className="flex items-center justify-center w-10 h-10 mr-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded transition-colors"
+ className="mr-2 flex h-9 w-9 items-center justify-center rounded-md text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900"
title={sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"}
>
<span className="text-lg">{sidebarCollapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}</span>
@@ -104,11 +98,11 @@ const Navbar: React.FC<NavbarProps> = ({
<div className="flex items-center gap-2">
<Link href={baseUrl ? baseUrl : "/"} className="flex items-center">
<div className="relative">
- <div className="h-10 max-w-48 flex items-center justify-center overflow-hidden">
+ <div className="flex h-10 max-w-48 items-center justify-center overflow-hidden">
<img
src={imageUrl}
alt="LiteLLM Brand"
- className="max-w-full max-h-full w-auto h-auto object-contain"
+ className="h-auto max-h-full w-auto max-w-full object-contain"
/>
</div>
</div>
@@ -117,14 +111,14 @@ const Navbar: React.FC<NavbarProps> = ({
<div className="relative">
{!disableBouncingIcon && (
<span
- className="absolute -top-1 -left-2 text-lg animate-bounce"
+ className="absolute -left-2 -top-1 animate-bounce text-lg"
style={{ animationDuration: "2s" }}
title="Thanks for using LiteLLM!"
>
🌑
</span>
)}
- <Tag className="relative text-xs font-medium cursor-pointer z-10">
+ <Tag className="relative z-10 cursor-pointer text-xs font-medium">
<a
href="https://docs.litellm.ai/release_notes"
target="_blank"
@@ -138,28 +132,48 @@ const Navbar: React.FC<NavbarProps> = ({
)}
</div>
</div>
- {/* Right side nav items */}
- <div className="flex items-center space-x-5 ml-auto">
- <WorkerDropdown onWorkerSwitch={handleWorkerSwitch} />
- <CommunityEngagementButtons />
- {/* Dark mode is currently a work in progress. To test, you can change 'false' to 'true' below.
- Do not set this to true by default until all components are confirmed to support dark mode styles. */}
- {false && (
- <Switch
- data-testid="dark-mode-toggle"
- checked={isDarkMode}
- onChange={toggleDarkMode}
- checkedChildren={<MoonOutlined />}
- unCheckedChildren={<SunOutlined />}
- />
+
+ <div className="ml-auto flex min-w-0 flex-1 items-center justify-end gap-4">
+ {showWorkerSwitch && (
+ <div className="flex shrink-0 items-center">
+ <WorkerDropdown onWorkerSwitch={handleWorkerSwitch} />
+ </div>
)}
- <Button type="text" href="https://docs.litellm.ai/docs/" target="_blank" rel="noopener noreferrer">
- Docs
- </Button>
- <BlogDropdown />
- {!isPublicPage && <UserDropdown onLogout={handleLogout} />}
+ <nav
+ aria-label="Product documentation"
+ className={`flex min-w-0 items-center gap-2 ${showWorkerSwitch ? "border-l border-gray-200 pl-4" : ""}`}
+ >
+ <a
+ href="https://docs.litellm.ai/docs/"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={NAV_PRODUCT_LINK_CLASS}
+ >
+ Docs
+ {/* Layout parity with Blog chevron — intentional single-level link */}
+ <DownOutlined className="pointer-events-none text-[10px] opacity-0" aria-hidden />
+ </a>
+ <BlogDropdown />
+ </nav>
+
+ {!hideCommunityLinks && (
+ <div className="flex shrink-0 items-center border-l border-gray-200 pl-4">
+ <CommunityEngagementButtons />
+ </div>
+ )}
+
+ {!isPublicPage && (
+ <div className="flex shrink-0 items-center border-l border-gray-200 pl-4">
+ <div className="flex items-center gap-0.5 rounded-lg bg-gray-50 px-1 py-0 transition-colors hover:bg-gray-100">
+ <NotificationsBell />
+ <span className="mx-0.5 h-6 w-px shrink-0 bg-gray-200" aria-hidden />
+ <UserDropdown onLogout={handleLogout} />
+ </div>
+ </div>
+ )}
</div>
+ {/* Dark mode toggle: keep disabled until the dashboard supports dark styles end-to-end. */}
</div>
</div>
</nav>
diff --git a/ui/litellm-dashboard/src/components/public_model_hub.tsx b/ui/litellm-dashboard/src/components/public_model_hub.tsx
index f4abc5b7b3c..6ebae675055 100644
--- a/ui/litellm-dashboard/src/components/public_model_hub.tsx
+++ b/ui/litellm-dashboard/src/components/public_model_hub.tsx
@@ -983,16 +983,10 @@ const PublicModelHub: React.FC<PublicModelHubProps> = ({ accessToken, isEmbedded
{/* Navigation - only show when not embedded */}
{!isEmbedded && (
<Navbar
- userID={null}
- userEmail={null}
- userRole={null}
- premiumUser={false}
setProxySettings={setProxySettings}
proxySettings={proxySettings}
accessToken={accessToken || null}
isPublicPage={true}
- isDarkMode={false}
- toggleDarkMode={() => {}}
/>
)}