Teams group the people and credentials that share limits. API keys are the credentials your applications send as Authorization: Bearer ml-... to https://app.manylayers.io/v1. This page covers teams, admin-created API keys and their per-key limits; for finer-grained rules see Rate limiting, Budgets and Policies. Personal access tokens and virtual account tokens are covered in Credentials. In the console, keys live in Gateway → API Keys.

Teams

Teams are your primary isolation unit. Create a team for each department, project, or application that needs its own access controls and limits. Each team has:
  • Model allow-list (models) — which logical models the team can access, or *. A team with no list is unrestricted.
  • Rate limits — requests per minute (rpm_limit) and tokens per minute (tpm_limit); 0 is unlimited.
  • Monthly token budget (monthly_token_budget) — a cap on total tokens consumed in the calendar month, in UTC; 0 is unlimited.
  • Cache setting (cache_enabled) — opt in or out of response caching.
  • Firewall mode (firewall_mode) — override the gateway default: off, audit or enforce. See Prompt injection.
  • Default routing config (default_config_id) — which routing config applies to the team’s requests when the request names none.

Team management API

Both are organization-level operations: they need the organization Owner (or the deployment operator credential). A workspace administrator manages the workspace’s own teams from Gateway → Access → Teams, and POST returns 409 team_in_workspace for a name that belongs to a workspace team.

API keys

Each API key is filed under exactly one organization team and can be bound to one workspace. A workspace-bound key resolves models from that workspace’s providers only; a key with no workspace_id is team-scoped. Limits stack: the key’s limits apply on top of the team’s and any policies, and the most restrictive one binds. Keys seeded from a self-hosted gateway.yaml take only a name, the key value and a role; the key is stored as a SHA-256 hash.
Per-key limits, budgets and expiry are set when you create or update a key through the admin API:
The response includes the new key as key (prefix ml-). It is shown once; only a hash is stored. name is required, plus one of team (a team name), team_id (a team id; wins over team) or a user_id owner, whose own team is used; role is member (default), editor or admin.

Per-key controls

PATCH /admin/keys/{id} replaces all limits at once. Any limit you leave out of the body is reset to 0 (unlimited), an omitted budget_reset_period returns to monthly, and expires_at is cleared, so always send the full set. name and workspace_id are only changed when you send them.

Key management API

Pass ?workspace_id= when your credential can reach more than one workspace. Issuing and changing keys needs gateway.apikeys.manage; a member may issue a member-role key that they own themselves.

Budget exhaustion response

When a per-key USD budget is exhausted, the gateway returns HTTP 402 Payment Required, with X-ManyLayers-Limit: api_key and no Retry-After:

Usage tracking

Fields and defaults are listed in Budgets.

Monitoring