Customer Management API reference
Use these APIs from your backend to import customers, set budgets, and return usage to your product. Start with Customer Management, then follow Set budgets and read usage for a complete integration.
The management base path is /management/v1. Customer organizations, teams, and members are separate from LiteLLM's internal organizations, teams, users, and /customer end-user records.
Availability
Use PostgreSQL with the gateway's database migrations applied. Without Enterprise, you can create up to 5 organizations, 5 teams per organization, and 5 members per team. See capacity limits.
Authentication and conventions
Send Authorization: Bearer $LITELLM_ADMIN_KEY on management requests. These routes require proxy_admin, including list, retrieve, and usage requests. Keep this key on your server and authorize the customer before returning data to your application.
Examples use LITELLM_BASE_URL for your gateway's base URL, without /v1 or /ui. They use curl from your terminal.
export LITELLM_BASE_URL="http://localhost:4000"
export END_DATE="$(date -u +%Y-%m-%d)"
export START_DATE="$END_DATE"
Usage examples query today in UTC. Set START_DATE to an earlier YYYY-MM-DD value for a longer range.
Set LITELLM_ADMIN_KEY through your secret store or existing terminal environment. Send JSON bodies with Content-Type: application/json.
Create parents before children. IDs identify records across the gateway, so use a customer prefix such as acme-support. Omit a resource ID to let LiteLLM generate one. URL-encode IDs in paths. Use IDs without commas when you query usage through comma-separated filters.
Creation returns 201. Retrieval and updates return 200 with a resource object at the top level. Deletion returns 204 with no body. Resource lists return data, meta, and links; usage reads return results and metadata.
Retry a customer import
Use POST /management/v1/customer_organizations/upsert to create or update an organization by customer_org_id, or by alias when you omit the ID. Use POST /management/v1/customer_members/upsert for a member identified by customer_member_id and customer_org_id or customer_org_alias. If you send both organization fields, they must match. Both endpoints return 200 with created: true for a new record or created: false for an existing record. Repeating an identical request leaves the record unchanged; omitted fields retain their values.
An organization upsert accepts the organization create fields. A member upsert accepts alias, budget_id, budget_override, and budget_override_expires_at, plus optional parent_team_id. A new member without a team joins the organization's default team. An existing member keeps its teams; a supplied parent_team_id becomes its first team. Use the member PATCH endpoint with parent_team_ids to replace the complete team list. Conflicting or ambiguous organization aliases and cross-organization moves return 409.
The create endpoints return 409 for a repeated POST with an existing ID; they do not update the record. After a timeout or 409, retrieve that ID, compare its parent and settings with your application, then use PATCH for the required changes. Omit unchanged fields in a patch. An explicit null clears a nullable field where the resource permits it.
Budget object
Organizations and teams accept budget. Members inherit a template through budget_id and accept budget_override for their own settings.
| Field | Type and default | Meaning |
|---|---|---|
max_budget | Number or null; default null | Spend cap in USD. Must be finite and at least 0. |
soft_budget | Number or null; default null | Soft threshold in USD, finite and at least 0. This value does not block requests. Notifications require the customer budget callback. |
rpm_limit | Integer or null; default null | Requests per minute. Must be at least 0. |
tpm_limit | Integer or null; default null | Tokens per minute. Must be at least 0. |
allowed_models | Array of strings or null; default null | Allowed gateway model names. A non-empty member override replaces the inherited list. An empty override list inherits the template's list. |
budget_duration | String or null; default null | Reset interval, for example "1h", "24h", "7d", or "30d". Must resolve to a positive duration. |
model_rpm_limit | Object or null; default null | Model name to non-negative requests-per-minute limit. |
model_tpm_limit | Object or null; default null | Model name to non-negative tokens-per-minute limit. |
budget_limits | Array or null; default null | Extra spend caps, each with budget_duration set to "1mo" (monthly) or "12mo" (annual) and a max_budget, at most one entry per duration. Other values, including "1y", return 422. Each window resets on its own and blocks requests when reached. A patch replaces the whole array. |
cap_policy | "pause_until_reset", "pause_allow_increase", or null; default null | What a member can do at its cap. null and "pause_until_reset" wait for the reset. "pause_allow_increase" lets the member request a temporary increase. |
With customer identity headers, LiteLLM checks the organization, team, and member budgets before inference. A request must pass every applicable limit, and each limit has its own spend counter: a team budget counts the whole team's spend, while members assigned to one template each count their own. A scope at or above max_budget or a budget_limits window causes a budget error; the organization takes precedence over the team and member. See Shared team budget or per-member allowance for worked examples. LiteLLM also checks each scope's model access and rate limits. Requests without these headers do not enter this hierarchy enforcement path.
Allow for requests already in flight and background accounting when you display balances.
The reset job updates budget_reset_at and the resource's running spend counter for a configured duration. Read the returned timestamp; use the usage APIs for historical dates. Budget resets do not erase historical daily usage.
Common response fields
Each organization, team, and member includes these fields in addition to its resource-specific fields.
| Field | Type | Meaning |
|---|---|---|
alias | String or null | Display name. |
spend | Number; initial value 0 | Recorded budget spend in USD. Accounting updates this value in the background. |
budget_reset_at | Datetime or null | Next recorded reset time. |
created_at, updated_at | Datetime | Creation and last-update timestamps. |
created_by, updated_by | String | Actor recorded for each write. |
Customer Management limits
GET /management/v1/customer_portal/limits requires a proxy admin key and returns 200 with current Customer Management capacity. It accepts no query parameters or request body.
curl "$LITELLM_BASE_URL/management/v1/customer_portal/limits" \
-H "Authorization: Bearer $LITELLM_ADMIN_KEY"
| Response field | Type | Meaning |
|---|---|---|
limits_apply | Boolean | true without a LiteLLM Enterprise license. |
organization_limit | Integer | Free-tier organization limit, 5. |
teams_per_organization_limit | Integer | Free-tier teams per organization, 5. Includes the auto-created default team. |
members_per_team_limit | Integer | Free-tier members per team, 5. A member counts toward every team in its parent_team_ids. |
organization_count | Integer | Total registered customer organizations. |
any_limit_reached | Boolean | true when limits apply and the organization count is at least 5, any organization has at least 5 teams, or any team has at least 5 members. Always false with Enterprise. |
{
"limits_apply": true,
"organization_limit": 5,
"teams_per_organization_limit": 5,
"members_per_team_limit": 5,
"organization_count": 5,
"any_limit_reached": true
}
Enterprise removes the limits. The numeric fields still report the free-tier thresholds when limits_apply is false. See free-tier behavior for request tracking at capacity and after a license lapses.