▸ __BREADCRUMB__ usage
new: genuinely free AI models are live — try surp/free + see live budgets · token-gating prototype · vote on SRP

what is x402?

man x402 | head -50

x402 is a payment protocol built on the HTTP 402 Payment Required status code. It lets any web API — including LLM APIs — charge per request using USDC on Base, with no account, no API key, and no subscription. The machine (or agent) pays as it goes.

the problem x402 solves

APIs today are gated by API keys, subscriptions, and credit-card billing. That breaks down for AI agents: an agent shouldn't need a human to sign up for a plan before making one request. x402 turns payment into a protocol handshake the agent can complete itself — the server responds 402, the client signs a USDC transfer, retries, and gets the answer. One request, one penny, done.

how x402 works — the handshake

POST /v1/chat/completions   ← no payment header
HTTP/2 402 Payment Required  ← server asks for USDC
  X-Payment-Requirements: <base64 price + pay-to + token>

POST /v1/chat/completions   ← retry with signed EIP-3009 auth
  X-Payment: <base64 signed transfer>
HTTP/2 200 OK               ← verified + settled, response streams back

That's the whole protocol. EIP-3009 (transferWithAuthorization) lets the client sign an off-chain transfer that a facilitator submits on-chain — the client doesn't even need gas for a transaction, just USDC.

why x402 is built for AI

  • Micropayments work — a request costs cents or fractions of a cent; no billing minimums, no Stripe fee floor.
  • Agents self-serve — no KYC, no signup, no API key provisioning. The wallet is the identity.
  • Settlement is transparent — every payment is an on-chain USDC transfer on Base, auditable by anyone.
  • No subscription lock-in — you pay for exactly what you use, per request.

x402 vs API keys vs subscriptions

x402API keySubscription
setupnone — just a walletcreate key, manage secretssign up, add payment method
billingper request, on-chainmetered, invoicedflat monthly
agent-friendlyyes — fully autonomouskey management neededhuman needed
privacywallet address onlyaccount tied to youfull account
settlementUSDC on Base, auditablecard/ACH, opaquecard, opaque

using x402 to pay for LLM inference

surp.ivc.lol is a working x402 LLM gateway: an OpenAI-compatible API where every request is paid with x402. You send surp/best-chat as the model, get a 402 with the exact USDC price, sign it with your wallet, and the cheapest model on the marketplace answers. Read more about the x402 LLM API »

faq

What does x402 stand for?

x402 refers to HTTP status code 402 (Payment Required). The "x" marks it as an extension of the code into a full payment protocol.

What network does x402 settle on?

Most x402 implementations settle USDC on Base (EIP-3009 transfers), with Solana, Polygon, and other chains supported by various facilitators.

Do I need a crypto wallet to use x402?

Yes — the wallet holds USDC and signs the per-request authorization. There's no account, KYC, or API key, just the wallet.

Can I use an x402 API with normal code?

Yes. x402 client libraries for Python, TypeScript, and JavaScript handle the 402 → sign → retry loop automatically, so your code just makes a normal HTTP request.

related: x402 LLM API · x402 gateway · pay-per-request LLM API · cheapest LLM API · full docs