# API reference

> Inferit API reference: every endpoint, authentication with an API key or x402, money in µ, errors, response headers, and the on-chain calls that have no endpoint.

Base URL: `https://api-production-c74b9.up.railway.app` (this site's current API). Inference is OpenAI-compatible; everything else is plain JSON. Agents can read the same in one file: [agents.md](https://inferit.cc/agents.md).

## Authentication

-   **Inference** takes an API key: `Authorization: Bearer ik_…` or `x-api-key: ik_…`. Without either, it takes an x402 payment instead ([below](https://inferit.cc/docs/api-reference.md#x402)).
-   **Account routes** (keys, balance, usage, seller) take the session token from sign-in as `Authorization: Bearer <session>`. Sessions last 24 h. Balance and usage also accept your API key.
-   **Public routes** (models, prices, marketplace, stats, rails) need no auth and are cacheable.

## Money

API amounts are integers in millionths of a dollar, sent as strings: "10000" = $0.01, paid as 0.01 ITC. Fields ending in `Micro` hold such amounts. ITC (Inferit Test Credit) is the token you pay with: one ITC per dollar of price. So `"1500000"` = $1.50 (1.50 ITC). Prices are per 1M tokens: `84000` = $0.084 per 1M tokens. The site shows the same prices in dollars per 1M tokens ([units](https://inferit.cc/docs.md#units)). Prices are **all-in** (the seller's price plus the platform fee) unless a field says otherwise. Percentages are numbers with two decimals; a discount is rounded down so it is never overstated. What one request costs, and the rounding, is in [Core concepts](https://inferit.cc/docs.md#request-cost); the `x-inferit-buyer-cost-micro` header is the authoritative figure.

## Inference

### POST `/v1/chat/completions` Auth: API key

OpenAI Chat Completions. Send `"model": "auto"` and Inferit picks the model ([below](https://inferit.cc/docs/api-reference.md#auto)), or name a model (a catalog or seller-listed id, or an alias) and Inferit picks the seller. Supports `stream: true` (SSE relayed byte for byte). Before routing, your escrow balance (under your ceiling) must cover the worst case: input estimate plus the output limit at the top-ranked offer. The output limit is the smallest of `max_tokens`, `max_completion_tokens` and the model's `context_length` (from `GET /v1/models`), or 1,024 when you send neither, times `n` for several choices. The seller is held to it: a long answer without a limit stops at 1,024 tokens with `finish_reason: "length"`. You are then charged the metered cost. A closed model (`open_weight: false` in `/v1/models`) is a list-price-only row that no seller can list, so a request for it answers `404 model_not_servable`.

_example_

```bash
curl https://api-production-c74b9.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer $INFERIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen-2.5-14b-instruct",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
# x-inferit-model in the response names the model that answered
```

### POST `/min{N}/v1/chat/completions` Auth: API key

Same, but only routes to offers at least N% below list (0–100). Also available as the `x-min-discount` header or a per-key setting; the strictest wins.

### POST `/anthropic/v1/messages` Auth: —

Not implemented yet: returns `501` with a docs link. See [Claude Code](https://inferit.cc/docs/guides/claude-code.md).

### Model auto

`"model": "auto"` (also `auto:cheap`, `auto:best`, and the `inferit/` prefix) lets Inferit pick the model: among the models with a healthy seller that fit the request, the best value on a published quality ranking for this request's price, then the cheapest healthy seller of it. Optional hints, as body fields or headers: `max_price_per_m` (`x-inferit-max-price-per-m`, µ per 1M tokens all-in; named models too), `min_context` (`x-inferit-min-context`) and `min_quality` (`x-inferit-min-quality`, 0–100). Policies, the choice, the ranking and every error: [Automatic routing](https://inferit.cc/docs/routing.md).

### GET `/v1/routing` Auth: —

How model auto chooses, as data: the policies and their weights, the hints, the quality ranking as committed (method, sources, dates, every score and the models left out), and the models auto can choose from now for a reference request, in its order. Public, cached for 60 s.

_GET /v1/routing (abridged)_

```json
GET /v1/routing
{
  "policies": [{ "id": "auto:balanced", "model": "auto", "aliases": ["auto:balanced", "inferit/auto"],
                 "name": "Inferit Auto: best value", "lambda": 6, "description": "…" }, …],
  "hints": [{ "body": "max_price_per_m", "header": "x-inferit-max-price-per-m",
              "unit": "µ per 1M tokens, all-in", "range": "1..1000000000000", "appliesTo": "auto and named models", … }, …],
  "quality": { "asOf": "2026-10-06", "method": "…", "sources": [ … ], "models": [{ "id": "…", "score": 21, … }], "leftOut": [ … ] },
  "reference": { "inputTokens": 3000, "outputTokens": 1000, "rail": "whitechain" },
  "candidates_now": [{ "model": "…", "score": 21, "healthy_offers": 1 }],
  "docs": "https://inferit.cc/docs/routing"
}
```

### Response headers

On every inference call:

| Header | Meaning |
| --- | --- |
| `x-request-id` | Request id, also in your usage log |
| `x-inferit-model` | The catalog id of the model that served the request: the one Inferit picked with model auto, or the one you named |
| `x-inferit-route` | `direct` for a named model; `auto:balanced`, `auto:cheap` or `auto:best` for model auto |
| `x-inferit-auto-choice` | Model auto only: 1 when the first choice served the request, 2 or more when failover moved it to another model |
| `x-inferit-attempts` | Offers tried (failover happens only before the first byte) |
| `x-inferit-buyer-cost-micro` | What this request cost you, in µ (a micro-ITC). A stream's final cost is known only after its last chunk; see your usage log. |
| `x-inferit-offer` | Opaque hash of the offer that served you, not the seller's identity. On Whitechain the settlement itself is public; see [On-chain visibility](https://inferit.cc/docs/security-trust.md#on-chain) |
| `x-inferit-rail` | Rail the request is funded and settled on |
| `x-inferit-network` | Settlement network, on every response: `whitechain-sepolia` |

### Errors

Errors use OpenAI's shape, `{"error":{"message","type","code"}}`. Branch on `code`:

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request` | The body does not parse or a field is invalid, a hint included (type invalid\_request\_error) |
| 400 | `invalid_auto_policy` | A model id that starts with auto: or inferit/auto but names no policy; use auto, auto:cheap or auto:best |
| 400 | `invalid_address` | POST /v1/faucet or sign-in with an address that is not 0x-prefixed 20-byte hex |
| 401 | `invalid_api_key` | A wrong or revoked API key |
| 401 | `missing_credentials` | An account route (keys, balance, usage, seller) without a session or key |
| 400 | `context_length_exceeded` | A named model whose sellers all serve a smaller context window than this request needs; shorten it or lower max\_tokens |
| 402 | `insufficient_funds` | With a key: the worst case exceeds your escrow balance or ceiling, or the ceiling has expired |
| 402 | `spend_limit_exceeded` | With a key: the key has reached its own spend limit |
| 404 | `model_not_found` | The model is neither in the catalog nor listed by a seller (see GET /v1/models), or send model auto |
| 404 | `model_not_servable` | A closed model: a reference row (servable: false) that no seller can list |
| 404 | `faucet_disabled` | This server sponsors no faucet |
| 429 | `rate_limit_exceeded` | Too many requests from this IP or paying address, or the faucet’s hourly server budget; honour retry-after |
| 429 | `faucet_cooldown` | This address claimed ITC less than 24 h ago; retry-after says when |
| 501 | `not_implemented` | /anthropic/v1/messages and legacy /v1/completions |
| 503 | `no_available_offers` | No healthy offer right now; honour retry-after |
| 503 | `no_eligible_model` | Model auto: no model can serve this request right now; error.reasons counts why (see Automatic routing) |
| 503 | `rail_unavailable` | The chain could not be read to check your funding (or, on seller routes, your registration); nothing was charged; honour retry-after (5 s). Without retry-after, your selected rail is not enabled here: pick another with PUT /v1/buyer/rail |
| 503 | `funding_busy` | A settlement landed while your funding was being read; nothing was charged; retry after 1 s (retry-after: 1) |
| 503 | `faucet_pending` | The mint was sent but is not confirmed yet (retry-after 15); check the balance before claiming again |
| 503 | `faucet_unavailable` | The faucet cannot mint right now; retry after 60 s |
| 503 | `x402_settlement_pending` | The x402 deposit was sent but not confirmed in time; if it lands it is your balance |
| 503 | `x402_unavailable` | The x402 path failed before anything was sent; nothing was charged |
| 402 | `invalid_exact_stellar_*` | x402 on Stellar: the payment was refused (in the 402 error field); the suffix says why, e.g. \_balance\_over\_limit, \_wrong\_amount, \_signature\_expires\_too\_soon |
| 503 | `x402_busy` | x402 on Stellar: too many payments are settling right now; nothing was used or charged; retry after 5 s |
| 400 | `trustline_missing` | POST /v1/faucet/stellar: the G… account has no trustline to ITC; the error carries the changeTrust to send |
| 400 | `account_not_found` | POST /v1/faucet/stellar: the G… account does not exist yet; fund it from friendbot first |
| 400 | `unsupported_recipient` | POST /v1/faucet/stellar with a contract address (C…): the faucet sends to G… accounts only |
| 401 | `stellar_key_not_a_signer` | Stellar sign-in: the account no longer accepts the key that signed (its master key weight is 0 or below its threshold) |
| 404 | `stellar_not_enabled` | A Stellar sign-in or payout route on a server without the Stellar rail |

Inference with no key at all answers `402`: the x402 challenge, not an error. Rate limits (hosted defaults): 1,200 requests a minute per IP on every route, 30 a minute on sign-in; over them, `429 rate_limit_exceeded` with `retry-after`. Responses carry no RateLimit headers.

```json
{
  "error": {
    "message": "Your available balance on whitechain does not cover the worst-case cost of this request.",
    "type": "insufficient_funds",
    "code": "insufficient_funds"
  }
}
```

## x402: pay per request, no key

One keyless request: the agent posts with model auto and no key; Inferit answers 402 with a quote of at least $0.01; the agent resends the same body with a PAYMENT-SIGNATURE; Inferit answers 200 and names the model. Each keyless call prepays at least $0.01 and is charged its exact price.

**Two ways to pay.** With an API key, each request is charged to your prepaid balance: no quote, no payment step (only a `402 insufficient_funds` when the balance or the ceiling is too low, or `402 spend_limit_exceeded` when the key is at its limit). Without a key, you get a `402` quote and pay for that one request with x402.

Standard x402 v2, `exact` scheme, settled into the escrow and credited to the payer. x402 can express $0.000001, but every x402 payment is an on-chain transaction that costs gas, so the API works as a prepaid meter: each payment is at least $0.01 (0.01 ITC), it is credited to the payer's own escrow balance, and each request is charged its exact µ cost against that balance. Settlement to sellers is batched on chain. The facilitator pays the gas, so an agent needs no WBT. The walkthrough and client code are on [Agents](https://inferit.cc/agents) and in [agents.md](https://inferit.cc/agents.md). Standard x402 v2 clients work once the asset is allowed in their spend controls; sign with a plain key (EOA), since smart-wallet signatures are not accepted. The asset is ITC (EIP-3009).

### POST `/v1/chat/completions` Auth: none → 402

With no `Authorization` or `x-api-key` header: `402` with a `PAYMENT-REQUIRED` header (base64 JSON) and the same document as the body. It offers one requirement: `scheme: "exact"`, `network: "eip155:<chainId>"`, `asset` = the token, `payTo` = the escrow, `amount` = the worst-case all-in cost of this exact body (at least $0.01 = 0.01 ITC, since each payment is an on-chain transaction; the request is then charged its exact µ cost), `maxTimeoutSeconds` and `extra: { name, version }`, the token's EIP-712 domain: `name: "Inferit Test Credit"`, `version: "1"` (the domain version, not the contract revision: the token is TestCredit contract rev. 2). The quote is pinned to the body and the routing headers for 120 s. The same applies to `/min{N}/v1/chat/completions`. With model auto, the quote is priced for the model auto picks, and the 402 carries `x-inferit-model` and `x-inferit-route`; the paid retry tries that model first ([x402 and auto](https://inferit.cc/docs/routing.md#x402)).

### POST `/v1/chat/completions` Auth: PAYMENT-SIGNATURE

The same body with a `PAYMENT-SIGNATURE` header (base64 JSON payload with an EIP-3009 authorization; `X-PAYMENT` is accepted too). The API verifies it, settles it first with `depositWithAuthorization`, then serves the request against the payer's escrow balance (streaming included). The response carries `PAYMENT-RESPONSE`, base64 of `{ success: true, transaction, network, payer }`, plus the usual `x-inferit-*` headers. A payment that does not verify gets a fresh `402` with the reason in `error`. If the request fails after the payment settled, the credit stays in the payer's escrow balance and the error says so (an `error.x402` object with `credited`, `payer`, `amount` and `transaction`; a funding `402` at that point becomes `503`, so the client does not pay again). `503 x402_settlement_pending`: the deposit was sent but its receipt did not arrive in time; if it lands it is the payer's escrow balance. `503 x402_unavailable`: nothing was sent and nothing was charged.

### POST `/v1/faucet` Auth: none

Inferit's ITC faucet (ITC, not WBT), free and sponsored. Body `{ address }`: the API mints 1,000 ITC to that address with `faucetTo` and pays the gas, so the address needs no WBT. At most once per 24 h per address (`429 faucet_cooldown`), 10 calls an hour per IP and 120 sponsored mints an hour per server (`429 rate_limit_exceeded`). `503 faucet_pending` (`retry-after: 15`): the mint was sent but is not confirmed yet; check the balance before you claim again. `404 faucet_disabled` when the server does not sponsor the faucet.

_200 response_

```json
{
  "address": "0xYourAddress",
  "amountMicro": "1000000000",
  "token": { "address": "0x2E67…7fBB", "symbol": "ITC", "decimals": 6 },
  "network": "eip155:1874",
  "transaction": "0x…",
  "explorerUrl": "https://explorer.testnet.whitechain.io/tx/0x…",
  "next": "Pay for inference with x402: POST …/v1/chat/completions without credentials …"
}
```

### GET `/.well-known/x402`

Discovery: the paid resources and the requirement a client signs for (scheme, network, asset, payTo, extra), the minimum payment, the facilitator address and the faucet. `404` when x402 is off.

### On Stellar

While `GET /v1/rails` lists a rail with `"id": "stellar"`, the 402 also lists a Stellar entry and these routes answer. The walkthrough and client code: [Pay on Stellar](https://inferit.cc/docs/payments/stellar.md).

### POST `/v1/chat/completions` Auth: PAYMENT-SIGNATURE (Stellar)

The 402's Stellar entry: `scheme: "exact"`, `network: "stellar:testnet"`, `asset` = the ITC contract (`C…`), `payTo` = Inferit's treasury (`G…`), `amount` in base units (7 decimals: 10 per millionth of a dollar), paid exactly, and `extra.areFeesSponsored: true`. The paid retry carries one SAC `transfer` signed by a `G…` account's own key; Inferit pays the network fee. Once it lands it is credited to the payer's balance with Inferit and the request is served, charged at most that payment. A call without a key never spends what earlier payments left: an API key made after a Stellar sign-in with the same key does ([Stellar sign-in](https://inferit.cc/docs/api-reference.md#auth-stellar), then `POST /v1/keys`). A payment that would take the balance past its limit is refused with `invalid_exact_stellar_balance_over_limit`. `503 x402_settlement_pending`: the transaction was submitted and its outcome is not known yet (`error.x402.transaction`); if it lands it is credited, checked again within minutes. `503 x402_busy` and `503 x402_unavailable`: nothing was sent and nothing was charged.

### GET `/v1/faucet/stellar` Auth: none

What the Stellar faucet gives (asset, amount, once per 24 h per address) and how to add the trustline. `404 faucet_disabled` when it is off.

### POST `/v1/faucet/stellar` Auth: none

Body `{ address }`, a `G…` account with a trustline to ITC: sends 1,000 ITC, once per 24 h per address (`429 faucet_cooldown`), within the same per-IP and per-server hourly limits as the ITC faucet. `400 account_not_found`, `trustline_missing`, `trustline_not_authorized` or `trustline_limit` say what to fix first; `400 unsupported_recipient` for a contract address (`C…`). `503 faucet_pending` (`retry-after: 15`): sent, not confirmed yet; the next claim checks it before anything new is sent.

## Marketplace (public)

### GET `/v1/models`

OpenRouter-shaped model rows plus `pricing` (list price) and `best_price` (best all-in offer, or `null`). Two encodings of the same price sit side by side: `prompt` and `completion` are decimal strings in ITC per token (`"0.0000001"`), as OpenRouter writes them; `input_per_m`, `output_per_m` and `cache_read_per_m` are integer µ per 1M tokens (`"100000"`). `best_price.discount_pct` is the best all-in price (fee included) against list. The list includes list-price-only rows: `best_price: null` means no seller offers that model right now. The first three rows are model auto (`auto`, `auto:cheap`, `auto:best`; `owned_by: "inferit"`), each with an `auto` object: `policy`, `pick`, `candidates` and `ranking` (`as_of`, `url`), computed for a reference request of 3,000 input and 1,000 output tokens. `GET /v1/models/auto` returns one row. Each servable model with listed offers also carries `live`: `healthy_sellers` and `sellers` (counts), `uptime_24h` (0 to 1), `ttft_p50_ms` and `ttft_p95_ms` (time to first token over the last 24 h: the median across offers of each offer's own p50 and p95) and `updated_at`. A figure with no data yet is `null`, never an estimate; demo offers are not counted. Other catalog rows have `live: null`; the three auto rows have no `live`. Every model row says where it comes from: `listed_by` is `"catalog"` (the curated catalog, `catalog: true`) or `"seller"` (`catalog: false`): an open-weight model a seller listed with [POST /v1/seller/models](https://inferit.cc/docs/api-reference.md#post-v1-seller-models). A seller-listed row has `open_weight: true`, its `aliases`, `context_length` and `license`, plus `hf_repo` (the Hugging Face repo it was checked against, or `null`) and `license_source` (`huggingface` or `seller`). It has no list price: `pricing` is `null`, `best_price` comes from its live offers only and `best_price.discount_pct` is `null`. Model auto never picks it (it has no quality score), and a `x-min-discount` floor excludes it. Seller-listed rows come after the catalog's.

_live (annotated)_

```
GET /v1/models   (one row, abridged)
{
  "id": "qwen/qwen-2.5-14b-instruct",
  "context_length": 32768,
  "aliases": ["qwen2.5:14b-instruct", "qwen2.5:14b", "qwen2.5-14b-instruct", "Qwen/Qwen2.5-14B-Instruct"],
  "pricing": { "input_per_m": "100000", "output_per_m": "200000", … },   // list price
  "best_price": { "input_per_m": "73500", "output_per_m": "147000", … }, // all-in
  "live": {
    "healthy_sellers": 1,
    "sellers": 2,
    "uptime_24h": null,          // 0..1, null until there is data
    "ttft_p50_ms": null,         // time to first token, last 24 h
    "ttft_p95_ms": null,
    "updated_at": "2026-10-13T09:00:00.000Z"
  }
}
```

### GET `/v1/models/:id`

One row of `/v1/models`, by id or alias, catalog or seller-listed. The id contains `/`: send it as is or URL-encoded (`%2F`).

### GET `/v1/models/:id/endpoints`

The offers that serve one model, healthy ones first, then by all-in price, with `updated_at`; one row per offer: `seller` (the seller's wallet address, shortened, or `null` for a seller account with no wallet on file), `offer_id` (the same opaque id a response names in `x-inferit-offer`), `price` (`input_per_m` and `output_per_m`, all-in, integer µ per 1M tokens as decimal strings), `context_length`, `quantization` (or `null`), `healthy`, `uptime_24h`, `ttft_p50_ms` and `ttft_p95_ms`, each `null` when unknown. Never a seller's endpoint URL or volume. Demo offers are left out unless the server routes paid traffic to them; then they are listed with `demo: true`. URL-encode the id.

_example (annotated)_

```
GET /v1/models/qwen%2Fqwen-2.5-14b-instruct/endpoints
{
  "model": "qwen/qwen-2.5-14b-instruct",
  "updated_at": "2026-10-13T09:00:00.000Z",
  "endpoints": [{
    "seller": "0x45A9…7CDE",            // the seller's wallet, shortened (null: no wallet on file)
    "offer_id": "…",
    "price": { "input_per_m": "73500", "output_per_m": "147000" },  // all-in, µ per 1M tokens
    "context_length": 32768,
    "quantization": null,
    "healthy": true,
    "demo": false,                      // true only on a server that routes to demo offers
    "uptime_24h": null,                 // 0..1, null until there is data
    "ttft_p50_ms": null,
    "ttft_p95_ms": null
  }]
}
```

### GET `/v1/prices`

List and best all-in price per model (list `null` for a seller-listed model).

### GET `/api/marketplace`

Per model: best all-in input/output price, discount vs list, sellers, healthy sellers, warm sellers (no cold start now), 24 h requests and volume, uptime, TTFT p50.

### GET `/api/markets/:model`

Aggregated order book: price levels with offer count, healthy count and the combined daily caps of the offers at each level. Never seller identities, endpoints or per-offer volume. URL-encode the model id.

### GET `/api/stats`

Rolling 24 h totals: requests, spend, savings vs list, tokens, offers, sellers.

### GET `/v1/rails`

Settlement on Whitechain: network, chain id, escrow and token addresses, operator, owner, guardian, escrow version, health.

### GET `/v1/providers/resale-allowlist`

Providers whose terms permit API-key resale, each with an evidence URL. Empty by default.

### GET `/health`

Liveness, the build's git SHA, the network and chain id. Answers 503 when the database or the settlement rail is unhealthy (RPC down, escrow paused, operator low on gas).

### GET `/metrics`

JSON operations metrics: settlement backlog, batches awaiting finality, chain head lag, operator gas runway, circuit-breaker headroom, connector session counts, and healthy and warm offers per core model when the operator names core models. May require a bearer token on hosted deployments.

### GET `/llms.txt`

The API's own summary for agents, with the live models and prices and both ways to pay. This site's index of every page as markdown is a different file: [/llms.txt](https://inferit.cc/llms.txt) on the docs host.

The two examples below show the response shape. The live values are on [/models](https://inferit.app/models).

_example (annotated)_

```
GET /api/marketplace
{
  "feeBps": 500,
  "markets": [{
    "modelId": "qwen/qwen-2.5-14b-instruct",
    "name": "Qwen: Qwen2.5 14B Instruct",
    "openWeight": true,
    "licenseId": "apache-2.0",
    "listInputPerM": "100000",        // µ per 1M tokens: 0.10 ITC per 1M
    "listOutputPerM": "200000",
    "bestInputPerM": "84000",         // all-in, healthy offers only
    "bestOutputPerM": "168000",
    "bestDiscountPct": 16,
    "sellers": 2, "healthySellers": 1,
    "requests24h": 0, "volume24hMicro": "0",
    "uptime24hPct": null,             // null until there is data
    "ttftP50Ms": null
  }]
}
```

_example (annotated)_

```
GET /api/markets/qwen%2Fqwen-2.5-14b-instruct
{
  "modelId": "qwen/qwen-2.5-14b-instruct",
  "summary": { ...same shape as a marketplace row... },
  "levels": [
    { "inputPerM": "84000", "outputPerM": "168000", "offers": 1, "healthyOffers": 1, "capacityMicro": null },
    { "inputPerM": "90000", "outputPerM": "180000", "offers": 1, "healthyOffers": 0, "capacityMicro": "1000000" }
  ]
}
```

## Sign-in

### POST `/v1/auth/evm/challenge`

Body `{ address }`. Returns `{ message, nonce, expiresAt }`: a one-time EIP-4361 message to sign with the wallet (an EIP-191 signature). It is an off-chain text signature: no transaction, no gas.

### POST `/v1/auth/evm/verify`

Body `{ message, signature }`. Verifies the signature and returns `{ token, expiresAt, account }`: a session token for the account routes, valid for 24 h, for both the Buy and the Sell workspace.

### POST `/v1/auth/stellar/challenge`

While the Stellar rail is on. Body `{ address }`, a `G…` account exactly as the wallet shows it. Returns `{ message, nonce, expiresAt, method: "sep53" }`: a one-time text message to sign as a SEP-53 signed message (Freighter, Hana, xBull). No transaction, no fee. `404 stellar_not_enabled` when the rail is off.

### POST `/v1/auth/stellar/verify`

Body `{ message, signature }` (base64 or hex). Returns a session like the EVM one; its account's rail is `stellar`, so an API key made with it spends the Stellar balance. The account's signers on Stellar are checked: `401 stellar_key_not_a_signer` when the account no longer accepts the key that signed, `503 stellar_unavailable` when Stellar cannot be read (the same signature can be retried).

### POST `/v1/account/stellar-payout/challenge` Auth: session

Body `{ address }`, a `G…` account: a message naming this Inferit account, to be signed (SEP-53) by that address's wallet. Then `POST /v1/account/stellar-payout/verify` with `{ message, signature }` records it as the account's Stellar payout address; `DELETE /v1/account/stellar-payout` removes it.

## Keys

### POST `/v1/keys` Auth: session

Body `{ name?, spendLimitMicro?, minDiscountPct? }`. Returns the key once in `key`.

### GET `/v1/keys` Auth: session

Your keys (prefix only, never the secret).

### DELETE `/v1/keys/:id` Auth: session

Revoke immediately.

## Buyer

### GET `/v1/balance` Auth: session or API key

Available, cap, spent, deposit, expiry, unsettled charges (`pendingMicro`) and usage settled on-chain but not yet final (`pendingFinalityMicro`). Available subtracts both.

### PUT `/v1/buyer/rail` Auth: session

Body `{ rail: "whitechain" }`. Selects Whitechain settlement for future requests (`"credit"` exists only on local development APIs).

### GET `/v1/usage?limit&cursor` Auth: session or API key

Per-request token counts, costs, latency, rail and settlement status. `model` is the model that served the request; `requestedModel` is `auto:balanced`, `auto:cheap` or `auto:best` when you sent model auto, else `null`. Paginate with `nextCursor`. Each row carries `finality`: `pending` until its settlement batch is finalized on-chain, then `finalized`. Rows never carry the seller's identity, a transaction hash or a batch id; your own settlements are listed with explorer links in the Buy workspace.

### GET `/v1/usage/export.csv` Auth: session or API key

The same as CSV, with `requestedModel` as the last column. Never contains prompts or completions.

## Seller

### POST `/v1/seller/offers` Auth: session

Body `{ model, kind: "endpoint" | "upstream_key", endpointUrl, authToken?, upstreamProvider?, upstreamKey?, pricing, capDailyMicro?, licenseAck }`. `pricing` is `{ mode: "per_token", inputPerM, outputPerM, cacheReadPerM? }` or `{ mode: "multiplier", multiplierBps }` (10,000 = list price). The API checks the licence, the resale allowlist and an SSRF guard, sends a live 1-token probe, and requires you to be registered on your rail. Optional availability fields: `availability` (`always_on`, `scale_to_zero` or `intermittent`), `coldStartMs` and `healthUrl` (both required for `scale_to_zero`), `warmWindowMs`, `maxContextTokens` and `quantization`; see [availability](https://inferit.cc/docs/sellers.md#availability). A connector offer uses `endpointUrl` `connector://<nodeId>/v1` with no `authToken`, and answers `409 node_offline` unless the seller app on that machine is connected and serving the model. `model` is a catalog model or one a seller listed ([open listing](https://inferit.cc/docs/api-reference.md#post-v1-seller-models)); a seller-listed model is priced `per_token` only and served from your own machine or endpoint (`kind: "endpoint"`; an `upstream_key` offer on it is `403 resale_not_allowed`), and every other check is the same.

### POST `/v1/seller/models` Auth: session or seller key

Open listing: list an open-weight model that is not in the catalog, so that any seller can offer it. Body `{ hfRepo? | id?, name?, contextLength, licenseId?, licenseAck?, aliases }`. With `hfRepo` (a Hugging Face repo id such as `Org/Model-7B-Instruct`, or its huggingface.co link) the API asks Hugging Face: the repo must be public, ungated and a text-generation model, and its licence is read from the model card; the model id is the repo id in lowercase. Without one, `id` is a lowercase `<org>/<name>` and `licenseId` names the licence of the weights (one of `apache-2.0`, `mit`, `bsd-3-clause`, the Llama community licences, `gemma`, `qwen`, `modified-mit`, `cc-by-4.0`, `cc-by-sa-4.0`, `openrail`, or `other` for a custom licence you checked). A licence that does not permit commercial serving (non-commercial, research-only, closed) is refused (`400 license_not_listable`); a conditional one, or one the API cannot verify, needs `licenseAck: true` (`400 license_ack_required`). `contextLength` is 256 to 10,000,000 tokens (at most the model's own window when Hugging Face reports it). `aliases` are your machine's local names for the model (at most 5 a request, 10 a model; the Sell workspace sends the local name), which the `inferit-seller` app matches exactly. An alias is never a Hugging Face repo id other than the model's own (list that repo as its own model) nor a closed model's name, and no id or alias ends in `/endpoints`. Refused: `409 catalog_model` for a catalog model or a name close to one (the error names the catalog id to offer instead), `400 closed_model` for a hosted-API model, `403 hf_repo_gated` for a gated or private repo, `404 hf_repo_not_found`, `400 not_a_chat_model`, `409 alias_taken`, `503 hf_unavailable` when Hugging Face does not answer. Limits per account: 10 new models a day (`429 model_limit_daily`), 50 in all (`409 model_limit_total`), 30 Hugging Face checks an hour (`429 hf_lookup_limit`). Answers `201` with `{ model, created: true }`, or `200` with `created: false` when the id is listed already: your aliases are added to it. Your connected machines are told at once, so the app (0.3.3 or newer) serves the model without a restart. Then list an offer on it with [POST /v1/seller/offers](https://inferit.cc/docs/api-reference.md#post-v1-seller-offers), priced per token (it has no list price to multiply).

_example_

```
POST /v1/seller/models
{ "hfRepo": "Org/Model-7B-Instruct", "contextLength": 8192, "aliases": ["model-7b:latest"] }

201
{
  "created": true,
  "model": {
    "id": "org/model-7b-instruct",
    "name": "Org: Model-7B-Instruct",
    "hfRepo": "Org/Model-7B-Instruct",
    "contextLength": 8192,
    "licenseId": "apache-2.0",
    "licenseSource": "huggingface",   // read from the model card
    "aliases": ["model-7b:latest"],
    "status": "active",
    "createdAt": "2026-10-19T12:00:00.000Z",
    "listedByYou": true
  }
}
```

### GET `/v1/seller/models` Auth: session or seller key

The models your account listed: `id`, `name`, `hfRepo`, `contextLength`, `licenseId`, `licenseSource`, `aliases`, `status`, `createdAt`.

### GET `/v1/seller/offers` Auth: session

Your offers, including your own endpoint URLs and health.

### PATCH `/v1/seller/offers/:id` Auth: session

Pause/resume, reprice, change cap or endpoint.

### DELETE `/v1/seller/offers/:id` Auth: session

Delist; stored secrets are destroyed (hard delete).

### POST `/v1/seller/nodes` Auth: session

Body `{ name }` (at most 64 letters, digits, spaces and `. : @ ( ) - _`). Adds a machine: mints a connection token for the `inferit-seller` app ([seller quickstart](https://inferit.cc/docs/sellers/quickstart.md)). Returns `node` (with its `offerEndpointUrl`), the token once in `token`, and `connectUrl`. Needs the session from wallet sign-in. `409 too_many_nodes` at the account's limit (five by default). See [connector mode](https://inferit.cc/docs/sellers.md#connector).

### GET `/v1/seller/nodes` Auth: session

Your machines. Each has `id`, `name`, `tokenPrefix`, `createdAt`, `online` (connected now), `lastSeenAt` (or `null`), `agent` (the app that runs it: `{ name, version, os, arch }`, or `null` for an older app), `detected` (what the app found on the local model server at its last connection: `local` name, `server` (`ollama`, `lmstudio`, `vllm`, `llamacpp` or `custom`), `model` (the catalog or seller-listed id it matched, or `null`: not on the market yet) and, when known, `contextLength`, `quantization`, `sizeBytes` and `chat: false` for a model the server says is not a chat model) and `models` (the model ids it serves). Also `offerEndpointUrl`, the `endpointUrl` for its offers.

_example (annotated)_

```
GET /v1/seller/nodes   (one machine, abridged)
{
  "nodes": [{
    "id": "node_…",
    "name": "home-pc",
    "tokenPrefix": "icn_AbCd…wxyz",
    "createdAt": "2026-10-13T09:00:00.000Z",
    "online": true,
    "lastSeenAt": "2026-10-13T09:05:12.000Z",
    "agent": { "name": "inferit-seller", "version": "…", "os": "darwin", "arch": "arm64" },
    "detected": [
      { "local": "qwen2.5:14b-instruct", "server": "ollama", "model": "qwen/qwen-2.5-14b-instruct",
        "contextLength": 32768, "quantization": "Q4_K_M", "sizeBytes": 8988110976 },
      { "local": "my-finetune:latest", "server": "ollama", "model": null }
    ],
    "models": ["qwen/qwen-2.5-14b-instruct"],
    "offerEndpointUrl": "connector://node_…/v1"
  }],
  "connectUrl": "wss://…/v1/seller/connect"
}
```

### PATCH `/v1/seller/nodes/:id` Auth: session

Body `{ name }`. Renames a machine; only its owner can. The token and the connection are unchanged.

### DELETE `/v1/seller/nodes/:id` Auth: session

Revoke: the token stops working, the connection closes at once and its offers leave routing.

### GET `/v1/seller/connect` Auth: connection token

The WebSocket (wss) the seller app opens in connector mode. Not for direct use: the open-source [inferit-seller](https://github.com/InferitAI/inferit-seller) app speaks its protocol (version 1). Its `hello` may carry, besides the required fields, `agent` (`{ name: "inferit-seller", version, os, arch }`) and `detected` (up to 200 entries, as in `GET /v1/seller/nodes`); an app that sends neither still connects. Both are shown to the machine's owner only; routing never reads them: the market serves the models the `hello` declares.

### GET `/v1/seller/earnings` Auth: session

Settled, pending and withdrawable earnings, with the settled part split into `pendingFinalityMicro` and `finalizedMicro`.

## On-chain calls (no endpoint)

Moving money in or out of the escrow is a transaction on Whitechain Sepolia, not an API call. The app sends these from your wallet; a transaction you send yourself costs gas in WBT. The contract view, with every check, is on [Whitechain escrow](https://inferit.cc/docs/payments/whitechain.md#calls).

| Action | Call | Gas |
| --- | --- | --- |
| [Deposit and set a ceiling](https://inferit.cc/docs/payments/whitechain.md#deposit) | `approve(escrow, amount)` on ITC, then `depositAndSetCap(amount, cap, expiry)` | WBT, from your wallet |
| Change the ceiling | `setSpendingCap(cap, expiry)`, or the relayed `setSpendingCapBySig` | WBT, or the relayer's |
| [Withdraw a deposit](https://inferit.cc/docs/payments/whitechain.md#withdraw) | `requestWithdraw(amount)`, then `executeWithdraw()` after the delay | WBT, from your wallet |
| [Register as a seller](https://inferit.cc/docs/sellers.md#steps) | `registerSeller(payout)` from the seller wallet | WBT, from your wallet |
| [Withdraw seller payouts](https://inferit.cc/docs/sellers.md#payouts) | `withdrawEarnings()`, paid to the registered payout wallet | WBT, from your wallet |
| [Pay with x402](https://inferit.cc/docs/payments/whitechain.md#x402) | `depositWithAuthorization`, submitted by the facilitator with your signature | None for the payer |
| [Claim ITC](https://inferit.cc/docs/api-reference.md#faucet) | `POST /v1/faucet` (sponsored), or `faucet()` on ITC from your wallet | None, or WBT from your wallet |

---

Canonical page: https://inferit.cc/docs/api-reference
All pages as markdown: https://inferit.cc/llms.txt
