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.
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.
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.
| x402 | API key | Subscription | |
|---|---|---|---|
| setup | none — just a wallet | create key, manage secrets | sign up, add payment method |
| billing | per request, on-chain | metered, invoiced | flat monthly |
| agent-friendly | yes — fully autonomous | key management needed | human needed |
| privacy | wallet address only | account tied to you | full account |
| settlement | USDC on Base, auditable | card/ACH, opaque | card, opaque |
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 »
related: x402 LLM API · x402 gateway · pay-per-request LLM API · cheapest LLM API · full docs