latestOpenAPI 3.1.02026-08-236994571.1 MB

79928a3d37d3

Customer Management

New End User

Allow creating a new Customer

Parameters:

  • user_id: str - The unique identifier for the user.

  • alias: Optional[str] - A human-friendly alias for the user.

  • blocked: bool - Flag to allow or disallow requests for this end-user. Default is False.

  • max_budget: Optional[float] - The maximum budget allocated to the user. Either 'max_budget' or 'budget_id' should be provided, not both.

  • budget_id: Optional[str] - The identifier for an existing budget allocated to the user. Either 'max_budget' or 'budget_id' should be provided, not both.

  • allowed_model_region: Optional[Union[Literal["eu"], Literal["us"]]] - Require all user requests to use models in this specific region.

  • default_model: Optional[str] - If no equivalent model in the allowed region, default all requests to this model.

  • metadata: Optional[dict] = Metadata for customer, store information for customer. Example metadata = {"data_training_opt_out": True}

  • 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").

  • tpm_limit: Optional[int] - [Not Implemented Yet] Specify tpm limit for a given customer (Tokens per minute)

  • rpm_limit: Optional[int] - [Not Implemented Yet] Specify rpm limit for a given customer (Requests per minute)

  • model_max_budget: Optional[dict] - [Not Implemented Yet] Specify max budget for a given model. Example: {"openai/gpt-4o-mini": {"max_budget": 100.0, "budget_duration": "1d"}}

  • max_parallel_requests: Optional[int] - [Not Implemented Yet] Specify max parallel requests for a given customer.

  • soft_budget: Optional[float] - [Not Implemented Yet] Get alerts when customer crosses given budget, doesn't block requests.

  • spend: Optional[float] - Specify initial spend for a given customer.

  • budget_reset_at: Optional[str] - Specify the date and time when the budget should be reset.

  • object_permission: Optional[LiteLLM_ObjectPermissionBase] - Customer-specific object permissions to control access to resources. Supported fields:

    • mcp_servers: List[str] - List of allowed MCP server IDs
    • mcp_access_groups: List[str] - List of MCP access group names
    • mcp_tool_permissions: Dict[str, List[str]] - Map of server ID to allowed tool names (e.g., {"server_1": ["tool_a", "tool_b"]})
    • vector_stores: List[str] - List of allowed vector store IDs
    • agents: List[str] - List of allowed agent IDs
    • agent_access_groups: List[str] - List of agent access group names Example: {"mcp_servers": ["server_1", "server_2"], "vector_stores": ["vector_store_1"], "agents": ["agent_1"]} IF null or {} then no object-level restrictions apply.
  • Allow specifying allowed regions

  • Allow specifying default model

Example curl:

curl --location 'http://0.0.0.0:4000/customer/new'         --header 'Authorization: Bearer sk-1234'         --header 'Content-Type: application/json'         --data '{
        "user_id" : "ishaan-jaff-3",
        "allowed_region": "eu",
        "budget_id": "free_tier",
        "default_model": "azure/gpt-3.5-turbo-eu"
    }'

# With object permissions
curl -L -X POST 'http://localhost:4000/customer/new'         -H 'Authorization: Bearer sk-1234'         -H 'Content-Type: application/json'         -d '{
        "user_id": "user_1",
        "object_permission": {
          "mcp_servers": ["server_1"],
          "mcp_access_groups": ["public_group"],
          "vector_stores": ["vector_store_1"]
        }
      }'

    # return end-user object

NOTE: This used to be called /end_user/new, we will still be maintaining compatibility for /end_user/XXX for these endpoints

post/customer/new

Request body

budget_idstring nullable
max_budgetnumber nullable

Requests will fail if this budget (in USD) is exceeded.

soft_budgetnumber nullable

Requests will NOT fail if this is exceeded. Will fire alerting though.

max_parallel_requestsinteger nullable

Max concurrent requests allowed for this budget id.

tpm_limitinteger nullable

Max tokens per minute, allowed for this budget id.

rpm_limitinteger nullable

Max requests per minute, allowed for this budget id.

budget_durationstring nullable

Max duration budget should be set for (e.g. '1hr', '1d', '28d')

model_max_budgetobject nullable

Max budget for each model (e.g. {'gpt-4o': {'max_budget': '0.0000001', 'budget_duration': '1d', 'tpm_limit': 1000, 'rpm_limit': 1000}})

budget_reset_atstring date-time nullable

Datetime when the budget is reset

user_idstring required
aliasstring nullable
blockedboolean
spendnumber nullable
allowed_model_region'eu' | 'us' nullable
default_modelstring nullable

Response

Successful Response

{"stackTrail":"paths:/customer/new:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}