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

Payment timing

Exact Pricing

Before request

Flex

After usage, from escrow

Amount known?

Exact Pricing

Yes — hardcoded

Flex

No — determined by usage

On-chain frequency

Exact Pricing

Every request

Flex

Batched settlement

Client complexity

Exact Pricing

Low

Flex

Session key setup, then low

Best for

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.

01

Discovery

Client receives payment requirements and the facilitator's public key.

02

Account Creation

A dual-authorization escrow contract is created, requiring co-signatures from both parties.

Dual authorization required for every withdrawal
03

Funding

Tokens are deposited into the escrow. Supports multiple token types across networks.

04

Session Key

A session key is registered for signing authorizations — smart wallet compatible, no per-request key exposure.

Session key architecture — no per-request key exposure
05

Usage & Holds

Middleware places holds as resources are consumed. Client authorizes each hold via the session key.

Nonce-based replay protection on every transaction
06

Settlement

The facilitator batches settlements onchain with a configurable refund window for unused funds.

Deadman switch for guaranteed fund recovery

Start building
with Flex.

Flex is open-source and audited. Start with the docs, make a transaction, or dive into the code.