> For the complete documentation index, see [llms.txt](https://docs.robincompute.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.robincompute.org/api-reference/authentication.md).

# Authentication

Every request carries a bearer token in the `Authorization` header. The token is an API key. Each key belongs to one Ethereum wallet and spends that wallet's credit balance.

***

## API keys

Generate keys from the Settings tab of the RobinCompute web app at `robincompute.org/app/settings`.

**Key format:** the prefix `rcompute_live_` followed by 32 alphanumeric characters.

Example: `rcompute_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6`

**Key properties:**

* One key per wallet during beta. Multiple keys per wallet arrive in Phase 2.
* A key spends the credits of the wallet that issued it, the same balance you see in the web app.
* Revoke a key and issue a replacement from Settings whenever you like.
* The full key value appears exactly once, at creation. A lost key stays lost; generate a fresh one.

***

## Making authenticated requests

Send the key as a bearer token on every call:

```bash
curl https://api.robincompute.org/v1/models \
  -H "Authorization: Bearer rcompute_live_your_key_here"
```

```python
import httpx

headers = {"Authorization": "Bearer rcompute_live_your_key_here"}
response = httpx.get("https://api.robincompute.org/v1/models", headers=headers)
```

```typescript
const response = await fetch("https://api.robincompute.org/v1/models", {
    headers: { "Authorization": "Bearer rcompute_live_your_key_here" }
})
```

***

## Security

**Treat the key as a secret.** Keep it out of source control and out of anything shipped to the browser. Load it from the environment.

```bash
export ROBINCOMPUTE_API_KEY="rcompute_live_your_key_here"
```

```python
import os
api_key = os.environ["ROBINCOMPUTE_API_KEY"]
```

**Key scope:** A key can do exactly one thing: spend credits from its own wallet. It cannot withdraw credits, move $RCOMPUTE, or touch your account settings.

**Key revocation:** Suspect a leak? Revoke the key from Settings. Revocation is instant, and every request made afterward is rejected.

***

## Wallet-native authentication (coming in Phase 2)

Phase 2 adds a keyless option: sign each request directly with your Ethereum wallet via EIP-4361 (Sign-In with Ethereum). Nothing gets provisioned ahead of time, which suits automated setups where minting and distributing a long-lived key would be awkward.

***

## Authentication errors

| Status | Code                   | Meaning                                                    |
| ------ | ---------------------- | ---------------------------------------------------------- |
| `401`  | `invalid_api_key`      | The key does not exist or was revoked                      |
| `401`  | `missing_api_key`      | The request arrived without an `Authorization` header      |
| `402`  | `insufficient_credits` | The wallet's balance cannot cover the requested model tier |
| `403`  | `key_suspended`        | The key was suspended after a policy violation             |

The complete error envelope lives in \[Errors]\(

).

***

## Checking your balance via the API

```bash
curl https://api.robincompute.org/v1/account \
  -H "Authorization: Bearer rcompute_live_your_key_here"
```

```json
{
  "wallet": "0x7f3ce8b1a94d20c5e6f18b7a2d40953c1e8ba672",
  "credits_remaining": 1420,
  "usdg_value": 14.20,
  "last_topup_at": "2026-06-15T09:43:00Z",
  "api_key_created_at": "2026-06-01T00:00:00Z"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.robincompute.org/api-reference/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
