upto scheme lets a seller advertise a maximum price for one request, then settle for the actual amount used. The buyer signs once for the maximum, and the server chooses a final amount that is less than or equal to that maximum.
Use upto for one-request usage metering, such as LLM token generation, bandwidth, compute time, or dynamic data queries.
Server Setup
Set the routeprice to the maximum authorized amount. In the handler, use settlement overrides to charge the actual amount.
- TypeScript
- Go
- Python
Client Setup
RegisterUptoEvmScheme alongside ExactEvmScheme if your client may call both fixed-price and usage-based EVM resources.
- TypeScript
- Go
- Python
Settlement Override Formats
amount can be expressed as:
| Format | Example | Meaning |
|---|---|---|
| Raw atomic units | "50000" | Settle exactly 50,000 token base units |
| Percentage | "50%" | Settle 50% of the route maximum |
| Dollar price | "$0.05" | Convert a dollar-denominated route price to base units |
"0" means no charge for that request.
EVM Implementation
upto uses Permit2 because the settled amount is not known when the buyer signs. The facilitator advertises a facilitatorAddress in the payment requirements, and the client binds the authorization to that facilitator.