Pay per request (x402)

Pay for RPC calls in USDC on Base — no account, no API key. Built for AI agents and automated clients.

NodeFlare supports x402, the open HTTP payment protocol: pay for each RPC call in USDC on Base, Polygon or Arbitrum, with no account, no API key and no subscription. Designed for AI agents and automated clients that need chain data on demand.

Endpoint

POST https://rpc.nodeflare.app/{chain}/x402

All 22 chains are available — same slugs as the regular endpoints (eth, base, arb, robinhood, plasma, …). GET https://x402.nodeflare.app/ returns the machine-readable chain list.

All methods are includedeth_getLogs, trace_* and debug_* work here without any key, unlike the free public endpoint.

Pricing

Per-call prices follow our compute-unit weights at 1 CU = $0.00001, with a minimum of $0.001 per request:

CallPrice
Standard call (eth_blockNumber, eth_call, eth_getLogs, one trace_*)$0.001
Batch of 20 × eth_getLogs (1,500 CU)$0.015
Batch of 100 standard reads (≤100 CU)$0.001

Batches sum the CU of every call in the array. You only pay for requests that succeed — if our upstream fails, no payment is settled.

How it works

  1. POST your JSON-RPC body without payment → the response is 402 Payment Required with a base64-encoded challenge in the PAYMENT-REQUIRED header (price, network, receiving address).
  2. Your x402 client signs a USDC authorization and retries with the PAYMENT-SIGNATURE header.
  3. We verify, serve the RPC call from our own bare-metal nodes, and settle the payment on-chain. The settlement receipt (with the transaction hash) is returned in the PAYMENT-RESPONSE header.

Payment schemes

Every endpoint accepts two x402 schemes — use whichever your client supports:

  • exact (default) — a fixed USDC price per call, authorized with a one-shot EIP-3009 signature. No pre-approval needed; the quick start below uses it.
  • upto — authorize a ceiling once (a Permit2 approval) and then be settled the real per-request price, up to that max. Useful for agents that would rather not price every call ahead of time. Swap ExactEvmScheme for UptoEvmScheme from @x402/evm.

Both settle in USDC on Base, Polygon or Arbitrum.

Quick start

Terminal
npm install @x402/fetch @x402/evm viem
TypeScript
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

const res = await fetchWithPayment("https://rpc.nodeflare.app/base/x402", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_blockNumber", params: [] }),
});
console.log(await res.json()); // { jsonrpc: "2.0", id: 1, result: "0x..." }

The wallet only needs USDC on one of the payment networks (Base, Polygon or Arbitrum) — gas is handled by the payment facilitator.

Discovery for agents

NodeFlare's x402 endpoints are listed in the x402 Bazaar, Coinbase's catalog of paid services that AI agents can search and pay autonomously — including via its MCP server. We're among the first x402 RPC providers for chains like Robinhood Chain, Plasma, Ink and Zircuit.

Notes

  • Settlement happens before the response is returned, which adds roughly one Base block (~2 s) to the first paid call pattern. For latency-sensitive high-volume workloads, a free API key with monthly compute units is faster and cheaper.
  • Rate limits don't apply — the payment is the authorization. Body caps (256 KB, 100 calls per batch) still do.
  • WebSocket is not available over x402; use a keyed connection instead.

Questions? [email protected] or the Discord.