Price schedules and the charge formula
Each route has one signed price schedule. Its digest goes into every Hold and every receipt, so a buyer always knows which prices a charge was computed from.
The schedule
{
"v": 1, "currency": "USDC", "unit": "micro-USDC",
"rates_per_mtok": { "input": 600000, "cached_input": 150000, "output_visible": 1800000, "output_hidden": 1800000 },
"per_request_fee": 50, "w_req_micros": 2000, "ack_timeout_ms": 5000,
"ttft_max_ms": 4000, "failure_billing": "none", "effective_from": 0
}
| Field | Meaning |
|---|---|
rates_per_mtok.input |
Micro-USDC per million uncached input tokens. |
rates_per_mtok.cached_input |
Micro-USDC per million input tokens served from the prefix cache. |
rates_per_mtok.output_visible |
Micro-USDC per million output tokens the buyer sees. |
rates_per_mtok.output_hidden |
Micro-USDC per million hidden (reasoning) output tokens. |
per_request_fee |
Micro-USDC added once to every billable request. |
w_req_micros |
Minimum Hold cap. A Hold with cap_micros below it gets 402 cap_too_low. |
ttft_max_ms |
If no first token arrives within this many milliseconds, the gateway aborts and the request is failed at charge 0. |
effective_from |
Unix seconds. Holds before this time get 402 schedule_mismatch; clients do not select the route yet. |
v, currency, unit, ack_timeout_ms, failure_billing |
Fixed in the MVP: 1, "USDC", "micro-USDC", 5000 (informational), "none". Any other value fails startup and verification. |
One USDC is 1,000,000 micro-USDC (µUSDC), so a rate in micro-USDC per million tokens is numerically the dollar price per million tokens times 10⁶: $0.60 per million input tokens is 600000. Every value is a JSON integer in [0, 2^53 − 1].
schedule_digest = SHA256(jcs(schedule)). Change any field and the digest changes; old Holds then fail with schedule_mismatch. To change prices, add a route with the new schedule and migrate buyers (listing).
The charge
For a request with usage in (total input, including cached), cached, outv and outh:
cached' = min(cached, in)
numerator = (in − cached')·r_input + cached'·r_cached + outv·r_output_visible + outh·r_output_hidden
charge = ceil(numerator / 1,000,000) + per_request_fee
- Arithmetic is integer with 128-bit intermediates; the result must fit in a u64. A charge that does not fit is recorded as
failedat 0. - Rounding happens once, on the sum, never per line.
- The receipt carries
min(charge, cap_micros). You absorb anything above the buyer's cap.
The receipt's status decides which terms apply (receipts):
| Status | Billed |
|---|---|
ok |
The full formula. |
cancelled |
Input terms plus per_request_fee; no output (decision 0003). |
failed, not_served, policy_unhonored |
0. |
Worked examples
All three use the schedule above.
An agent tool loop: 6,000 input tokens of which 4,800 are cached, 400 visible output tokens.
uncached input 1,200 × 600,000 = 720,000,000
cached input 4,800 × 150,000 = 720,000,000
visible output 400 × 1,800,000 = 720,000,000
numerator = 2,160,000,000
ceil(2,160,000,000 / 1,000,000) = 2,160; + 50 fee = 2,210 µUSDC (0.00221 USDC)
If the buyer disconnects after the first streamed byte, the receipt is cancelled: ceil(1,440,000,000 / 1,000,000) + 50 = 1,490 µUSDC. If its Hold capped the request at 2,000 µUSDC (the w_req_micros minimum), the ok receipt carries 2,000 and you absorb 210.
A reasoning step: 3,000 uncached input, 600 visible and 2,400 hidden output tokens.
3,000 × 600,000 + 600 × 1,800,000 + 2,400 × 1,800,000 = 7,200,000,000
7,200 + 50 = 7,250 µUSDC
Rounding once: 7 input tokens and 3 visible output tokens.
7 × 600,000 + 3 × 1,800,000 = 9,600,000 → ceil(9.6) = 10; + 50 = 60 µUSDC
Rounding each line separately would give ceil(4.2) + ceil(5.4) = 11, one micro-USDC more. The protocol forbids that.
The onboarding wizard shows the same breakdown live for your draft schedule, using the protocol's own computeCharge.
Choosing the numbers
w_req_microsis a reach decision. Agents often run under Mandates with aper_request_cap. A Hold cap above that cap gets 402cap_exceeds_limit, and a cap below yourw_req_microsgetscap_too_low, so an agent whose Mandate cap is below your minimum cannot call you at all and routes elsewhere. Set it high enough to cover a typical request so you rarely absorb overage, and low enough that the agents you want can afford a Hold. It should at least coverper_request_fee.ttft_max_msis a promise with teeth. A first token later than this isfailedand unbillable. Set it above your real p99 time to first token under full load.- Prices are compared on workloads, not rates. The SDK's planner compares routes by the charge for 1,024 input and 256 visible output tokens; the Markets board sorts by any single rate column. Price every rate deliberately.
- Usage comes from upstream. Input, cached and reasoning counts come from the upstream's usage report. The receipt marks them
usage_source: 0(upstream), or1(estimated) for a cancelled request with no upstream usage, where input is estimated at four prompt characters per token.