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
[ Proxy - User Management]: If user assigned to a team don't show Default Team (#5791)
Ishaan Jaffe6018a464ff9
diff --git a/docs/my-website/docs/proxy/ui.md b/docs/my-website/docs/proxy/ui.mdindex 02d2afb7b6a..85cb2eb9871 100644--- a/docs/my-website/docs/proxy/ui.md+++ b/docs/my-website/docs/proxy/ui.md@@ -239,6 +239,22 @@ If you don't see all your keys this could be due to a cached token. So just re-l:::+### Disable `Default Team` on Admin UI++Use this if you want to hide the Default Team on the Admin UI++The following logic will apply+- If team assigned don't show `Default Team`+- If no team assigned then they should see `Default Team`++Set `default_team_disabled: true` on your litellm config.yaml++```yaml+general_settings:+ master_key: sk-1234+ default_team_disabled: true # OR you can set env var PROXY_DEFAULT_TEAM_DISABLED="true"+```+### Sign in with Username, Password when SSO is onIf you need to access the UI via username/password when SSO is on navigate to `/fallback/login`. This route will allow you to sign in with your username/password credentials.diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 57873e94a91..ee375a875db 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -289,7 +289,7 @@ class LiteLLMRoutes(enum.Enum):"/key/delete","/global/spend/logs","/global/predict/spend/logs",- "/sso/get/logout_url",+ "/sso/get/ui_settings",]management_routes = [ # keydiff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.pyindex 4a62321d9ac..d49d9843ec5 100644--- a/litellm/proxy/auth/user_api_key_auth.py+++ b/litellm/proxy/auth/user_api_key_auth.py@@ -1038,7 +1038,7 @@ async def user_api_key_auth(# this token is only used for managing the uiallowed_routes = ["/sso",- "/sso/get/logout_url",+ "/sso/get/ui_settings","/login","/key/generate","/key/update",diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yamlindex eaf94974bc6..1795adf71fe 100644--- a/litellm/proxy/proxy_config.yaml+++ b/litellm/proxy/proxy_config.yaml@@ -21,6 +21,11 @@ model_list:api_base: https://exampleopenaiendpoint-production.up.railway.app++general_settings:+ master_key: sk-1234+ default_team_disabled: true+litellm_settings:success_callback: ["prometheus"]diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 613dacb5721..8c6bc618c47 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -659,6 +659,11 @@ def load_from_azure_key_vault(use_azure_key_vault: bool = False):# Set your Azure Key Vault URIKVUri = os.getenv("AZURE_KEY_VAULT_URI", None)+ if KVUri is None:+ raise Exception(+ "Error when loading keys from Azure Key Vault: AZURE_KEY_VAULT_URI is not set."+ )+credential = DefaultAzureCredential()# Create the SecretClient using the credential@@ -8342,16 +8347,25 @@ async def login(request: Request):@app.get(- "/sso/get/logout_url",+ "/sso/get/ui_settings",tags=["experimental"],include_in_schema=False,dependencies=[Depends(user_api_key_auth)],)-async def get_logout_url(request: Request):+async def get_ui_settings(request: Request):_proxy_base_url = os.getenv("PROXY_BASE_URL", None)_logout_url = os.getenv("PROXY_LOGOUT_URL", None)- return {"PROXY_BASE_URL": _proxy_base_url, "PROXY_LOGOUT_URL": _logout_url}+ default_team_disabled = general_settings.get("default_team_disabled", False)+ if "PROXY_DEFAULT_TEAM_DISABLED" in os.environ:+ if os.environ["PROXY_DEFAULT_TEAM_DISABLED"].lower() == "true":+ default_team_disabled = True++ return {+ "PROXY_BASE_URL": _proxy_base_url,+ "PROXY_LOGOUT_URL": _logout_url,+ "DEFAULT_TEAM_DISABLED": default_team_disabled,+ }@app.get("/onboarding/get_token", include_in_schema=False)diff --git a/ui/litellm-dashboard/src/components/dashboard_default_team.tsx b/ui/litellm-dashboard/src/components/dashboard_default_team.tsxindex 98f287ed4c9..7ba67ef3c36 100644--- a/ui/litellm-dashboard/src/components/dashboard_default_team.tsx+++ b/ui/litellm-dashboard/src/components/dashboard_default_team.tsx@@ -1,10 +1,12 @@import React, { useState, useEffect } from "react";import { Select, SelectItem, Text, Title } from "@tremor/react";+import { ProxySettings } from "./user_dashboard";interface DashboardTeamProps {teams: Object[] | null;setSelectedTeam: React.Dispatch<React.SetStateAction<any | null>>;userRole: string | null;+ proxySettings: ProxySettings | null;}type TeamInterface = {@@ -17,6 +19,7 @@ const DashboardTeam: React.FC<DashboardTeamProps> = ({teams,setSelectedTeam,userRole,+ proxySettings,}) => {const defaultTeam: TeamInterface = {models: [],@@ -31,6 +34,8 @@ const DashboardTeam: React.FC<DashboardTeamProps> = ({if (userRole === "App User") {// Non-Admin SSO users should only see their own team - they should not see "Default Team"updatedTeams = teams;+ } else if (proxySettings && proxySettings.DEFAULT_TEAM_DISABLED === true) {+ updatedTeams = teams ? [...teams] : [defaultTeam];} else {updatedTeams = teams ? [...teams, defaultTeam] : [defaultTeam];}diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsxindex 27d1096992e..635edaf4b3e 100644--- a/ui/litellm-dashboard/src/components/networking.tsx+++ b/ui/litellm-dashboard/src/components/networking.tsx@@ -2752,8 +2752,8 @@ export const getProxyBaseUrlAndLogoutUrl = async (*/try {let url = proxyBaseUrl- ? `${proxyBaseUrl}/sso/get/logout_url`- : `/sso/get/logout_url`;+ ? `${proxyBaseUrl}/sso/get/ui_settings`+ : `sso/get/ui_settings`;//message.info("Requesting model data");const response = await fetch(url, {diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsxindex 712e4267606..a1866b6b850 100644--- a/ui/litellm-dashboard/src/components/user_dashboard.tsx+++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx@@ -28,6 +28,12 @@ type UserSpendData = {max_budget?: number | null;};+export interface ProxySettings {+ PROXY_BASE_URL: string | null;+ PROXY_LOGOUT_URL: string | null;+ DEFAULT_TEAM_DISABLED: boolean;+}+function getCookie(name: string) {console.log("COOKIES", document.cookie)const cookieValue = document.cookie@@ -46,8 +52,6 @@ interface UserDashboardProps {setUserEmail: React.Dispatch<React.SetStateAction<string | null>>;setTeams: React.Dispatch<React.SetStateAction<Object[] | null>>;setKeys: React.Dispatch<React.SetStateAction<Object[] | null>>;- setProxySettings: React.Dispatch<React.SetStateAction<any>>;- proxySettings: any;premiumUser: boolean;}@@ -67,8 +71,6 @@ const UserDashboard: React.FC<UserDashboardProps> = ({setUserEmail,setTeams,setKeys,- setProxySettings,- proxySettings,premiumUser,}) => {const [userSpendData, setUserSpendData] = useState<UserSpendData | null>(@@ -87,6 +89,7 @@ const UserDashboard: React.FC<UserDashboardProps> = ({const [accessToken, setAccessToken] = useState<string | null>(null);const [teamSpend, setTeamSpend] = useState<number | null>(null);const [userModels, setUserModels] = useState<string[]>([]);+ const [proxySettings, setProxySettings] = useState<ProxySettings | null>(null);const defaultTeam: TeamInterface = {models: [],team_alias: "Default Team",@@ -166,7 +169,7 @@ const UserDashboard: React.FC<UserDashboardProps> = ({} else {const fetchData = async () => {try {- const proxy_settings = await getProxyBaseUrlAndLogoutUrl(accessToken);+ const proxy_settings: ProxySettings = await getProxyBaseUrlAndLogoutUrl(accessToken);setProxySettings(proxy_settings);const response = await userInfoCall(@@ -347,6 +350,7 @@ const UserDashboard: React.FC<UserDashboardProps> = ({teams={teams}setSelectedTeam={setSelectedTeam}userRole={userRole}+ proxySettings={proxySettings}/></Col></Grid>