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
modernize /team/available endpoint, migrate link to UI
yuneng-jiang70ebdeec8ba6
diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.pyindex 8e903180ac5..b45ac26a9ee 100644--- a/litellm/proxy/management_endpoints/team_endpoints.py+++ b/litellm/proxy/management_endpoints/team_endpoints.py@@ -3095,12 +3095,7 @@ async def list_available_teams(),)if available_teams is None:- raise HTTPException(- status_code=400,- detail={- "error": "No available teams for user to join. See how to set available teams here: https://docs.litellm.ai/docs/proxy/self_serve#all-settings-for-self-serve--sso-flow"- },- )+ return []# filter out teams that the user is already a member ofuser_info = await prisma_client.db.litellm_usertable.find_unique(diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.pyindex 7e351e29168..c4c953b75fb 100644--- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py@@ -38,6 +38,7 @@ from litellm.proxy.management_endpoints.team_endpoints import (_transform_teams_to_deleted_records,_validate_and_populate_member_user_info,delete_team,+ list_available_teams,router,team_member_add_duplication_check,team_member_delete,@@ -5871,3 +5872,37 @@ async def test_validate_and_populate_member_user_info_only_user_id_not_found():mock_prisma_client.db.litellm_usertable.find_unique.assert_called_once_with(where={"user_id": "nonexistent-user"})+++async def test_list_available_teams_returns_empty_list_when_none_configured():+ """+ Test that /team/available returns an empty list when no available teams+ are configured, instead of raising an exception.+ """+ import litellm++ mock_request = MagicMock()+ mock_user_key = UserAPIKeyAuth(user_id="test-user", token="fake-token")++ with patch(+ "litellm.proxy.proxy_server.prisma_client", mock_prisma_client+ ):+ # Case 1: default_internal_user_params is None+ original = litellm.default_internal_user_params+ litellm.default_internal_user_params = None+ result = await list_available_teams(+ http_request=mock_request,+ user_api_key_dict=mock_user_key,+ )+ assert result == []++ # Case 2: default_internal_user_params exists but has no "available_teams" key+ litellm.default_internal_user_params = {"some_other_param": "value"}+ result = await list_available_teams(+ http_request=mock_request,+ user_api_key_dict=mock_user_key,+ )+ assert result == []++ litellm.default_internal_user_params = originaldiff --git a/ui/litellm-dashboard/src/components/team/available_teams.tsx b/ui/litellm-dashboard/src/components/team/available_teams.tsxindex d4a172e8d01..34dcd126714 100644--- a/ui/litellm-dashboard/src/components/team/available_teams.tsx+++ b/ui/litellm-dashboard/src/components/team/available_teams.tsx@@ -113,7 +113,16 @@ const AvailableTeamsPanel: React.FC<AvailableTeamsProps> = ({ accessToken, userI{availableTeams.length === 0 && (<TableRow><TableCell colSpan={5} className="text-center">- <Text>No available teams to join</Text>+ <Text>No available teams to join. See how to set available teams{" "}+ <a+ href="https://docs.litellm.ai/docs/proxy/self_serve#all-settings-for-self-serve--sso-flow"+ target="_blank"+ rel="noopener noreferrer"+ className="text-blue-500 hover:text-blue-700 underline"+ >+ here+ </a>.+ </Text></TableCell></TableRow>)}