x402 vs API keys for AI agents: which should your agent use?
Updated 2026-10-22
API keys suit a developer who signs up once and calls the same provider all month. x402 suits an AI agent that finds an API at run time and has to pay for a single call with no account. Many teams end up using both. This guide compares them point by point and shows the numbers from our own checks of 309 x402 listings.
How each one works
API key: you create an account, get a secret key, and send it with every request (usually an Authorization header). The provider bills the account by plan or usage.
x402: the client calls the API with no credentials. The server answers HTTP 402 Payment Required with its price, the recipient address and the payment options it accepts. The client signs a payment and repeats the request with the payment attached. A facilitator verifies and settles it, and the server returns the result (Coinbase’s x402 docs describe the full flow). In x402 version 2, the terms come in a base64 JSON PAYMENT-REQUIRED header and the retry carries a PAYMENT-SIGNATURE header. Version 1 used a JSON body and X-PAYMENT. New to it? Start with what is x402.
Side by side
| API key | x402 | |
|---|---|---|
| Getting access | Sign up, verify an email, often add a card, then create and store a key. | No account. The first request returns the price; the agent pays and retries. |
| What the agent holds | A long-lived secret per provider. | A wallet (or a signer with a spending limit). One wallet works with every x402 API. |
| Billing unit | Monthly plan, prepaid credits or invoiced usage. | Each request, priced in the 402 response, usually in USDC. |
| Smallest practical payment | Set by the plan; tiny one-off purchases are rarely possible. | Fractions of a cent. Most APIs we probed charge under $0.05 per call. |
| Spending control | Plan limits and dashboards, per provider. | The client decides per request; most x402 clients cap the amount per payment. |
| If the credential leaks | Anyone can spend your quota until you rotate the key. | There is no reusable key. Each payment authorization covers one amount for one recipient. |
| Extra round trip | None once the key is set. | The first call to a route returns 402, so paying adds one request. |
| Refunds and disputes | Card chargebacks and provider support. | On-chain payments are final. Good servers settle only after a successful response. |
| Discovery | Docs and a signup page per provider. | The 402 itself describes the price; directories list x402 endpoints. |
What x402 calls actually cost
We sent an unpaid request to each x402 listing’s paid endpoint and read the price from the 402 response. Of 275 APIs with a probe-checked price, 150 start under one cent per call. The full breakdown by price band and category is in x402 API prices per call. Prices that small are hard to sell under an API-key plan, which is the main reason pay-per-call APIs for agents use x402.
When to use which
- Use an API key when a person sets up the integration once, the volume is steady and high, you want invoices and card payments, or you need support and refunds.
- Use x402 when an agent picks tools at run time, calls are occasional or spread across many providers, you don’t want to store a secret per provider, or you want each call priced and paid on its own.
- Use both when you sell an API. Keep keys for existing customers and add an x402 route for agents. See how to accept USDC for your API.
APIs that offer both
These listings’ own sites offer an API key as well as x402 payment (A to Z). Prices are from our 402 probes.
| Tool | Protocol | Networks | Tokens | Price / call | Verified |
|---|---|---|---|---|---|
| Arkham | x402 | Base, Solana | USDC | $0.2–$8 | 2026-10-22 |
| OneSource | x402 | Base | USDC | $0.003–$0.05 | 2026-10-22 |
| Relaystation | x402 | Base | USDC, EURC | $0.01 | 2026-10-22 |
| Skim | x402 | Base | USDC | $0.002–$0.005 | 2026-10-22 |
| Zerion API | x402 | Base, Solana | USDC | $0.01 | 2026-10-22 |
A middle way is prepaid credits bought over x402: one on-chain payment, then calls with a key and no payment per call. We run one for our own tools (disclosed: prepaid credits for x402 agent APIs).
Safety tips for agents that pay
- Set a per-payment and a daily cap in your x402 client. Many default to $1 or less per payment.
- Check the price and recipient in the 402 before signing, and don’t pay a route that looks wrong.
- Prefer servers that settle only after a successful response, so failed calls aren’t charged.
- Keep the paying wallet separate from your treasury, with only what the agent needs. Step by step: how to pay for an API with USDC via x402.
Find x402 APIs
Browse the best x402 APIs (A to Z, with probe-checked prices), or by task in best x402 APIs for AI agents. Protocols beyond x402 are compared in AI agent payment protocols compared.