latestOpenAPI 3.1.02026-08-236994571.1 MB

79928a3d37d3

Internal User management

New User

Use this to create a new INTERNAL user with a budget. Internal Users can access LiteLLM Admin UI to make keys, request access to models. This creates a new user and generates a new api key for the new user. The new api key is returned.

Returns user id, budget + new key.

Parameters:

  • user_id: Optional[str] - Specify a user id. If not set, a unique id will be generated.
  • user_alias: Optional[str] - A descriptive name for you to know who this user id refers to.
  • teams: Optional[list] - specify a list of team id's a user belongs to.
  • user_email: Optional[str] - Specify a user email.
  • send_invite_email: Optional[bool] - Specify if an invite email should be sent.
  • user_role: Optional[str] - Specify a user role - "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer", "team", "customer". Info about each role here: https://github.com/BerriAI/litellm/litellm/proxy/_types.py#L20
  • max_budget: Optional[float] - Specify max budget for a given user.
  • budget_duration: Optional[str] - Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo").
  • models: Optional[list] - Model_name's a user is allowed to call. (if empty, key is allowed to call all models). Set to ['no-default-models'] to block all model access. Restricting user to only team-based model access.
  • tpm_limit: Optional[int] - Specify tpm limit for a given user (Tokens per minute)
  • rpm_limit: Optional[int] - Specify rpm limit for a given user (Requests per minute)
  • auto_create_key: bool - Default=True. Flag used for returning a key as part of the /user/new response
  • aliases: Optional[dict] - Model aliases for the user - Docs
  • config: Optional[dict] - [DEPRECATED PARAM] User-specific config.
  • allowed_cache_controls: Optional[list] - List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - https://docs.litellm.ai/docs/proxy/caching#turn-on--off-caching-per-request-
  • blocked: Optional[bool] - [Not Implemented Yet] Whether the user is blocked.
  • guardrails: Optional[List[str]] - [Not Implemented Yet] List of active guardrails for the user
  • policies: Optional[List[str]] - List of policy names to apply to the user. Policies define guardrails, conditions, and inheritance rules.
  • permissions: Optional[dict] - [Not Implemented Yet] User-specific permissions, eg. turning off pii masking.
  • metadata: Optional[dict] - Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "ishaan@berri.ai" }
  • max_parallel_requests: Optional[int] - Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x.
  • soft_budget: Optional[float] - Get alerts when user crosses given budget, doesn't block requests.
  • model_max_budget: Optional[dict] - Model-specific max budget for user. Docs
  • model_rpm_limit: Optional[float] - Model-specific rpm limit for user. Docs
  • model_tpm_limit: Optional[float] - Model-specific tpm limit for user. Docs
  • spend: Optional[float] - Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo").
  • agent_id: Optional[str] - The agent id associated with the user.
  • team_id: Optional[str] - [DEPRECATED PARAM] The team id of the user. Default is None.
  • duration: Optional[str] - Duration for the key auto-created on /user/new. Default is None.
  • key_alias: Optional[str] - Alias for the key auto-created on /user/new. Default is None.
  • sso_user_id: Optional[str] - The id of the user in the SSO provider.
  • object_permission: Optional[LiteLLM_ObjectPermissionBase] - internal user-specific object permission. Example - {"vector_stores": ["vector_store_1", "vector_store_2"]}. IF null or {} then no object permission.
  • prompts: Optional[List[str]] - List of allowed prompts for the user. If specified, the user will only be able to use these specific prompts.
  • organizations: List[str] - List of organization id's the user is a member of Returns:
  • key: (str) The generated api key for the user
  • expires: (datetime) Datetime object for when key expires.
  • user_id: (str) Unique user id - used for tracking spend across multiple keys for same user id.
  • max_budget: (float|None) Max budget for given user.

Usage Example

 curl -X POST "http://localhost:4000/user/new"      -H "Content-Type: application/json"      -H "Authorization: Bearer sk-1234"      -d '{
     "username": "new_user",
     "email": "new_user@example.com"
 }'
post/user/new

Request body

key_aliasstring nullable
durationstring nullable
spendnumber nullable
max_budgetnumber nullable
user_idstring nullable
team_idstring nullable
agent_idstring nullable
max_parallel_requestsinteger nullable
metadataobject nullable
tpm_limitinteger nullable
rpm_limitinteger nullable
budget_durationstring nullable
configobject nullable
permissionsobject nullable
model_max_budgetobject nullable
model_rpm_limitobject nullable
model_tpm_limitobject nullable
guardrailsstring[] nullable
policiesstring[] nullable
promptsstring[] nullable
blockedboolean nullable
aliasesobject nullable
user_emailstring nullable
user_aliasstring nullable
user_role'proxy_admin' | 'proxy_admin_viewer' | 'internal_user' | 'internal_user_viewer' nullable
auto_create_keyboolean
send_invite_emailboolean nullable
sso_user_idstring nullable
organizationsstring[] nullable

Response

Successful Response

key_aliasstring nullable
durationstring nullable
spendnumber nullable
max_budgetnumber nullable
user_idstring nullable
team_idstring nullable
agent_idstring nullable
max_parallel_requestsinteger nullable
metadataobject nullable
tpm_limitinteger nullable
rpm_limitinteger nullable
budget_durationstring nullable
configobject nullable
permissionsobject nullable
model_max_budgetobject nullable
model_rpm_limitobject nullable
model_tpm_limitobject nullable
guardrailsstring[] nullable
policiesstring[] nullable
promptsstring[] nullable
blockedboolean nullable
aliasesobject nullable
keystring required
budget_idstring nullable
tagsstring[] nullable
enforced_paramsstring[] nullable
rpm_limit_type'guaranteed_throughput' | 'best_effort_throughput' | 'dynamic' nullable
tpm_limit_type'guaranteed_throughput' | 'best_effort_throughput' | 'dynamic' nullable
access_group_idsstring[] nullable
key_namestring nullable
expiresstring date-time nullable
token_idstring nullable
organization_idstring nullable
project_idstring nullable
{"stackTrail":"components:schemas:NewUserResponse:properties:litellm_budget_table:anyOf","oasType":"schema","type":"unknown","title":"Litellm Budget Table","nullable":true}
tokenstring nullable
created_bystring nullable
updated_bystring nullable
created_atstring date-time nullable
updated_atstring date-time nullable
user_emailstring nullable
user_role'proxy_admin' | 'proxy_admin_viewer' | 'internal_user' | 'internal_user_viewer' nullable
user_aliasstring nullable