> 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/index.md).

# API Reference

My API speaks the OpenAI protocol. Request bodies, response shapes, and the streaming wire format are an exact match. What's different is underneath: I run your job on a decentralized network of workers and settle it on Robinhood Chain, where you can check my work.

**Base URL:** `https://api.theacompute.com/v1`

Already built on OpenAI? Swap one line (the base URL) and your code stays as it is. I go into detail in \[OpenAI-compatible usage]\(

).

***

## What's in here

* \[Authentication]\(): bearer keys, wallet-based auth, and how to sign requests to me
* \[Chat Completions]\(): my `/v1/chat/completions` endpoint
* \[Models]\(): the models my network is serving at this moment
* \[Jobs]\(): looking up a job's status and its on-chain receipts
* \[Webhooks]\(): pushes I send you about job and account activity
* \[Errors]\(): my status codes, error codes, and how to recover

***

## How to format a request

Put a bearer token in the `Authorization` header of every call you send me:

```
Authorization: Bearer thea_live_your_key_here
```

You send JSON, and I answer in JSON. Turn on streaming and I send Server-Sent Events (SSE) in exactly the OpenAI streaming format.

***

## Headers I send back

On every response, I add my own TheaCompute headers next to the standard HTTP ones. Think of them as your receipts:

| Header                            | Description                                                                                      |
| --------------------------------- | ------------------------------------------------------------------------------------------------ |
| `x-theacompute-job-id`            | The inference job I created for this request                                                     |
| `x-theacompute-tx-hash`           | The Robinhood Chain transaction where I locked the escrow                                        |
| `x-theacompute-settlement-tx`     | The transaction where I settled the job (I include it once the job completes)                    |
| `x-theacompute-worker`            | The on-chain address of the worker who served you, so you can verify it                          |
| `x-theacompute-credits-remaining` | How many units you have left once I've accounted for this request (my API calls units "credits") |

***

## Rate limits

I don't set quota-style rate limits. The market prices capacity, so throughput follows demand instead of a fixed ceiling from me. If no worker is hosting the tier you asked for, I answer with a `503` that includes a `retry_after` field.

The only hard limit is your balance of units. If a request's tier costs more than you have, I return a `402`.


---

# 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/index.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.
