Implementation:BerriAI Litellm Enterprise User Endpoints
Appearance
| Attribute | Value |
|---|---|
| Sources | enterprise/litellm_enterprise/proxy/management_endpoints/internal_user_endpoints.py |
| Domains | User Management, REST API, Enterprise, Licensing |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
This module defines an enterprise FastAPI endpoint that returns available user and team capacity information based on enterprise license limits.
Description
The module provides a single endpoint:
- GET /user/available_users -- Returns the total allowed users and teams (from the enterprise license), the current count of users and teams in the database, and the remaining capacity.
Behavior:
- Checks if the user holds a premium license. If not, it checks if SSO is enabled -- in which case a default limit of 5 users is applied.
- Queries the
LiteLLM_UserTableandLiteLLM_TeamTablefor current counts. - Extracts
max_usersandmax_teamsfrom the enterprise license data (premium_user_data). - Returns a response with total limits, used counts, and remaining capacity (or
Noneif no limit is set).
The endpoint requires user_api_key_auth authentication and a connected Prisma database.
Usage
Mount the router on the LiteLLM proxy to enable the UI or admin tools to display user/team capacity relative to enterprise license limits.
Code Reference
Source Location
enterprise/litellm_enterprise/proxy/management_endpoints/internal_user_endpoints.py
Signature
router = APIRouter()
@router.get("/user/available_users", tags=["Internal User management"])
async def available_enterprise_users(
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
): ...
Import
from litellm_enterprise.proxy.management_endpoints.internal_user_endpoints import router
I/O Contract
Inputs
| Parameter | Type | Description |
|---|---|---|
user_api_key_dict |
UserAPIKeyAuth |
Authenticated user API key (via dependency injection). |
Outputs
| Field | Type | Description |
|---|---|---|
total_users |
Optional[int] |
Maximum users allowed by the enterprise license. |
total_teams |
Optional[int] |
Maximum teams allowed by the enterprise license. |
total_users_used |
int |
Current number of users in the database. |
total_teams_used |
int |
Current number of teams in the database. |
total_users_remaining |
Optional[int] |
Remaining user slots (None if unlimited).
|
total_teams_remaining |
Optional[int] |
Remaining team slots (None if unlimited).
|
Usage Examples
import httpx
response = httpx.get(
"http://localhost:4000/user/available_users",
headers={"Authorization": "Bearer sk-..."},
)
# Response:
# {
# "total_users": 100,
# "total_teams": 20,
# "total_users_used": 45,
# "total_teams_used": 8,
# "total_users_remaining": 55,
# "total_teams_remaining": 12
# }
Related Pages
- BerriAI_Litellm_Enterprise_API_Key_Auth -- Enterprise API key authentication
- BerriAI_Litellm_Enterprise_SSO_Handler -- Enterprise SSO authentication
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment