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);0is unlimited. - Monthly token budget (
monthly_token_budget) — a cap on total tokens consumed in the calendar month, in UTC;0is unlimited. - Cache setting (
cache_enabled) — opt in or out of response caching. - Firewall mode (
firewall_mode) — override the gateway default:off,auditorenforce. See Prompt injection. - Default routing config (
default_config_id) — which routing config applies to the team’s requests when the request names none.
Self-hosted: teams in gateway.yaml
Self-hosted: teams in gateway.yaml
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 noworkspace_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.
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
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, withX-ManyLayers-Limit: api_key and no Retry-After:
Usage tracking
Fields and defaults are listed in Budgets.