AI agents
How AI agents buy data: x402 without API keys
An autonomous agent cannot fill in a signup form, wait for an email and paste a key. x402 replaces that with an HTTP 402 challenge: the price is in the response, the payment is in USDC, and the retry is the purchase. This page explains the flow and the checks that keep an agent from overpaying.
Updated 19 November 2026.
Short answer: An agent buys data over x402 by calling the URL, receiving a 402 with the price, paying in USDC on the named chain and retrying with the payment header — no account and no API key.
The API key problem
A key assumes a human: an account, a card, a KYC step, a dashboard and a rotation policy. For an agent that runs for minutes, the setup costs more than the data, and the key becomes a secret to leak.
The alternative is payment at the request: the server names a price, the caller pays it, and the same request returns the data. No account, no key, no subscription to cancel.
The 402 flow in four steps
Every x402 call is the same shape, whichever seller answers:
- The agent calls the URL and gets HTTP 402 with an accepts array: scheme, network, asset, amount and payTo.
- The agent (or its wallet) pays the exact amount in USDC on the named chain.
- The agent retries the same request with the payment header.
- The seller verifies the settlement and returns the data, with the price it charged.
What to check before an agent pays
A 402 challenge is not a trust signal by itself. Cheap checks catch most of the damage: the payTo must match the published manifest, the price must be the one advertised, the chain and asset must be the expected ones, and the agent needs a hard daily cap so a loop cannot drain the wallet.
Read the manifest before the first call, not after. A manifest that disagrees with the live challenge is a reason to stop.
How GTXAgent sells to agents
The manifest at /.well-known/x402 lists every route with its price, network and payTo, and /pricing.md states the same in prose. Calls settle in USDC on Base with no account. An agent that prefers a familiar interface can use the hosted MCP bridge with a tenant key and a default $5 daily cap, or the local bridge that pays from its own wallet.
Start with the manifest; it is the authoritative list.
Related
- AI trading assistant: what it can and cannot do — ai trading
- Tokenized stocks on Base: registry, Aave V4 and what to check — stocks
- What onchain data can and cannot prove — blockchain
- Crypto market data for agents: what a paid API should return — crypto
- How to choose a crypto AI assistant (2026) — crypto
- How to choose an AI trading assistant — ai trading
- GTXAgent vs TokenSniffer for a token check — comparison
- Nansen alternative: analytics platform or pay-per-answer assistant — comparison
Questions
Does an agent need its own wallet?
For the direct x402 route, yes: a Base wallet with USDC, or a buyer service that signs for it. The hosted MCP bridge avoids the wallet by charging a prepaid tenant balance instead.
What stops an agent from spending without limit?
The cap has to be enforced by the caller. GTXAgent publishes the per-call price and caps the hosted MCP key at $5 per day by default; a local buyer should keep its own daily ceiling.