Settlement
Usage charges, fee destinations, and authenticated receipts.
Claim payment
The selected provider signs claim_list_booking(Claim). Supply the booking’s pinned provider counters and wallet ledger, followed by its fee destinations. The SDK derives the settlement path from validated booking state.
Claim contains uncached, cached, and output token counts, plus an optional ReceiptInput. The handler checks reserved status, deadline, token limits, cache permission, payout, and total reserve. Payment, unused-reserve return, and concurrency decrements are atomic. Settlement does not refund quota.
A reusable claim supplies a receipt, including for zero charge, and executes as a top-level instruction. One-shot claims omit it and can execute through CPI. Reusable storage becomes available; one-shot storage becomes finalized.
The signature authenticates reported accounting. It does not prove inference computation or answer quality.
Calculate the charge
Calculate each usage category with its stored rate, rounding up separately. Add the stored list surcharge. Split that surcharge using the stored protocol share, also rounding the protocol amount up. The list authority receives the remainder.
The user’s total charge includes provider payment and surcharge. For example, a 1.00 USDC provider charge with a 1% surcharge costs 1.01 USDC. A 100% protocol share sends the full 0.01 USDC surcharge to the protocol destination. These example settings are not universal constants.
Amounts use payment atoms throughout. For six-decimal USDC, one atom is one millionth of one USDC.
provider_charge = ceil(uncached × input_rate / 1_000_000) + ceil(cached × cached_rate / 1_000_000) + ceil(output × output_rate / 1_000_000)
list_fee = ceil(provider_charge × fee_bps / 10_000)
protocol_fee = ceil(list_fee × protocol_share / 10_000)
creator_fee = list_fee - protocol_fee
charge = provider_charge + list_fee
Fee destination accounts
For a booking with a surcharge, append exactly two writable remaining accounts after the fixed claim accounts: the list authority’s payment-token account, then the protocol payment destination. Both remain required when the creator’s calculated share is zero.
The first account must belong to Booking.creator. If reserve_destination == 1, the second must equal Booking.protocol_destination and be owned by Booking.reserve_authority. Otherwise it must be a payment-token account owned by Booking.protocol_destination. All use the market mint.
Use these pinned fields even if the market’s current council or model assignment has changed. The claim does not read the current list or group to choose recipients. The provider’s payout may also serve as a fee destination when its ownership matches the required role.
Receipt commitments
ReceiptInput contains owner, user, booking, generation, charge, and claim_end. The provider includes it in the signed claim. The program compares every field with the booking and calculated total.
Use Anchor’s generated discriminator and argument serialization. The program also emits fossa/receipt/v2 logs with receipt and usage data. Logs can truncate. Retain successful top-level claim transaction bytes to preserve history after storage reuse.
A signature does not establish honest usage, model identity, response quality, or data retention. Indexing explains how to interpret the record.