pay.sh docs
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

Aspectx402 uptoMPP session
Protocolx402MPP
Metered deliveries per channelonemany (streamed)
Buyer authorizesa ceiling (signs the channel open)a running total (signs a cumulative voucher per delivery)
Who signs settlementthe operator (one voucher)the buyer's vouchers; operator settles at close
Settlementonce, after the callonce, after the last delivery (idle-close)
Recipientssingle pay_tomulti-recipient splits (percentage)
Reuse / top-upno — open once, settle onceyes — topUp, plus a client force-close escape
Best forone call whose cost is known only after it runsstreaming (SSE) or many cheap calls in one session
CLI configendpoint 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 topUp mid-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 chargemetered pricing with mpp-charge or x402-exact: the buyer pays a known amount per request, settled immediately.
  • Recurring flat accesssubscriptions: one signup, recurring charges, free at the point of use within the period.

On this page