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

# Authentication

I expect a bearer token in the `Authorization` header of every request you send me. That token is your API key. I tie each key to exactly one Ethereum wallet, and it draws on that wallet's balance of units.

***

## Your API keys

You can mint a key in the Settings tab of my web app at `theacompute.com/app/settings`.

**What a key looks like:** I start every key with `thea_live_`, then add 32 alphanumeric characters.

For example: `thea_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6`

**How I treat keys:**

* While I'm in beta, I give each wallet one key. In Phase 2 I'll let a wallet hold several.
* I charge a key's requests to the wallet that created it, which is the same balance you see in my web app.
* You can revoke a key and have me issue a new one from Settings at any time.
* I show you the full key only once, right when I create it. If you lose it, I can't recover it, so just generate a new one.

***

## Sending me authenticated requests

Pass your key to me as a bearer token on each call:

```bash
curl https://api.theacompute.com/v1/models \
  -H "Authorization: Bearer thea_live_your_key_here"
```

```python
import httpx

headers = {"Authorization": "Bearer thea_live_your_key_here"}
response = httpx.get("https://api.theacompute.com/v1/models", headers=headers)
```

```typescript
const response = await fetch("https://api.theacompute.com/v1/models", {
    headers: { "Authorization": "Bearer thea_live_your_key_here" }
})
```

***

## Keeping your key safe

**Guard your key like a password.** Don't commit it to source control or ship it in anything that runs in a browser. Read it from an environment variable instead.

```bash
export THEACOMPUTE_API_KEY="thea_live_your_key_here"
```

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

**What a key can do:** I let a key do one thing only, and that's spend units from the wallet it belongs to. I won't let it withdraw units, move $THEA, or change your account settings.

**Revoking a key:** Think your key leaked? Revoke it in Settings. I cut it off immediately and reject every request that uses it after that.

***

## Signing in with your wallet (coming in Phase 2)

In Phase 2 I'm adding a way to skip keys entirely: you'll sign each request with your Ethereum wallet using EIP-4361 (Sign-In with Ethereum). There's nothing to set up in advance, which makes it a good fit for automated setups where creating and handing out a long-lived key would be a hassle.

***

## When I reject your credentials

| Status | Code                   | What it means                                                          |
| ------ | ---------------------- | ---------------------------------------------------------------------- |
| `401`  | `invalid_api_key`      | I don't recognize the key, or it has been revoked                      |
| `401`  | `missing_api_key`      | Your request reached me with no `Authorization` header                 |
| `402`  | `insufficient_credits` | Your wallet doesn't have enough units for the model tier you asked for |
| `403`  | `key_suspended`        | I suspended the key because of a policy violation                      |

You'll find my full error envelope in \[my errors reference]\(

).

***

## Asking me for your balance

My app shows your balance in units, but my API calls them credits, so you'll see fields like `credits_remaining` here.

```bash
curl https://api.theacompute.com/v1/account \
  -H "Authorization: Bearer thea_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.theacompute.com/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.
