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

# API reference

Base URL: `https://api.podtorrent.com`. All `/v1/` endpoints need `Authorization: Bearer <API key>`.

| Method | Path                   | Auth | Purpose                                   | Guide                                                                   |
| ------ | ---------------------- | ---- | ----------------------------------------- | ----------------------------------------------------------------------- |
| `POST` | `/v1/chat/completions` | key  | Chat completion, streaming or not         | [Chat completions](/using-the-api/chat-completions.md)                  |
| `GET`  | `/v1/models`           | key  | Models a connected node serves            | [Models and offers](/using-the-api/models-and-offers.md)                |
| `GET`  | `/v1/network/offers`   | key  | Capacity and prices per model and tier    | [Models and offers](/using-the-api/models-and-offers.md#network-offers) |
| `POST` | `/v1/prompts`          | key  | Id of a conversation opening, for caching | [Cached prompts](/using-the-api/cached-prompts.md)                      |
| `GET`  | `/v0/network/keys`     | none | Network's public receipt-signing key      | [Receipts and billing](/concepts/receipts-and-billing.md)               |
| `GET`  | `/healthz`             | none | Returns `ok`                              | —                                                                       |

## PodTorrent request options

For `POST /v1/chat/completions`, in a `podtorrent` body object or as headers:

| Body field                          | Header                                | Default       | Values                                    |
| ----------------------------------- | ------------------------------------- | ------------- | ----------------------------------------- |
| `podtorrent.tier`                   | `X-PodTorrent-Tier`                   | `interactive` | `interactive` or `batch`                  |
| `podtorrent.max_price_per_mtok_out` | `X-PodTorrent-Max-Price-Per-Mtok-Out` | none          | Number ≥ 0, USD per million output tokens |

## Response headers

| Header                   | Values                                             |
| ------------------------ | -------------------------------------------------- |
| `X-PodTorrent-Node`      | Node id                                            |
| `X-PodTorrent-Tier`      | `interactive` or `batch`                           |
| `X-PodTorrent-Cache-Hit` | `true` or `false`                                  |
| `X-PodTorrent-Own-Node`  | `true` or `false`; operators' own client keys only |

## `POST /v1/prompts`

Request: `{ "messages": [ ... ] }`, a non-empty array. Response: `{ "object": "prompt", "sha256": "<hex>", "messages": <count> }`.

## `GET /v0/network/keys`

```json
{ "receipt_keys": [ { "alg": "Ed25519", "key": "<base64 public key>" } ] }
```

Errors are listed in [Errors and limits](/using-the-api/errors-and-limits.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.podtorrent.com/reference/api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
