Documentation Index
Fetch the complete documentation index at: https://mintlify.com/BerriAI/litellm/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Team management endpoints allow you to create and manage teams with shared budgets, model access, and rate limits.
Create Team
POST /team/new
Create a new team.
Request Body
Unique identifier for the team.
Human-readable name for the team.
Models this team can access.{"models": ["gpt-4", "gpt-3.5-turbo", "claude-2"]}
Maximum spending limit for the team in USD.
Team-wide tokens per minute limit.
Team-wide requests per minute limit.
Budget reset period.Examples: "1d" (daily), "30d" (monthly), null (never resets)
Custom metadata for the team.
Whether the team is blocked.
Response
Current spend (starts at 0).
Example
curl -X POST http://localhost:4000/team/new \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{
"team_id": "engineering-team",
"team_alias": "Engineering Team",
"models": ["gpt-4", "gpt-3.5-turbo"],
"max_budget": 1000.0,
"tpm_limit": 1000000,
"rpm_limit": 10000,
"budget_duration": "30d",
"metadata": {
"department": "Engineering",
"cost_center": "CC-123"
}
}'
import requests
response = requests.post(
"http://localhost:4000/team/new",
headers={"Authorization": "Bearer sk-admin-xxx"},
json={
"team_id": "engineering-team",
"team_alias": "Engineering Team",
"models": ["gpt-4", "gpt-3.5-turbo"],
"max_budget": 1000.0,
"tpm_limit": 1000000,
"rpm_limit": 10000,
"budget_duration": "30d"
}
)
team = response.json()
print(f"Created team: {team['team_id']}")
List Teams
GET /team/list
List all teams.
Response
Returns array of team objects:
Example
curl -X GET 'http://localhost:4000/team/list' \
-H "Authorization: Bearer sk-admin-xxx"
import requests
response = requests.get(
"http://localhost:4000/team/list",
headers={"Authorization": "Bearer sk-admin-xxx"}
)
teams = response.json()["teams"]
for team in teams:
print(f"Team: {team['team_alias']}")
print(f" Spend: ${team['spend']:.2f} / ${team['max_budget']:.2f}")
print(f" Models: {', '.join(team['models'])}")
Get Team Info
GET /team/info
Get detailed information about a specific team.
Query Parameters
Response
Team members (keys and users).
Example
curl -X GET 'http://localhost:4000/team/info?team_id=engineering-team' \
-H "Authorization: Bearer sk-admin-xxx"
import requests
response = requests.get(
"http://localhost:4000/team/info",
headers={"Authorization": "Bearer sk-admin-xxx"},
params={"team_id": "engineering-team"}
)
team = response.json()
print(f"Team: {team['team_alias']}")
print(f"Budget: ${team['spend']:.2f} / ${team['max_budget']:.2f}")
print(f"Members: {len(team['members'])}")
Update Team
POST /team/update
Update an existing team.
Request Body
Update accessible models.
Block or unblock the team.
Example
curl -X POST http://localhost:4000/team/update \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{
"team_id": "engineering-team",
"max_budget": 2000.0,
"models": ["gpt-4", "gpt-3.5-turbo", "claude-2"]
}'
import requests
response = requests.post(
"http://localhost:4000/team/update",
headers={"Authorization": "Bearer sk-admin-xxx"},
json={
"team_id": "engineering-team",
"max_budget": 2000.0,
"tpm_limit": 2000000
}
)
Delete Team
POST /team/delete
Delete a team.
Request Body
Array of team IDs to delete.{"team_ids": ["team-1", "team-2"]}
Example
curl -X POST http://localhost:4000/team/delete \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{"team_ids": ["engineering-team"]}'
import requests
response = requests.post(
"http://localhost:4000/team/delete",
headers={"Authorization": "Bearer sk-admin-xxx"},
json={"team_ids": ["engineering-team"]}
)
Block/Unblock Team
POST /team/block
Block a team from making requests.
curl -X POST http://localhost:4000/team/block \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{"team_id": "engineering-team"}'
POST /team/unblock
Unblock a previously blocked team.
curl -X POST http://localhost:4000/team/unblock \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{"team_id": "engineering-team"}'
Team Member Management
Add Member to Team
Create a key associated with a team:
curl -X POST http://localhost:4000/key/generate \
-H "Authorization: Bearer sk-admin-xxx" \
-H "Content-Type: application/json" \
-d '{
"team_id": "engineering-team",
"models": ["gpt-4"],
"duration": "30d"
}'
The key will inherit the team’s model access and contribute to the team’s budget/rate limits.
List Team Members
Get team info to see all members:
import requests
response = requests.get(
"http://localhost:4000/team/info",
headers={"Authorization": "Bearer sk-admin-xxx"},
params={"team_id": "engineering-team"}
)
team = response.json()
for member in team['members']:
print(f"Member: {member['user_id']}, Key: {member['key']}")
Complete Example
import requests
import json
BASE_URL = "http://localhost:4000"
ADMIN_KEY = "sk-admin-xxx"
headers = {
"Authorization": f"Bearer {ADMIN_KEY}",
"Content-Type": "application/json"
}
# 1. Create a team
team_response = requests.post(
f"{BASE_URL}/team/new",
headers=headers,
json={
"team_id": "data-science-team",
"team_alias": "Data Science Team",
"models": ["gpt-4", "claude-2"],
"max_budget": 500.0,
"tpm_limit": 500000,
"budget_duration": "30d",
"metadata": {"department": "Data Science"}
}
)
print(f"Created team: {team_response.json()['team_id']}")
# 2. Create keys for team members
for i in range(3):
key_response = requests.post(
f"{BASE_URL}/key/generate",
headers=headers,
json={
"team_id": "data-science-team",
"user_id": f"ds-user-{i+1}",
"models": ["gpt-4"],
"duration": "30d"
}
)
print(f"Created key for user {i+1}")
# 3. Get team info
info_response = requests.get(
f"{BASE_URL}/team/info",
headers=headers,
params={"team_id": "data-science-team"}
)
team = info_response.json()
print(f"\nTeam Info:")
print(f" Name: {team['team_alias']}")
print(f" Budget: ${team['spend']:.2f} / ${team['max_budget']:.2f}")
print(f" Members: {len(team['members'])}")
# 4. Update team budget
update_response = requests.post(
f"{BASE_URL}/team/update",
headers=headers,
json={
"team_id": "data-science-team",
"max_budget": 1000.0
}
)
print("\nUpdated team budget to $1000")
# 5. List all teams
list_response = requests.get(
f"{BASE_URL}/team/list",
headers=headers
)
teams = list_response.json()["teams"]
print(f"\nTotal teams: {len(teams)}")
for team in teams:
print(f" - {team['team_alias']}: ${team['spend']:.2f} / ${team['max_budget']:.2f}")
Team Budgets and Rate Limits
How Team Budgets Work
- Shared budget: All keys in a team share the same budget
- Budget tracking: Spending is tracked at the team level
- Budget enforcement: Requests are rejected when team budget is exceeded
- Budget reset: Budgets can reset daily, monthly, or never
How Team Rate Limits Work
- Shared limits: TPM/RPM limits are shared across all team members
- Real-time tracking: Limits are enforced in real-time
- 429 responses: Rate limit exceeded returns 429 error
Example: Team with Budget and Limits
# Create team with strict limits
team_response = requests.post(
"http://localhost:4000/team/new",
headers={"Authorization": "Bearer sk-admin-xxx"},
json={
"team_id": "startup-team",
"max_budget": 50.0, # $50 budget
"tpm_limit": 100000, # 100K tokens/min
"rpm_limit": 1000, # 1K requests/min
"budget_duration": "30d" # Resets monthly
}
)
# All team members share these limits