The five-message handshake
- Request. The agent calls
GET /api/geocodelike any HTTP client — no API key, no signup. - 402 response. The server replies
402 Payment Requiredwith a payload: price ($0.01), asset (USDC), network, and the address to pay. - Signed authorization. The agent's wallet signs an
X-PAYMENTheader authorizing exactly that amount — a signature, not a broadcast transaction. - Verification & settlement. The server (or a facilitator service) verifies the signature and settles on-chain. USDC on a fast L2 finalizes in ~2 seconds for a fraction of a cent in fees.
- 200 OK. The original response is returned with the data. Total added latency: typically under a few seconds.
Why not just credit cards?
Card rails charge roughly $0.30 + 2.9% per transaction. On a $0.01 API call, fees would be 3,000% of the price. Stablecoin micropayments make per-call pricing viable:
• $0.01 call via card ≈ $0.31 total → 31× the price
• $0.01 call via x402 on an L2 ≈ $0.0102 total → 1.02× the price
That 30× gap is why agents "paying for themselves" only works with machine-native payment rails. It also removes the human bottleneck: no checkout page, no card on file, no monthly invoice — the agent discovers a tool, pays, and moves on.
Budget math for autonomous agents
Use the price slider above. At p dollars per call and n calls per day, monthly spend is p × n × 30. A research agent making 1,000 calls/day at $0.01 spends about $300/month — comparable to a SaaS seat, but pay-per-use with a hard wallet cap. Sensible guardrails: per-transaction ceiling, daily budget, and an allowlist of payees.