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
fix(proxy_server.py): pass model access groups to get_key/get_team mo… (#7281)
Krish Dholakia0fe8bfe87ac9
diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.htmldeleted file mode 100644index eb587481b37..00000000000--- a/litellm/proxy/_experimental/out/404.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/ui/_next/static/css/86f6cc749f6b8493.css" data-precedence="next"/><link rel="stylesheet" href="/ui/_next/static/css/0940e922324b3d86.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/ui/_next/static/chunks/webpack-472fd7f7b6423233.js"/><script src="/ui/_next/static/chunks/fd9d1056-14fddc9b0ec5bb3e.js" async=""></script><script src="/ui/_next/static/chunks/23-8f224000d2532648.js" async=""></script><script src="/ui/_next/static/chunks/main-app-a85ad02fb0785c2e.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_cf7686"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/ui/_next/static/chunks/webpack-472fd7f7b6423233.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[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"style\"]\n3:HL[\"/ui/_next/static/css/0940e922324b3d86.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[39275,[],\"\"]\n7:I[61343,[],\"\"]\nd:I[76130,[],\"\"]\n8:{\"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\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"RGOvdwmDKbOr7ddjPRjMK\",\"assetPrefix\":\"/ui\",\"urlParts\":[\"\",\"_not-found\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"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.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/0940e922324b3d86.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_cf7686\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"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\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"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\"}],[\"$\",\"meta\",\"4\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/model_hub.html b/litellm/proxy/_experimental/out/model_hub.htmldeleted file mode 100644index 5b1276d2bce..00000000000--- a/litellm/proxy/_experimental/out/model_hub.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="/ui/_next/static/chunks/webpack-472fd7f7b6423233.js"/><script src="/ui/_next/static/chunks/fd9d1056-14fddc9b0ec5bb3e.js" async=""></script><script src="/ui/_next/static/chunks/23-8f224000d2532648.js" async=""></script><script src="/ui/_next/static/chunks/main-app-a85ad02fb0785c2e.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/ui/favicon.ico" type="image/x-icon" sizes="16x16"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body><script src="/ui/_next/static/chunks/webpack-472fd7f7b6423233.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[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"style\"]\n3:HL[\"/ui/_next/static/css/0940e922324b3d86.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[66513,[],\"ClientPageRoot\"]\n7:I[99327,[\"569\",\"static/chunks/569-fb5d4ecc1efc8220.js\",\"852\",\"static/chunks/852-8504c1dc77126607.js\",\"939\",\"static/chunks/939-446113ab9fc7760f.js\",\"418\",\"static/chunks/app/model_hub/page-544de941cb7f8d17.js\"],\"default\",1]\n8:I[39275,[],\"\"]\n9:I[61343,[],\"\"]\nb:I[76130,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"RGOvdwmDKbOr7ddjPRjMK\",\"assetPrefix\":\"/ui\",\"urlParts\":[\"\",\"model_hub\"],\"initialTree\":[\"\",{\"children\":[\"model_hub\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"model_hub\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"model_hub\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/0940e922324b3d86.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_cf7686\",\"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\":\"/ui/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"meta\",\"5\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index b9619b97b41..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="/ui/_next/static/chunks/webpack-472fd7f7b6423233.js"/><script src="/ui/_next/static/chunks/fd9d1056-14fddc9b0ec5bb3e.js" async=""></script><script src="/ui/_next/static/chunks/23-8f224000d2532648.js" async=""></script><script src="/ui/_next/static/chunks/main-app-a85ad02fb0785c2e.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/ui/favicon.ico" type="image/x-icon" sizes="16x16"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body><script src="/ui/_next/static/chunks/webpack-472fd7f7b6423233.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[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"style\"]\n3:HL[\"/ui/_next/static/css/0940e922324b3d86.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[66513,[],\"ClientPageRoot\"]\n7:I[62105,[\"665\",\"static/chunks/3014691f-0e3faeb6a30bdef5.js\",\"569\",\"static/chunks/569-fb5d4ecc1efc8220.js\",\"748\",\"static/chunks/748-ca0d88d4d972a1fe.js\",\"939\",\"static/chunks/939-446113ab9fc7760f.js\",\"461\",\"static/chunks/app/onboarding/page-0b0af9deafd4cedf.js\"],\"default\",1]\n8:I[39275,[],\"\"]\n9:I[61343,[],\"\"]\nb:I[76130,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"RGOvdwmDKbOr7ddjPRjMK\",\"assetPrefix\":\"/ui\",\"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\":\"/ui/_next/static/css/86f6cc749f6b8493.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/0940e922324b3d86.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_cf7686\",\"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\":\"/ui/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"meta\",\"5\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex 86946a65dac..e2b562bfc15 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -5,6 +5,8 @@ model_list:api_key: os.environ/AZURE_API_KEYapi_base: os.environ/AZURE_API_BASEtemperature: 0.2+ model_info:+ access_groups: ["default"]- model_name: gpt-4olitellm_params:model: openai/gpt-4odiff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.pyindex 45e8c844c4f..2127dfb5090 100644--- a/litellm/proxy/auth/auth_checks.py+++ b/litellm/proxy/auth/auth_checks.py@@ -12,7 +12,7 @@ Run checks for:import timeimport tracebackfrom datetime import datetime-from typing import TYPE_CHECKING, Any, List, Literal, Optional+from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optionalimport httpxfrom pydantic import BaseModel@@ -869,7 +869,7 @@ async def can_key_call_model()from collections import defaultdict- access_groups = defaultdict(list)+ access_groups: Dict[str, List[str]] = defaultdict(list)if llm_router:access_groups = llm_router.get_model_access_groups(model_name=model)if (diff --git a/litellm/proxy/auth/model_checks.py b/litellm/proxy/auth/model_checks.pyindex dd22a7f47d0..c568d887a96 100644--- a/litellm/proxy/auth/model_checks.py+++ b/litellm/proxy/auth/model_checks.py@@ -1,6 +1,6 @@# What is this?## Common checks for /v1/models and `/model/info`-from typing import List, Optional+from typing import Dict, List, Optionalimport litellmfrom litellm._logging import verbose_proxy_logger@@ -38,15 +38,36 @@ def get_provider_models(provider: str) -> Optional[List[str]]:return None+def _get_models_from_access_groups(+ model_access_groups: Dict[str, List[str]],+ all_models: List[str],+) -> List[str]:+ idx_to_remove = []+ new_models = []+ for idx, model in enumerate(all_models):+ if model in model_access_groups:+ idx_to_remove.append(idx)+ new_models.extend(model_access_groups[model])++ for idx in sorted(idx_to_remove, reverse=True):+ all_models.pop(idx)++ all_models.extend(new_models)+ return all_models++def get_key_models(- user_api_key_dict: UserAPIKeyAuth, proxy_model_list: List[str]+ user_api_key_dict: UserAPIKeyAuth,+ proxy_model_list: List[str],+ model_access_groups: Dict[str, List[str]],) -> List[str]:"""Returns:- List of model name strings- Empty list if no models set+ - If model_access_groups is provided, only return models that are in the access groups"""- all_models = []+ all_models: List[str] = []if len(user_api_key_dict.models) > 0:all_models = user_api_key_dict.modelsif SpecialModelNames.all_team_models.value in all_models:@@ -54,17 +75,24 @@ def get_key_models(if SpecialModelNames.all_proxy_models.value in all_models:all_models = proxy_model_list+ all_models = _get_models_from_access_groups(+ model_access_groups=model_access_groups, all_models=all_models+ )+verbose_proxy_logger.debug("ALL KEY MODELS - {}".format(len(all_models)))return all_modelsdef get_team_models(- user_api_key_dict: UserAPIKeyAuth, proxy_model_list: List[str]+ user_api_key_dict: UserAPIKeyAuth,+ proxy_model_list: List[str],+ model_access_groups: Dict[str, List[str]],) -> List[str]:"""Returns:- List of model name strings- Empty list if no models set+ - If model_access_groups is provided, only return models that are in the access groups"""all_models = []if len(user_api_key_dict.team_models) > 0:@@ -74,6 +102,10 @@ def get_team_models(if SpecialModelNames.all_proxy_models.value in all_models:all_models = proxy_model_list+ all_models = _get_models_from_access_groups(+ model_access_groups=model_access_groups, all_models=all_models+ )+verbose_proxy_logger.debug("ALL TEAM MODELS - {}".format(len(all_models)))return all_models@@ -93,9 +125,7 @@ def get_complete_model_list(If list contains wildcard -> return known provider models"""-unique_models = set()-if key_models:unique_models.update(key_models)elif team_models:diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 4210d6035c5..2052082c4bc 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -101,7 +101,7 @@ def generate_feedback_box():print() # noqa-import pydantic+from collections import defaultdictimport litellmfrom litellm import (@@ -3207,16 +3207,23 @@ async def model_list("""global llm_model_list, general_settings, llm_routerall_models = []+ model_access_groups: Dict[str, List[str]] = defaultdict(list)## CHECK IF MODEL RESTRICTIONS ARE SET AT KEY/TEAM LEVEL ##if llm_router is None:proxy_model_list = []else:proxy_model_list = llm_router.get_model_names()+ model_access_groups = llm_router.get_model_access_groups()key_models = get_key_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)+team_models = get_team_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)all_models = get_complete_model_list(key_models=key_models,@@ -7136,17 +7143,22 @@ async def model_info_v1( # noqa: PLR0915return {"data": _deployment_info_dict}all_models: List[dict] = []+ model_access_groups: Dict[str, List[str]] = defaultdict(list)## CHECK IF MODEL RESTRICTIONS ARE SET AT KEY/TEAM LEVEL ##if llm_router is None:proxy_model_list = []else:proxy_model_list = llm_router.get_model_names()-+ model_access_groups = llm_router.get_model_access_groups()key_models = get_key_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)team_models = get_team_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)all_models_str = get_complete_model_list(key_models=key_models,@@ -7358,16 +7370,22 @@ async def model_group_info(status_code=500, detail={"error": "LLM Router is not loaded in"})## CHECK IF MODEL RESTRICTIONS ARE SET AT KEY/TEAM LEVEL ##+ model_access_groups: Dict[str, List[str]] = defaultdict(list)if llm_router is None:proxy_model_list = []else:proxy_model_list = llm_router.get_model_names()+ model_access_groups = llm_router.get_model_access_groups()key_models = get_key_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)team_models = get_team_models(- user_api_key_dict=user_api_key_dict, proxy_model_list=proxy_model_list+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,)all_models_str = get_complete_model_list(key_models=key_models,diff --git a/litellm/router.py b/litellm/router.pyindex ece6a97598b..368be65775d 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -4653,7 +4653,9 @@ class Router:return returned_modelsreturn None- def get_model_access_groups(self, model_name: Optional[str] = None):+ def get_model_access_groups(+ self, model_name: Optional[str] = None+ ) -> Dict[str, List[str]]:"""If model_name is provided, only return access groups for that model."""diff --git a/tests/proxy_unit_tests/test_proxy_utils.py b/tests/proxy_unit_tests/test_proxy_utils.pyindex 5d2979de134..5ebff141a97 100644--- a/tests/proxy_unit_tests/test_proxy_utils.py+++ b/tests/proxy_unit_tests/test_proxy_utils.py@@ -885,3 +885,52 @@ def test_enforced_params_check(user_api_key_dict=user_api_key_dict,premium_user=True,)+++def test_get_key_models():+ from litellm.proxy.auth.model_checks import get_key_models+ from collections import defaultdict++ user_api_key_dict = UserAPIKeyAuth(+ api_key="test_api_key",+ user_id="test_user_id",+ org_id="test_org_id",+ models=["default"],+ )+ proxy_model_list = ["gpt-4o", "gpt-3.5-turbo"]+ model_access_groups = defaultdict(list)+ model_access_groups["default"].extend(["gpt-4o", "gpt-3.5-turbo"])+ model_access_groups["default"].extend(["gpt-4o-mini"])+ model_access_groups["team2"].extend(["gpt-3.5-turbo"])++ result = get_key_models(+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,+ )+ assert result == ["gpt-4o", "gpt-3.5-turbo", "gpt-4o-mini"]+++def test_get_team_models():+ from litellm.proxy.auth.model_checks import get_team_models+ from collections import defaultdict++ user_api_key_dict = UserAPIKeyAuth(+ api_key="test_api_key",+ user_id="test_user_id",+ org_id="test_org_id",+ models=[],+ team_models=["default"],+ )+ proxy_model_list = ["gpt-4o", "gpt-3.5-turbo"]+ model_access_groups = defaultdict(list)+ model_access_groups["default"].extend(["gpt-4o", "gpt-3.5-turbo"])+ model_access_groups["default"].extend(["gpt-4o-mini"])+ model_access_groups["team2"].extend(["gpt-3.5-turbo"])++ result = get_team_models(+ user_api_key_dict=user_api_key_dict,+ proxy_model_list=proxy_model_list,+ model_access_groups=model_access_groups,+ )+ assert result == ["gpt-4o", "gpt-3.5-turbo", "gpt-4o-mini"]