API reference

API reference · API

The Merkle proof of one request

GET/v1/requests/{id}/proofAPI key

Where the operator seals the books (ANTIMATTER_RECEIPTS), each closed UTC day's usage rows and ledger entries become a Merkle tree about an hour after midnight UTC. This is the proof for one request this key made, by its x-antimatter-request-id: the leaf, the path, the day header and root, and the publication when there is one, plus `fields` (the leaf read back) and `row_unchanged` (whether the usage row still hashes to its leaf). Paste it into /verify. Only the key that made the request may read it; other ids are the same 404 as GET /v1/requests/{id}. A request whose day is not sealed yet is a 404 with code proof_not_committed, and with receipts off code receipts_off. Takes the read scope.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredstringThe request id.

Answer 200

The proof.

Fields of the 200 answer
FieldTypeWhat it is
objectstringOne of "receipt_proof".
versioninteger
daystring
treestringOne of "usage", "ledger".
indexinteger
leafstringThe canonical text that was hashed. A usage leaf is ["am-usage-v1", row id, request id, account digest, model, prompt tokens, completion tokens, billed micro USD, upstream micro USD or null, the markup in basis points those two imply or null, unix ms]; a ledger leaf is ["am-ledger-v1", entry id, account digest, kind, delta micro USD, SHA-256 of its reference or null, unix ms]. The account is a keyed digest, never an address.
leaf_hashstring
patharray of object
path[].sidestringOne of "left", "right".
path[].hashstring
headerobjectThe day header. The day's root is SHA-256 of the byte 0x02 followed by the UTF-8 of the JSON array ["am-day-v1", day, usage_root, usage_count, ledger_root, ledger_count, billed_micros, upstream_micros, unmeasured_count].
header.daystringThe UTC day.
header.usage_rootstring
header.usage_countinteger
header.ledger_rootstring
header.ledger_countinteger
header.billed_microsintegerWhat the meter billed that day, micro USD.
header.upstream_microsintegerWhat the upstreams charged, micro USD; a usage row nobody measured counts at its billed figure.
header.unmeasured_countintegerUsage rows with no measured upstream cost.
rootstring
publicationobject or nullWhere the root was published: a transaction from the operator's signer to itself whose calldata is the UTF-8 text `antimatter receipts v1 <day> <root>`. Null while it is not on chain, which is always the case where the operator has not switched publishing on.
fieldsobject
row_unchangedboolean

Errors

  • 401OpenAI shaped error.
  • 403OpenAI shaped error.
  • 404OpenAI shaped error.
  • 429Rate limited, or a spent budget or spend cap. The type distinguishes rate_limit_error, policy_exceeded, and spend_cap_exceeded.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter