Skip to content

Free Mode and Paid Mode

How a self-hosted instance charges, or does not: part of Self-Hosting.

Free mode vs paid mode

  • FREE_MODE=true: every tool responds without payment. Good for development, internal deployments, or self-hosted agents that don't need metering. The PoW gate and x402 paywall are both disabled.
  • Without FREE_MODE: the x402 paywall activates. Callers pay per request (USDC on Base by default; add Solana, Polygon, Arbitrum One, Stellar, Algorand and the chains below with PAYMENT_NETWORKS, each with its own payTo / facilitator setting) or solve a proof-of-work challenge for pure-CPU tools. You need WALLET_ADDRESS, a facilitator (CDP_API_KEY_ID + CDP_API_KEY_SECRET, or FACILITATOR_URL), and POW_SECRET at minimum. To also accept USDC on Monad (EVM chain 143), add monad to PAYMENT_NETWORKS (settles via MONAD_FACILITATOR_URL, default a public Monad facilitator). Avalanche C-Chain (43114) and Sei (1329) are likewise opt-in via PAYMENT_NETWORKS (set PAYAI_API_KEY_ID + PAYAI_API_KEY_SECRET, the keys of the facilitator that settles them). OP Mainnet (10) is opt-in via PAYMENT_NETWORKS plus SOLVADOR_KEY (the key of the facilitator that settles it; NETWORK_PRICE_PREMIUMS, a CAIP-2 keyed CSV such as eip155:10=<usd>, adds a per-chain amount to that chain's quote if your facilitator charges per settlement). To also accept USDC on Celo (EVM chain 42220), add celo to PAYMENT_NETWORKS and set CELO_FACILITATOR_KEY (a self-service key minted at x402.celo.org; the facilitator's /settle requires it). Settles via CELO_FACILITATOR_URL, default the Celo-operated api.x402.celo.org. To accept USDG on Robinhood Chain, add robinhood to PAYMENT_NETWORKS and set ROBINHOOD_FACILITATOR_URL (one URL, or an ordered comma-separated list whose later entries are its settle fallback under PAYMENT_SETTLE_FALLBACK=true; FACILITATOR_GAS_CHECK=off and FACILITATOR_GAS_MIN_SETTLEMENTS tune the settlement-gas check; ROBINHOOD_RELAYER_KEY adds an optional settler you run yourself as the last fallback, see Robinhood-Chain). To accept USDC on Arc (EVM chain 5042), set CIRCLE_FACILITATOR_API_KEY (a Circle API key, optional): its presence is the switch, Arc then joins a multi-chain PAYMENT_NETWORKS list on its own, and it is offered only while Circle's facilitator /supported lists it. ARC_CONTRACT_WALLETS=on (optional, off by default) also accepts Arc payments signed by a contract wallet (ERC-1271, or ERC-6492 for one not yet deployed), verified on chain against the Arc RPC before Circle sees them; identity-bound routes (memory, attest, feedback, my-usage, receipts) still take an EOA signature only. With that key set, CIRCLE_FACILITATOR_EVM_FALLBACK=on (optional, off by default) also makes the same facilitator the last settle fallback on Base and Polygon under PAYMENT_SETTLE_FALLBACK=true: exact USDC only, tried once its /supported lists the chain, and only after every earlier settler refused before broadcasting. With more than one Robinhood facilitator listed, the first whose /supported confirms eip155:4663 at boot settles first and the rest stay fallbacks; a listed facilitator's HTTP 200 refusal that names no transaction and no verdict about the buyer goes to the next listed one. To accept USDC on Ink (EVM chain 57073, native Circle USDC), add ink to PAYMENT_NETWORKS and set INK_FACILITATOR_URL (one URL, or an ordered comma-separated list, read exactly like ROBINHOOD_FACILITATOR_URL: the first whose /supported confirms eip155:57073 at boot settles first, the rest are its settle fallback, and the settlement-gas check reads each one's signer). Without the URL an ink entry is not configured and every other chain is unaffected. Ink has no settler of your own (there is no relayer option for it) and no price floor by default (NETWORK_PRICE_FLOORS=eip155:57073=<usd> sets one; NETWORK_PRICE_PREMIUMS covers a facilitator that charges per settlement). See Ink (USDC). If the Robinhood or Ink facilitator you settle through publishes the settlements it relays, set FACILITATOR_PUBLIC_INDEX_CHAINS to robinhood, ink or both (any value it does not know is ignored with a boot warning): while a listed chain is offered, /privacy, /terms, /.well-known/x402, llms.txt and the chain's page disclose it, naming the facilitator each chain settles through first; a listed chain that is not offered renders nothing and is named in a boot warning. Optional: FACILITATOR_PUBLIC_INDEX_NAME (its display name), FACILITATOR_PUBLIC_INDEX_POLICY_URL (its privacy policy, an https URL) and FACILITATOR_PUBLIC_INDEX_SINCE (YYYY-MM-DD; the legal pages print the later of their own date and this one).

Circle Gateway batched option (optional): set GATEWAY_NANOPAYMENTS=on and the 402 on Arc and Base (GATEWAY_NANOPAYMENT_NETWORKS) also carries a second exact accept whose extra.name is GatewayWalletBatched, at the same price and to the same payTo. A network is offered only while it is in the plain offer and Circle Gateway's /v1/x402/supported lists its batched kind at boot (fail closed: an unreadable answer drops the option and nothing else). Gateway verifies and settles these payments off chain, keyless, and credits them to your Gateway balance, not to your wallet on chain: sales are booked with wire gateway-batched and Gateway's transfer id as their tx, and /revenue counts them from the sales ledger under that label. A payment Gateway leaves pending is answered 402 with Retry-After, kept in a pending book, and served on the buyer's resend of the same payment once Gateway confirms it; a resolver reads Gateway's record for each one every ten minutes and books one that settled and was never served as owed. Move the balance on chain with node scripts/gateway-withdraw.js (human-run, GATEWAY_SELLER_KEY in that shell only, never a server variable): it is a dry run that prints the plan unless you pass --execute, takes --from arc|base for the source domain (required with --amount), --to, --recipient (default your own address; another address must be one of your own wallets, WALLET_ADDRESS or OUR_WALLETS, unless you pass --allow-external-recipient, and the dry run says which; set OUR_WALLETS to your own comma-separated list, since unset it reads the hosted service's list) and --max-fee, and mints on the destination chain. The withdrawal's mint is not counted as revenue again. Status words on /api/gateway-status: gatewayBalance (off, unknown, ok, or withdraw once the balance reaches GATEWAY_WITHDRAW_ALERT_USD; the heartbeat and the status Worker open one issue on withdraw and close it on ok or off), gatewayPending (off, ok, pending, near_capacity, full, or unresolved for a payment pending past GATEWAY_PENDING_UNRESOLVED_HOURS) and, for every rail, buyerRefusals (refusing for a while after the settle breaker refused a wallet that had settled a call inside its window, ok otherwise; BUYER_REFUSAL_WINDOW_MS), lateSettlements (ok, near_capacity, full, or unresolved while a settlement whose outcome was not known when the call was answered waits for an operator or could not be recorded) and replayStore (ok, or pending while a settled payment's consumed mark waits to reach the shared store). Words only; the figures are on the operator endpoints.

MPP on the same 402: set MPP_SECRET_KEY and every paid route also answers WWW-Authenticate: Payment (the evm method settles through your existing facilitator); add TEMPO_API_KEY for native Tempo settlement. Cards: STRIPE_SECRET_KEY (+ STRIPE_WEBHOOK_SECRET) mounts the report checkout, monitors and prepaid credits; STRIPE_PROFILE_ID adds cards over MPP. Email: EMAIL_FROM plus ZEPTOMAIL_TOKEN or RESEND_API_KEY; without them the card pages still work and the report link is shown on the page.

See Paying with x402, Paying with MPP, Paying with Compute and Reports and Monitors for the buyer-side flows.

Data source terms travel with the server. The holiday tools read Nager.Date, used by the hosted service under a sponsorship it holds; a commercial self-host needs its own sponsorship. Read each source's terms before you sell its answers.