Skip to content

Add user management functionality to Python client library & CLI #10627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

msabramo
Copy link
Contributor

@msabramo msabramo commented May 7, 2025

Examples

Client library

from litellm.proxy.client import UsersManagementClient

users = UsersManagementClient(base_url="http://localhost:4000", api_key="sk-test")

# List users
user_list = users.list_users()

# Get user info
user_info = users.get_user(user_id="u1")

# Create a new user
created = users.create_user({
    "user_email": "[email protected]",
    "user_role": "internal_user",
    "user_alias": "Alice",
    "teams": ["team1"],
    "max_budget": 100.0
})

# Delete users
users.delete_user(["u1", "u2"])

CLI

Create User

Create new users:

litellm-proxy users create \
  [email protected] \
  --role=proxy_admin \
  --alias="John Smith" \
  --team=admin-team
litellm-proxy users create \
  [email protected] \
  --role=internal_user \
  --alias="Alice Jones" \
  --team=default-team \
  --max-budget=100.0

List Users

View all users:

litellm-proxy users list

Screenshot 2025-05-07 at 9 08 07 AM

Get User Info

Get information about a specific user:

litellm-proxy users get --id <user-id>

Delete User

Delete one or more users by user_id:

litellm-proxy users delete <user-id-1> <user-id-2>

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
    Screenshot 2025-05-07 at 8 58 30 AM
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature

Changes

Copy link

vercel bot commented May 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2025 5:26pm

@krrishdholakia krrishdholakia merged commit fcaa4a9 into BerriAI:main May 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants