Build on AIU.
A working draft of the settlement spec, quote and receipt objects, wallet API, and provider SDK for private-beta review.
Overview
PRVTC is a settlement layer for AI consumption. Buyers hold AIU and authorize jobs against signed provider quotes; providers run the work and sign a metering receipt; settlement releases payment and refunds the remainder. This reference covers the objects and APIs you'll use.
Core concepts
A quote is a signed, expiring price for an exact job. An authorization locks AIU against a quote. A receipt records metered consumption signed by the provider. settlement reconciles the two.
Quickstart
import { Wallet } from "prvtc";const w = new Wallet({ key: env.PRVTC_KEY });// 1. get signed quotes for a job, routed cheapestconst quote = await w.quote({ model: "qwen-32b", route: "cheapest" });// 2. authorize + run; AIU locks, then settles on the receiptconst res = await w.run(quote, { input: prompt }); console.log(res.output, res.settled_aiu, res.receipt.sig);
Quote object
Returned by wallet.quote() and signed by the provider.
Receipt object
Signed by the provider's metering key after execution; verified by the wallet before settlement. Carries the measured consumption and a reference to the originating quote.
Settlement
Settlement debits AIU equal to price_aiu × measured_units, never exceeding the locked authorization. Any difference refunds to the wallet automatically.
Wallet API
Methods: quote(), run(), balance(), transfer(), receipts(). All calls are authenticated with a workspace key and scoped by budget.
Provider SDK
Implement onQuote() and onRun() to answer quote requests and sign receipts. See For providers for an end-to-end example.
Errors
Quotes that expire return quote_expired; over-budget authorizations return budget_exceeded; receipt/quote mismatches return receipt_invalid and never settle.
