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]

UI - fix invitation link + ensure team models returned when team has 'all-proxy-models' + team only models (#11524)

Krish Dholakia17d2711cf423
diff --git a/litellm/proxy/auth/model_checks.py b/litellm/proxy/auth/model_checks.py
index c5d2d4cf184..45584686f7b 100644
--- a/litellm/proxy/auth/model_checks.py
+++ b/litellm/proxy/auth/model_checks.py
@@ -108,17 +108,19 @@ def get_team_models(
- 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_set: Set[str] = set()
if len(team_models) > 0:
- all_models = team_models
- if SpecialModelNames.all_team_models.value in all_models:
- all_models = team_models
- if SpecialModelNames.all_proxy_models.value in all_models:
- all_models = proxy_model_list
+ all_models_set.update(team_models)
+ if SpecialModelNames.all_team_models.value in all_models_set:
+ all_models_set.update(team_models)
+ if SpecialModelNames.all_proxy_models.value in all_models_set:
+ all_models_set.update(proxy_model_list)
+
+ all_models = list(all_models_set)
all_models = _get_models_from_access_groups(
model_access_groups=model_access_groups,
- all_models=all_models,
+ all_models=list(all_models_set),
include_model_access_groups=include_model_access_groups,
)
diff --git a/tests/test_litellm/proxy/auth/test_model_checks.py b/tests/test_litellm/proxy/auth/test_model_checks.py
new file mode 100644
index 00000000000..ccd85a7148f
--- /dev/null
+++ b/tests/test_litellm/proxy/auth/test_model_checks.py
@@ -0,0 +1,21 @@
+from unittest.mock import AsyncMock, patch
+
+import pytest
+
+from litellm.proxy._types import LiteLLM_TeamTable, LiteLLM_UserTable, Member
+from litellm.proxy.auth.handle_jwt import JWTAuthManager
+
+
+def test_get_team_models_for_all_models_and_team_only_models():
+ from litellm.proxy.auth.model_checks import get_team_models
+
+ team_models = ["all-proxy-models", "team-only-model", "team-only-model-2"]
+ proxy_model_list = ["model1", "model2", "model3"]
+ model_access_groups = {}
+ include_model_access_groups = False
+
+ result = get_team_models(
+ team_models, proxy_model_list, model_access_groups, include_model_access_groups
+ )
+ combined_models = team_models + proxy_model_list
+ assert set(result) == set(combined_models)
diff --git a/ui/litellm-dashboard/src/components/onboarding_link.tsx b/ui/litellm-dashboard/src/components/onboarding_link.tsx
index c7dbc290a67..0f07ee6299a 100644
--- a/ui/litellm-dashboard/src/components/onboarding_link.tsx
+++ b/ui/litellm-dashboard/src/components/onboarding_link.tsx
@@ -41,14 +41,14 @@ export default function OnboardingModal({
};
const getInvitationUrl = () => {
- // Get the path from the base URL
const baseUrlObj = new URL(baseUrl);
- const basePath = baseUrlObj.pathname; // This will be "/litellm" or whatever the path is
-
+ const basePath = baseUrlObj.pathname; // This will be "/litellm" or ""
+ const path = basePath && basePath !== "/" ? `${basePath}/ui` : 'ui';
+ // Get the path from the base URL
if (invitationLinkData?.has_user_setup_sso) {
- return new URL(`${basePath}/ui`, baseUrl).toString();
+ return new URL(path, baseUrl).toString();
}
- const url = new URL(`${basePath}/ui?invitation_id=${invitationLinkData?.id}`, baseUrl).toString();
+ const url = new URL(`${path}?invitation_id=${invitationLinkData?.id}`, baseUrl).toString();
return url;
};