> ## 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.

# Team Management

> API endpoints for managing teams in the LiteLLM proxy

## 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

<ParamField body="team_id" type="string" required>
  Unique identifier for the team.
</ParamField>

<ParamField body="team_alias" type="string">
  Human-readable name for the team.
</ParamField>

<ParamField body="models" type="array">
  Models this team can access.

  ```json theme={null}
  {"models": ["gpt-4", "gpt-3.5-turbo", "claude-2"]}
  ```
</ParamField>

<ParamField body="max_budget" type="number">
  Maximum spending limit for the team in USD.
</ParamField>

<ParamField body="tpm_limit" type="integer">
  Team-wide tokens per minute limit.
</ParamField>

<ParamField body="rpm_limit" type="integer">
  Team-wide requests per minute limit.
</ParamField>

<ParamField body="budget_duration" type="string">
  Budget reset period.

  Examples: `"1d"` (daily), `"30d"` (monthly), `null` (never resets)
</ParamField>

<ParamField body="metadata" type="object">
  Custom metadata for the team.
</ParamField>

<ParamField body="blocked" type="boolean" default="false">
  Whether the team is blocked.
</ParamField>

#### Response

<ResponseField name="team_id" type="string">
  The created team ID.
</ResponseField>

<ResponseField name="team_alias" type="string">
  Team name.
</ResponseField>

<ResponseField name="models" type="array">
  Accessible models.
</ResponseField>

<ResponseField name="max_budget" type="number">
  Budget limit.
</ResponseField>

<ResponseField name="spend" type="number">
  Current spend (starts at 0).
</ResponseField>

#### Example

```bash theme={null}
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"
    }
  }'
```

```python theme={null}
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:

<ResponseField name="teams" type="array">
  Array of team objects.

  <Expandable title="team object">
    <ResponseField name="team_id" type="string">
      Team identifier.
    </ResponseField>

    <ResponseField name="team_alias" type="string">
      Team name.
    </ResponseField>

    <ResponseField name="models" type="array">
      Accessible models.
    </ResponseField>

    <ResponseField name="spend" type="number">
      Current spend.
    </ResponseField>

    <ResponseField name="max_budget" type="number">
      Budget limit.
    </ResponseField>

    <ResponseField name="tpm_limit" type="integer">
      TPM limit.
    </ResponseField>

    <ResponseField name="rpm_limit" type="integer">
      RPM limit.
    </ResponseField>

    <ResponseField name="budget_duration" type="string">
      Budget reset period.
    </ResponseField>

    <ResponseField name="blocked" type="boolean">
      Whether team is blocked.
    </ResponseField>
  </Expandable>
</ResponseField>

#### Example

```bash theme={null}
curl -X GET 'http://localhost:4000/team/list' \
  -H "Authorization: Bearer sk-admin-xxx"
```

```python theme={null}
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

<ParamField query="team_id" type="string" required>
  The team ID to query.
</ParamField>

#### Response

<ResponseField name="team_id" type="string">
  Team identifier.
</ResponseField>

<ResponseField name="team_alias" type="string">
  Team name.
</ResponseField>

<ResponseField name="models" type="array">
  Accessible models.
</ResponseField>

<ResponseField name="spend" type="number">
  Current spend.
</ResponseField>

<ResponseField name="max_budget" type="number">
  Budget limit.
</ResponseField>

<ResponseField name="metadata" type="object">
  Custom metadata.
</ResponseField>

<ResponseField name="members" type="array">
  Team members (keys and users).
</ResponseField>

#### Example

```bash theme={null}
curl -X GET 'http://localhost:4000/team/info?team_id=engineering-team' \
  -H "Authorization: Bearer sk-admin-xxx"
```

```python theme={null}
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

<ParamField body="team_id" type="string" required>
  The team ID to update.
</ParamField>

<ParamField body="team_alias" type="string">
  Update team name.
</ParamField>

<ParamField body="models" type="array">
  Update accessible models.
</ParamField>

<ParamField body="max_budget" type="number">
  Update budget limit.
</ParamField>

<ParamField body="tpm_limit" type="integer">
  Update TPM limit.
</ParamField>

<ParamField body="rpm_limit" type="integer">
  Update RPM limit.
</ParamField>

<ParamField body="metadata" type="object">
  Update metadata.
</ParamField>

<ParamField body="blocked" type="boolean">
  Block or unblock the team.
</ParamField>

#### Example

```bash theme={null}
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"]
  }'
```

```python theme={null}
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

<ParamField body="team_ids" type="array" required>
  Array of team IDs to delete.

  ```json theme={null}
  {"team_ids": ["team-1", "team-2"]}
  ```
</ParamField>

#### Example

```bash theme={null}
curl -X POST http://localhost:4000/team/delete \
  -H "Authorization: Bearer sk-admin-xxx" \
  -H "Content-Type: application/json" \
  -d '{"team_ids": ["engineering-team"]}'
```

```python theme={null}
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.

```bash theme={null}
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.

```bash theme={null}
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:

```bash theme={null}
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:

```python theme={null}
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

```python theme={null}
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

1. **Shared budget**: All keys in a team share the same budget
2. **Budget tracking**: Spending is tracked at the team level
3. **Budget enforcement**: Requests are rejected when team budget is exceeded
4. **Budget reset**: Budgets can reset daily, monthly, or never

### How Team Rate Limits Work

1. **Shared limits**: TPM/RPM limits are shared across all team members
2. **Real-time tracking**: Limits are enforced in real-time
3. **429 responses**: Rate limit exceeded returns 429 error

### Example: Team with Budget and Limits

```python theme={null}
# 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
```

## Related

* [Key Management](/api/proxy/keys)
* [User Management](/api/proxy/users)
* [Usage Tracking](https://docs.litellm.ai/docs/proxy/users)
