Receipts

Each job has one receipt. It records what you asked for, which offer won, what the job used, what it cost and how fast it ran. The exchange writes it just after it answers. A receipt is final once its settlement_status is settled, credited or released.

Use the receipt to check a charge. supplier_charge_usd plus fee_usd, less credits_usd, is buyer_charge_usd. Fees explains the fee.

Read a receipt

A key with read scope or higher can call these routes. A job of another workspace returns 404. A call at once after the answer can also return 404. Try again after a moment.

curl "https://router.inference.ai.exchange/v1/exchange/receipts?limit=20&outcome=completed" \
  -H "Authorization: Bearer $LIQUID_API_KEY"

A stored receipt is one flat JSON object. A receipt for a job with a winner also has the exchange block of the live response, and can have requested_purchase. An absent field does not apply to the job. It is not zero. Money fields are USD numbers. A rate is USD per million tokens.

The exchange block

The exchange block of a live response has a charge object and a usage object. They name the same money as the fields below.

"charge": { "cap_nanos": 50000000, "supplier_nanos": 1200000, "fee_nanos": 60000, "credits_nanos": 0, "total_nanos": 1260000 },
"usage": { "prompt_tokens": 120, "completion_tokens": 40, "pricing": [{ "billable": "output_text", "unit": "mtok", "quantity": 40, "usd": 0.000019 }] }

Identity

Outcome

outcome and what each value charges:

Value Meaning Charge
completed The provider finished the job. The tokens used.
no_eligible_offer No offer passed the gate. See eligibility. None. The hold is released.
failed_before_output The job failed before any output. None. The hold is released.
cancelled_after_output The job stopped after output began. The tokens used.
provider_error_after_output The provider failed after output began. You keep the output. A full credit. The provider earns nothing.
partial_output A stream stopped after output began, not by the provider's fault. The input and relayed tokens, as a lower bound.
deadline_missed Old receipts only. A late job is now completed with service missed. A full credit.

settlement_status:

A job that missed its deadline is charged like any other completed job. credits_usd is zero.

Charge

Usage

meters fields. A media meter is absent when it is zero.

The exchange.usage block gives the same numbers in a simpler form. prompt_tokens is the sum of all input meters.

exchange.usage.pricing lists the same use by billable. Each line has billable, unit, quantity and usd. The usd is the provider charge for that quantity before the exchange fee, at the rate that priced the job. A receipt with no stored rates has no table. The flat counters stay.

answer_checks changes no charge, except that a chat answer with a bad tool call is rejected before you receive it.

Timing

Provider and offer

Addressing

addressing says how your request became a served model. It is absent on a job with no award.

Competition

reason values:

Exchange block and requested purchase

exchange is the block of the live response. See Purchasing rules. requested_purchase is what the request asked for before the preset of its key limited it: target, models, strategy, rules and sources. Absent on old jobs.

Check a receipt

  1. Add supplier_charge_usd and fee_usd, subtract credits_usd, and compare with buyer_charge_usd. It must not exceed cap_usd.
  2. For a job priced in tokens, multiply each meters value by the matching rate in rates. The sum is supplier_charge_usd, unless the cap limited the job.
  3. Compare fee_usd with Fees.
  4. Compare ttft_ms with ttft_deadline_ms, not with promised_ttft_ms.