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
Add key expiry and auto-rotation settings
Ishaan Jaffer1009a38ff49e
diff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/model_hub_table.htmlrename to litellm/proxy/_experimental/out/model_hub_table/index.htmldiff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index 1dc5fdb1f85..00000000000--- a/litellm/proxy/_experimental/out/onboarding.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-a426aae3231a8df1.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-205af899b895cbac.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/117-6a9f6a591033d4a0.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-bb35cb240fbb9dca.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-a426aae3231a8df1.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/4103fa525703177b.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[12011,[\"665\",\"static/chunks/3014691f-b7b79b78e27792f3.js\",\"50\",\"static/chunks/50-d0da2dd7acce2eb9.js\",\"154\",\"static/chunks/154-b1f2a106d0e0d77b.js\",\"461\",\"static/chunks/app/onboarding/page-d0d85032bb87ba51.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\nb:I[61060,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"0oPk2eYtSaTLaPyVixqA8\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"onboarding\"],\"initialTree\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"onboarding\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/4103fa525703177b.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/ui/litellm-dashboard/src/components/common_components/KeyLifecycleSettings.tsx b/ui/litellm-dashboard/src/components/common_components/KeyLifecycleSettings.tsxnew file mode 100644index 00000000000..d3b009599d7--- /dev/null+++ b/ui/litellm-dashboard/src/components/common_components/KeyLifecycleSettings.tsx@@ -0,0 +1,93 @@+import React from "react";+import { Form, Switch, Select, Typography, Tooltip } from "antd";+import { InfoCircleOutlined } from "@ant-design/icons";+import { TextInput } from "@tremor/react";++const { Text } = Typography;+const { Option } = Select;++interface KeyLifecycleSettingsProps {+ form: any; // Form instance from parent+ autoRotationEnabled: boolean;+ onAutoRotationChange: (enabled: boolean) => void;+ rotationInterval: string;+ onRotationIntervalChange: (interval: string) => void;+}++const KeyLifecycleSettings: React.FC<KeyLifecycleSettingsProps> = ({+ form,+ autoRotationEnabled,+ onAutoRotationChange,+ rotationInterval,+ onRotationIntervalChange,+}) => {+ return (+ <div className="space-y-4">+ <Form.Item+ label={+ <span>+ Expire Key{' '}+ <Tooltip title="Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days)">+ <InfoCircleOutlined style={{ marginLeft: '4px' }} />+ </Tooltip>+ </span>+ }+ name="duration"+ className="mb-4"+ >+ <TextInput placeholder="e.g., 30d" />+ </Form.Item>++ <div className="mb-4">+ <div className="flex items-center justify-between mb-3">+ <div className="flex items-center gap-2">+ <Text className="text-sm font-medium text-gray-700">Enable Auto-Rotation</Text>+ <Tooltip title="Automatically rotate this API key at regular intervals for enhanced security. A new key will be generated and the old one will be deactivated.">+ <InfoCircleOutlined className="text-gray-400" style={{ fontSize: '14px' }} />+ </Tooltip>+ </div>+ <Switch+ checked={autoRotationEnabled}+ onChange={onAutoRotationChange}+ size="default"+ />+ </div>++ {autoRotationEnabled && (+ <div className="ml-4 pl-4 border-l-2 border-gray-200">+ <Form.Item+ label={+ <span>+ Rotation Interval{' '}+ <Tooltip title="How often the key should be automatically rotated. Choose the interval that best fits your security requirements.">+ <InfoCircleOutlined style={{ marginLeft: '4px' }} />+ </Tooltip>+ </span>+ }+ name="rotation_interval"+ className="mb-2"+ >+ <Select+ value={rotationInterval}+ onChange={onRotationIntervalChange}+ style={{ width: '200px' }}+ placeholder="Select interval"+ >+ <Option value="7d">7 days</Option>+ <Option value="30d">30 days</Option>+ <Option value="60d">60 days</Option>+ <Option value="90d">90 days</Option>+ </Select>+ </Form.Item>++ <Text className="text-xs text-gray-500 block">+ When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period.+ </Text>+ </div>+ )}+ </div>+ </div>+ );+};++export default KeyLifecycleSettings;diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsxindex 3771ea5b1bc..df9e30d2521 100644--- a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx+++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx@@ -34,6 +34,7 @@ import { callback_map, mapDisplayToInternalNames } from "../callback_info_helperimport MCPServerSelector from "../mcp_server_management/MCPServerSelector"import ModelAliasManager from "../common_components/ModelAliasManager"import NotificationsManager from "../molecules/notifications_manager"+import KeyLifecycleSettings from "../common_components/KeyLifecycleSettings"const { Option } = Select;@@ -169,6 +170,8 @@ const CreateKey: React.FC<CreateKeyProps> = ({const [disabledCallbacks, setDisabledCallbacks] = useState<string[]>([]);const [keyType, setKeyType] = useState<string>("default");const [modelAliases, setModelAliases] = useState<{ [key: string]: string }>({});+ const [autoRotationEnabled, setAutoRotationEnabled] = useState<boolean>(false);+ const [rotationInterval, setRotationInterval] = useState<string>("30d");const handleOk = () => {setIsModalVisible(false);@@ -177,6 +180,8 @@ const CreateKey: React.FC<CreateKeyProps> = ({setDisabledCallbacks([]);setKeyType("default");setModelAliases({});+ setAutoRotationEnabled(false);+ setRotationInterval("30d");};const handleCancel = () => {@@ -188,6 +193,8 @@ const CreateKey: React.FC<CreateKeyProps> = ({setDisabledCallbacks([]);setKeyType("default");setModelAliases({});+ setAutoRotationEnabled(false);+ setRotationInterval("30d");};useEffect(() => {@@ -320,6 +327,15 @@ const CreateKey: React.FC<CreateKeyProps> = ({};}+ // Add auto-rotation settings to the metadata+ if (autoRotationEnabled) {+ metadata = {+ ...metadata,+ auto_rotation_enabled: true,+ rotation_interval: rotationInterval+ };+ }+// Update the formValues with the final metadataformValues.metadata = JSON.stringify(metadata);@@ -823,20 +839,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({><NumericalInput step={1} width={400} /></Form.Item>- <Form.Item- label={- <span>- Expire Key{' '}- <Tooltip title="Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days)">- <InfoCircleOutlined style={{ marginLeft: '4px' }} />- </Tooltip>- </span>- }- name="duration"- className="mt-4"- >- <TextInput placeholder="e.g., 30d" />- </Form.Item><Form.Itemlabel={<span>@@ -1053,6 +1055,23 @@ const CreateKey: React.FC<CreateKeyProps> = ({</div></AccordionBody></Accordion>++ <Accordion className="mt-4 mb-4">+ <AccordionHeader>+ <b>Key Expiry & Auto-Rotation</b>+ </AccordionHeader>+ <AccordionBody>+ <div className="mt-4">+ <KeyLifecycleSettings+ form={form}+ autoRotationEnabled={autoRotationEnabled}+ onAutoRotationChange={setAutoRotationEnabled}+ rotationInterval={rotationInterval}+ onRotationIntervalChange={setRotationInterval}+ />+ </div>+ </AccordionBody>+ </Accordion><Accordion className="mt-4 mb-4"><AccordionHeader><div className="flex items-center gap-2">