Flex
Prepaid escrow for variable-cost payments.
Fund once. Pay for what you use. Flex handles the gap between fixed pricing and unpredictable costs with prepaid escrow accounts settled onchain.
The problem
Exact pricing doesn't work for variable-cost services
Resource servers either overcharge (bad for users) or undercharge (bad for operators). These services can't know the final cost before the request completes.
AI Inference
Token count is unknown before the request completes.
Data Transfer
Response size is unpredictable until delivery finishes.
Streaming & Metering
Costs accrue over time — the final bill depends on usage.
Comparison
Exact pricing vs. Flex
Exact Pricing
Before request
Flex
After usage, from escrow
Exact Pricing
Yes — hardcoded
Flex
No — determined by usage
Exact Pricing
Every request
Flex
Batched settlement
Exact Pricing
Low
Flex
Session key setup, then low
Exact Pricing
Static-cost APIs
Flex
Variable-cost services
Participants
Three roles, one flow.
Client
Requests resources and pays. Funds the escrow account and authorizes holds via session key.
Middleware
Gates access to the resource server. Generates payment requirements and places holds as resources are consumed.
Facilitator
Validates payments, batches onchain settlements, and manages the refund window. The verification authority of the system.
How it works
Fund once. Pay for what you use.
Discovery
Client receives payment requirements and the facilitator's public key.
Account Creation
A dual-authorization escrow contract is created, requiring co-signatures from both parties.
Funding
Tokens are deposited into the escrow. Supports multiple token types across networks.
Session Key
A session key is registered for signing authorizations — smart wallet compatible, no per-request key exposure.
Usage & Holds
Middleware places holds as resources are consumed. Client authorizes each hold via the session key.
Settlement
The facilitator batches settlements onchain with a configurable refund window for unused funds.
Start building
with Flex.
Flex is open-source and audited. Start with the docs, make a transaction, or dive into the code.