Building with payPayment channels
upto vs sessions
Both are payment channels — pick upto for one metered call, sessions for a stream of many deliveries. The full comparison and when to use which.
Both upto and sessions are payment channels: deposit a ceiling, meter off-chain, settle the actual amount, refund the rest. The difference is how many deliveries one channel meters.
The rule: one metered call →
upto; a stream of many deliveries →session.
Side by side
| Aspect | x402 upto | MPP session |
|---|---|---|
| Protocol | x402 | MPP |
| Metered deliveries per channel | one | many (streamed) |
| Buyer authorizes | a ceiling (signs the channel open) | a running total (signs a cumulative voucher per delivery) |
| Who signs settlement | the operator (one voucher) | the buyer's vouchers; operator settles at close |
| Settlement | once, after the call | once, after the last delivery (idle-close) |
| Recipients | single pay_to | multi-recipient splits (percentage) |
| Reuse / top-up | no — open once, settle once | yes — topUp, plus a client force-close escape |
| Best for | one call whose cost is known only after it runs | streaming (SSE) or many cheap calls in one session |
| CLI config | endpoint schemes: [x402-upto] (+ min_usd) | top-level session: block + endpoint schemes: [mpp-session] |
When to pick upto
- A single request whose price you can only compute after the work — LLM tokens, per-byte, per-second compute.
- You want the simplest channel: one authorization, one settlement, automatic refund.
- A single recipient is fine (no splits across parties).
See Usage charges.
When to pick a session
- You're streaming — a token-by-token SSE response metered per chunk.
- A client makes many cheap calls you'd rather not open a channel for each time.
- You need to split the settled total across recipients, or let buyers
topUpmid-session.
See Streaming sessions.
When you need neither
Payment channels earn their keep when the amount is uncertain or metered over time. If the price is fixed and known up front, a one-shot charge is simpler:
- Fixed per-call charge — metered pricing with
mpp-chargeorx402-exact: the buyer pays a known amount per request, settled immediately. - Recurring flat access — subscriptions: one signup, recurring charges, free at the point of use within the period.