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]

[Feature] Add disable_custom_api_keys toggle to UI Settings page

yuneng-jiangc687e631b458
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx
index a22c78c9430..0d12a4c4bf5 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx
@@ -24,6 +24,7 @@ export default function UISettings() {
const disableVectorStoresProperty = schema?.properties?.disable_vector_stores_for_internal_users;
const allowVectorStoresTeamAdminsProperty = schema?.properties?.allow_vector_stores_for_team_admins;
const scopeUserSearchProperty = schema?.properties?.scope_user_search_to_org;
+ const disableCustomApiKeysProperty = schema?.properties?.disable_custom_api_keys;
const values = data?.values ?? {};
const isDisabledForInternalUsers = Boolean(values.disable_model_add_for_internal_users);
const isDisabledTeamAdminDeleteTeamUser = Boolean(values.disable_team_admin_delete_team_user);
@@ -182,6 +183,20 @@ export default function UISettings() {
);
};
+ const handleToggleDisableCustomApiKeys = (checked: boolean) => {
+ updateSettings(
+ { disable_custom_api_keys: checked },
+ {
+ onSuccess: () => {
+ NotificationManager.success("UI settings updated successfully");
+ },
+ onError: (error) => {
+ NotificationManager.fromBackend(error);
+ },
+ },
+ );
+ };
+
return (
<Card title="UI Settings">
{isLoading ? (
@@ -382,6 +397,26 @@ export default function UISettings() {
<Divider />
+ {/* Disable custom API key values */}
+ <Space align="start" size="middle">
+ <Switch
+ checked={Boolean(values.disable_custom_api_keys)}
+ disabled={isUpdating}
+ loading={isUpdating}
+ onChange={handleToggleDisableCustomApiKeys}
+ aria-label={disableCustomApiKeysProperty?.description ?? "Disable custom API key values"}
+ />
+ <Space direction="vertical" size={4}>
+ <Typography.Text strong>Disable custom API key values</Typography.Text>
+ <Typography.Text type="secondary">
+ {disableCustomApiKeysProperty?.description ??
+ "If true, users cannot specify custom API key values. All keys must be auto-generated."}
+ </Typography.Text>
+ </Space>
+ </Space>
+
+ <Divider />
+
{/* Page Visibility for Internal Users */}
<PageVisibilitySettings
enabledPagesInternalUsers={values.enabled_ui_pages_internal_users}