# Authentication

> Every request carries an API key as a bearer token.

## API keys

Create keys on the [API keys](https://www.openrobotics.dev/keys) page. Keys start with `sk-orb-v1-`, and the full key is shown only once, when you create it. Keys belong to the organization selected when you create them, or to your personal account when none is.

## Sending the key

Put the key in the `Authorization` header of every request. Requests with a body also need `Content-Type: application/json`.

Header:

```
Authorization: Bearer sk-orb-v1-…
```

cURL:

```bash
curl https://api.openrobotics.dev/v1/key \
  -H "Authorization: Bearer $OPENROBOTICS_API_KEY"
```

Only [`GET /models`](https://www.openrobotics.dev/docs/api/list-models), [`GET /models/{id}`](https://www.openrobotics.dev/docs/api/get-model) and [`POST /sandbox/keys`](https://www.openrobotics.dev/docs/api/create-sandbox-key) work without a key.

## Test keys

Tick **Test key** when you create a key on the [API keys](https://www.openrobotics.dev/keys) page to get a sandbox key. Test keys start with `sk-orb-test-` and work on every endpoint, but:

- every call returns simulated output of the real shape, with `"sandbox": true` in the response;
- calls are free and never touch a GPU, so there are no cold starts;
- requests are validated like live ones, so a request that works with a test key works with a live key.

Use them in CI, in tests, and for coding agents that are still building against the API. Switch to a live key (`sk-orb-v1-`) for real model output.

**No account?** [`POST /sandbox/keys`](https://www.openrobotics.dev/docs/api/create-sandbox-key) returns a sandbox key straight away, with no sign-up and no key, so an agent or script can try the API end to end. These anonymous keys expire after 24 hours, make at most 20 calls a minute (test keys from the API keys page make 60), and one IP address can create 5 an hour. An expired one gets `401`; create another.

Shell:

```bash
export OPENROBOTICS_API_KEY=sk-orb-test-…
```

No account:

```
export OPENROBOTICS_API_KEY=$(curl -s -X POST https://api.openrobotics.dev/v1/sandbox/keys | jq -r .key)
```

CLI:

```bash
openrobotics login --sandbox   # saves an anonymous sandbox key, no browser
```

## Keeping keys safe

- Call the API from servers and robots you control. Never ship a key in a browser or mobile app.
- Use one key per robot, app or environment, so you can see each one's spend in [Activity](https://www.openrobotics.dev/activity) and revoke one without touching the others.
- Disable a key on the [API keys](https://www.openrobotics.dev/keys) page to pause it (calls get `403`), and enable it again later.
- If a key leaks, delete it and create a new one. A deleted key gets `401` right away.

## Credit limits

When you create a key, you can give it a credit limit in US dollars to cap what it can spend. A call that would take the key over its limit returns `402` and isn't run. [`GET /key`](https://www.openrobotics.dev/docs/api/get-key) shows a key's spend (`usage`) and what it has left (`limit_remaining`).
