Documentation / API reference

Economics & x402

What this node gives away, what it spends, what got paid, and how a 402 turns into a settled request.

Free-tier quota

GET/v1/quotaBearerTry it →

What this node gives away: given_tokens, quota_tokens per peer, window_hours (a sliding window, so it tops back up), and per-peer usage. Enforced here, by the machine paying the electricity — not by whoever is asking.

Spend cap

GET/v1/budgetBearerTry it →
GET/v1/budget/reportBearerTry it →

What this node spends on external APIs. Local inference is in neither meter — it costs nobody anything but your electricity.

There are two caps and either can be the one that cuts: a per-client cap and a per-machine total. Show the smaller remainder — with the account at USD 20 and the node at USD 2, saying "you have 20 left" promises nineteen that do not exist.

Look up a receipt

GET/v1/receipts/:idNo keyTry it →

Takes the completion id (chatcmpl-…) that came back with the answer, and returns the settlement receipt plus the attestation.

Receipts live in process memory and only the last 200 are kept. This is not a ledger — the real ledger is the chain. A restart wipes them. There is deliberately no route that lists receipts.

The x402 payment flow

A request to a node with a wallet, without a valid credential, gets a 402 whose body is not an error string but a quote: how much, to whom, on which network, and up to how many tokens.

// 402 response
{ "accepts": [{ "scheme": …, "network": …, "payTo": …, "maxAmountRequired": … }] }

After paying, the answer streams back and a final SSE event carries the proof:

FieldWhat it proves
paymentResponseSomebody paid — the settlement receipt
attestationWhat this node served, signed with the payout wallet over the JCS form of everything except the signature
attestationMissingPresent instead, with the reason, when no attestation could be produced
Verify it yourself. The attestation's outputHash is over the text, not the chunking — so a provider that inflates the gateway's chunk count by chopping the stream finer cannot move it. Recompute it against the answer you actually received.
A 402 without an accepts array is a different thing entirely: your spend cap is exhausted. There is nothing to pay — a limit was hit.
This flow is also the design opening discussed in Research → D1: what's the economy denominated in? — x402 is a rail built for stablecoin settlement.