Skip to content

Payments ​

An integration can price an operation with x402, which fits the free GET / and paid POST / split: discovery is free and the resource is paid. Pricing is opt-in and lives in the integration's code. An Airnode that names no price for an operation serves it free, so nothing on this page changes a free Airnode.

The Airnode verifies a payment before it calls the upstream, and settles it once the upstream answers with a 2xx. A call the upstream refuses or never answers costs nothing. The Airnode charges a call the upstream answers even when it cannot serve the answer, such as a projection pointer the response does not have or a response over the size cap, since the upstream ran the call. All three ways to price an operation follow this order.

Three ways to price an operation ​

1. Flat2. Counted from the request3. Metered after the call
GET / lists itpricesunitPricesmeteredPrices
x402 schemeexactexactupto
The 402 asksthe priceprice per unit × unitsa ceiling
Chargedthe pricewhat the 402 askswhat the call cost, up to a ceiling
ExampleFrankfurterThe Odds APIOpenRouter

The Airnode knows the first two prices before it calls the upstream. Only the upstream's response says what a metered call cost, so the caller authorizes a ceiling and the Airnode settles that cost. Paying for a call shows both. The section of x-airnode.payment that lists an operation says how the Airnode sets its price. The 402 says how to pay it.

Each operation in GET / also states its own price as x-airnode-price.

1. Flat ​

An operation that costs the same whatever the call asks has one price per call. Frankfurter charges $0.01 for getRates and getRate, and GET / publishes them under x-airnode.payment.prices:

json
{
  "prices": {
    "getRates": "0.01",
    "getRate": "0.01"
  }
}

2. Counted from the request ​

Some upstreams charge by what a call asks for: a quota spent per market per region, one record per day of a range. An operation over one of these has a price per unit, under x-airnode.payment.unitPrices in place of prices:

json
{
  "unitPrices": {
    "odds": {
      "usdPerUnit": "0.025",
      "unitsPerCall": "1 per market per region"
    }
  }
}

The Airnode counts the units from the call's parameters before it calls the upstream. The 402 asks for the price of one unit times that count. markets=h2h,spreads and regions=us make 2 units, so amount is 50000 in a token with 6 decimals. The count is the same through POST / and the passthrough, so the 402 of an unpaid call is the exact price of that call. Asking for it costs nothing. A call whose parameters do not give a count is a 400.

unitsPerCall is for a person or an agent to read. The document publishes no rule a client could count with, so the 402 is the only source of what one call costs.

3. Metered after the call ​

Some upstreams bill by what the answer turned out to be: OpenRouter charges for the tokens a model reads and writes, which nobody knows before the model runs. An operation over one of these has a metered price, under x-airnode.payment.meteredPrices:

json
{
  "meteredPrices": {
    "chatCompletion": {
      "description": "the model's price for the tokens it read and wrote, as OpenRouter charges it"
    }
  }
}

The 402 asks for a ceiling under x402's upto scheme, the most the call can cost. The integration computes it from the call's parameters, for OpenRouter from the chosen model's prices, the size of the messages and the output cap, max_tokens or max_completion_tokens. Once the upstream answers, the Airnode reads what the call cost from the response and settles that amount, up to the ceiling.

The Airnode rounds the ceiling and the cost up to the smallest unit of the token. A cost the Airnode cannot read settles the whole ceiling, since the upstream charged for the call either way. A call whose parameters give no ceiling is a 400. An entry carries maxUsd as well when the integration fixes one ceiling for every call.

Paying for a call ​

A priced operation answers an unpaid POST / with 402. The payment requirements are in the PAYMENT-REQUIRED header, base64-encoded, as x402 v2 puts them. The body is {"error":"Payment required"}. An unpaid getRates on Frankfurter gets a header that decodes to:

json
{
  "x402Version": 2,
  "error": "Payment required",
  "resource": {
    "url": "https://airnodes.api3.org/frankfurter/",
    "description": "AirnodeHub operation \"getRates\"",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:84532",
      "amount": "10000",
      "asset": "0xbeA34973e5f67F18F656A2C6070C64326C791808",
      "payTo": "0x1505FD562AC2Fb4307B85BC6c672FfeafB4d57A7",
      "maxTimeoutSeconds": 300,
      "extra": {
        "name": "AirnodeHub USD",
        "version": "1"
      }
    }
  ]
}

The caller signs an EIP-3009 transferWithAuthorization matching one entry, puts it in an x402 payment payload with that entry as accepted, and retries with the payload, base64-encoded, in the PAYMENT-SIGNATURE header. A header that does not decode to a payment payload is a 400. The Airnode has a facilitator verify the authorization, performs the operation, then has the facilitator settle it on-chain, and returns the attestation with the settlement receipt in the PAYMENT-RESPONSE header. A payment that does not verify or does not settle is a 402 with fresh requirements, and a failed settlement also carries its receipt. The Airnode never touches the chain itself: an x402 facilitator does the verifying and submitting and pays the gas.

accepts has one entry for each network and token that the Airnode takes payment in, as its integration names them. The caller picks the entry it pays with. Prices are in dollars, and every token is a USD stablecoin. Each entry's amount is the price in the smallest unit of that token. The GET / document lists the same networks and tokens under x-airnode.payment.accepts, each with its symbol and decimals.

Prices are per operation: an unpaid POST / reads the requested operation from the body and returns requirements for that call, so the single shared POST / URL is not a limitation. The passthrough answers an unpaid request with the same 402 and the same requirements.

Paying a metered call ​

A metered operation's 402 names upto, and its amount is the ceiling. An OpenRouter chat completion on deepseek/deepseek-v4-flash with max_tokens at 256 asks for at most 53 units, $0.000053:

json
{
  "scheme": "upto",
  "network": "eip155:84532",
  "amount": "53",
  "asset": "0xbeA34973e5f67F18F656A2C6070C64326C791808",
  "payTo": "0x1505FD562AC2Fb4307B85BC6c672FfeafB4d57A7",
  "maxTimeoutSeconds": 300,
  "extra": {
    "name": "AirnodeHub USD",
    "version": "1",
    "assetTransferMethod": "permit2",
    "facilitatorAddress": "0xd407e409E34E0b9afb99EcCeb609bDbcD5e7f1bf"
  }
}

The caller signs a Permit2 witness transfer of up to the ceiling, as the upto scheme on EVM describes. The transfer names x402's upto proxy as the spender, and the payee and the facilitator in extra in its witness, so no other party can settle it. It travels as permit2Authorization in the payment payload, in place of the EIP-3009 authorization.

Permit2 can spend only what the caller's token allowance gives it. When that allowance is short of the ceiling, the caller also signs an EIP-2612 permit that sets it to exactly the ceiling. The caller sends the permit under extensions.eip2612GasSponsoring in the payment payload, and the facilitator submits it with the settlement. The 402 declares that extension when the facilitator takes it, and the caller then needs no gas.

The receipt in PAYMENT-RESPONSE carries amount, what the Airnode charged the call in the token's smallest unit. A call that cost nothing settles 0 with no transaction.

Choosing a facilitator ​

The integration names a facilitator next to the address that gets paid, and the facilitator has to settle on every network in accepts. A metered operation also needs one that settles upto there. The Airnode reads the facilitator's /supported when it starts, and does not start without it. The x402 docs list facilitators. There is no default, so an Airnode is never left charging callers through a facilitator nobody chose.