Getting started

API keys and authentication

One key works for the Model API and the Swarm API. Send it with every request.

Create a key

  • Open Models → API keys in the dashboard and choose a name, such as the app or agent that will use it.
  • The full key is shown once. Only a hash is stored, so a lost key can't be recovered: create a new one.
  • A workspace can have up to 50 active keys. Each key's last use is shown next to it.
  • Keys start with sk-.

Send the key

Use a bearer token. Clients written for the Anthropic API can send x-api-key instead; it is accepted on the Model API endpoints.

curl https://swarmcomputers.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

A missing or unknown key gets 401. The Swarm API endpoints accept the bearer form only.

Keep keys safe

  • Call the API from a server or an agent, never from a web page: anyone can read a key shipped to a browser.
  • Keep keys in an environment variable or a secret store, not in code.
  • Use one key per app or agent, so you can revoke one without breaking the others.
  • Revoke a key on the same page. It stops working at once.

Spending limits on a key

Keys spend your workspace's prepaid credits. As a safety net, one key can commit at most $500 of swarm budgets in 24 hours. See Errors and limits for the rest.

Older security-testing keys

Keys that start with pk_, from the dashboard's API & agents page, are for the older security tests API (/v1/tests, /v1/schedules). They don't work for models or swarms. See Security swarms.