Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:BerriAI Litellm Enterprise User Endpoints

From Leeroopedia
Revision as of 12:09, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/BerriAI_Litellm_Enterprise_User_Endpoints.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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:

  1. 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.
  2. Queries the LiteLLM_UserTable and LiteLLM_TeamTable for current counts.
  3. Extracts max_users and max_teams from the enterprise license data (premium_user_data).
  4. Returns a response with total limits, used counts, and remaining capacity (or None if 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

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment