This guide walks you through creating a team and issuing your first API key so your applications can start using the gateway.
1

Ensure the gateway is running

Make sure ManyLayers is running with your admin key configured:
export MANYLAYERS_ADMIN_KEY=ml-local-admin-key
docker compose up -d
2

Create a team (option A: YAML config)

Add a team to your gateway.yaml — useful for teams you want defined in version control:
teams:
  - name: data-science
    monthly_token_budget: 5000000
    rpm_limit: 120
    tpm_limit: 200000
    models: ["gpt-4o", "gpt-4o-mini"]
    api_keys:
      - name: ds-key
        key: ${DS_API_KEY}
        role: member
        budget_usd_monthly: 100.00
Send SIGHUP to reload without restarting:
docker compose kill -s HUP gateway
3

Create a team (option B: API)

Create teams dynamically via the Admin API:
curl -X POST http://localhost:8180/admin/teams \
  -H "Authorization: Bearer ml-local-admin-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "data-science",
    "monthly_token_budget": 5000000,
    "rpm_limit": 120,
    "tpm_limit": 200000,
    "models": ["gpt-4o", "gpt-4o-mini"]
  }'
4

Create an API key

curl -X POST http://localhost:8180/admin/keys \
  -H "Authorization: Bearer ml-local-admin-key" \
  -H "Content-Type: application/json" \
  -d '{
    "team": "data-science",
    "name": "ds-key",
    "role": "member",
    "budget_usd_monthly": 100.00,
    "rpm_limit": 60,
    "expires_at": "2027-01-01T00:00:00Z"
  }'
The response includes the generated API key. Store it securely — it cannot be retrieved again.
5

Test the key

curl http://localhost:8180/v1/chat/completions \
  -H "Authorization: Bearer <your-new-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
6

Verify limits and identity

Check the key’s team, role, and remaining budget:
curl http://localhost:8180/admin/whoami \
  -H "Authorization: Bearer <your-new-key>"