HTTP 402 in the Wild: What Claude Code Auto Mode Actually Sees
On August 14, Claude Code auto mode goes default. Millions of coding agents will encounter HTTP 402 Payment Required for the first time. Here is exactly what they'll see — raw HTTP, no marketing, every header and JSON field an autonomous agent must parse to complete a purchase.
All traces below are live, reproduced with curl against a real x402 endpoint. You can run every command yourself.
Step 0: The handshake
Before an agent makes any paid call, it needs to know: can I use this platform? Every auto-mode agent should start here.
GET /api/agent-ready HTTP/2 Host: minia2a.uk Accept: application/json
content-type: application/json; charset=utf-8
{
"status": "ready",
"protocols": ["x402", "mcp"],
"payment": {
"chain": "base",
"token": "USDC",
"protocol": "x402"
},
"registration": {
"endpoint": "POST /api/v1/register-simple",
"body": { "name": "string - your agent name" },
"quickstart": "curl -X POST https://minia2a.uk/api/v1/register-simple ..."
},
"trial": {
"anonymous": "15 free calls per IP — no registration, no wallet",
"registered": "500 free credits (~.50 value)"
},
"auto_mode": {
"budget_file": ".agent-budget",
"budget_format": "{daily_limit_usdc:5, max_per_call_usdc:1}",
"headers": ["x-402-amount","x-402-chain","x-402-token",
"x-402-recipient","x-credits-required"]
},
"services": 306
}
What the agent learns: this platform speaks x402, payments are USDC on Base, registration is one command, anonymous trial available, and the .agent-budget format is supported. One GET request. Zero docs to scrape.
Step 1: The first API call (anonymous, with trial credits)
An agent that hasn't registered yet gets 15 free calls per IP. Here's what call #1 looks like:
GET /x402/gas HTTP/2 Host: minia2a.uk Accept: application/json
content-type: application/json; charset=utf-8
{
"ok": true,
"gas": {
"baseFee": "12.5 gwei",
"fast": 15,
"instant": 20,
"timestamp": "2026-08-10T21:08:43.022Z"
},
"_trial": {
"remaining": 14,
"max": 15,
"registerHint": "POST /api/v1/register-simple {name}"
}
}
The _trial field is machine-parseable: remaining counts down, registerHint tells the agent exactly what to do when trials run out. No HTML to scrape. No "sign up" button to find.
Step 2: Trial exhausted — the 402 wall
After 15 calls from the same IP, the agent hits the payment wall. This is the moment that determines whether the agent gives up or becomes a paying user:
GET /x402/gas HTTP/2 Host: minia2a.uk Accept: application/json
HTTP/2 402 Payment Required
content-type: application/json; charset=utf-8
x-402-amount: 500
x-402-chain: base
x-402-token: USDC
x-402-recipient: 0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA
x-credits-required: 1000
x-register: POST /api/v1/register-simple {name}
{
"x402Version": 2,
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "5000000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA",
"resource": "https://minia2a.uk/x402/gas",
"description": "Multi-chain gas price oracle",
"mimeType": "application/json",
"maxTimeoutSeconds": 120
}
// ... 12 more payment options across 8 chains
],
"register": {
"url": "https://minia2a.uk/register.html",
"description": "FREE: Register for 500 credits"
},
"registerHint": "POST /api/v1/register-simple {name} — auto-wallet, 500 free credits",
"trialHint": "Register for 500 free credits ($2.50 value). 1 credit = $0.005"
}
This is the critical moment. An auto-mode agent reading this response must answer four questions:
- How much? →
x-402-amount: 500(500 credits = $2.50) - What currency? →
x-402-token: USDConx-402-chain: base - Where to pay? →
x-402-recipient: 0xf16F... - Can I register for free credits instead? →
x-register: POST /api/v1/register-simple
If any of these four headers is missing, the agent stops. It has no human to ask. The request fails silently, and the developer never knows what their agent could have accomplished.
⚡ The 4 mandatory 402 headers for auto mode
| Header | Value | Agent uses it to |
|---|---|---|
x-402-amount | 500 | Check against .agent-budget daily_limit_usdc |
x-402-chain | base | Select the correct wallet/signer |
x-402-token | USDC | Verify token contract address |
x-402-recipient | 0xf16F... | Construct the payment transaction |
x-credits-required is a bonus: it tells the agent the per-call credit cost, so it can estimate how many calls a credit balance buys.
Step 3: Registration — one command
The agent reads x-register, follows the instruction:
POST /api/v1/register-simple HTTP/2
Host: minia2a.uk
Content-Type: application/json
{"name": "my-claude-agent"}
{
"ok": true,
"wallet": "0x...",
"credits": 500,
"message": "500 free credits granted. Add ?wallet=0x..."
}
Registration returns a wallet address and 500 credits. No signature. No KYC. No gas fee. The agent now has a persistent identity and a credit balance it can spend across any of the 306 endpoints.
Step 4: Spending credits
With a wallet, the agent appends ?wallet=0x... to any endpoint:
GET /x402/gas?wallet=0xabc123... HTTP/2 Host: minia2a.uk Accept: application/json
x-credits-remaining: 499
{
"ok": true,
"gas": { "baseFee": "12.5 gwei", "fast": 15, "instant": 20 },
"credits_remaining": 499
}
credits_remaining appears at the top level of every response — the agent always knows how much budget is left without making a separate API call.
Step 5: Credits exhausted — the real payment moment
When credits run out, the 402 comes back — but this time it's a payment request, not a registration prompt:
HTTP/2 402 Payment Required
x-402-amount: 500
x-402-chain: base
x-402-token: USDC
x-402-recipient: 0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA
x-402-facilitator: https://api.cdp.coinbase.com/platform/v2/x402
{
"x402Version": 2,
"accepts": [ /* 13 payment paths across 8 chains */ ],
"credits": {
"buyApi": "POST /api/v1/buy-credits",
"rate": "1 USDC = 200 credits",
"amounts": [
{"usdc": 1, "credits": 200},
{"usdc": 5, "credits": 1000},
{"usdc": 10, "credits": 2000}
]
}
}
The difference from Step 2: no registration prompt, payment instructions instead. The agent knows it's already registered. It needs to buy credits. The 402 tells it exactly how.
Two kinds of 402 — the agent must distinguish them
| Scenario | 402 signals | Agent action |
|---|---|---|
| Trial exhausted (anonymous) | x-402-amount: 0 + x-register header | Register for free credits |
| Credits exhausted (registered) | x-402-amount: 500 + x-402-facilitator header | Buy more credits or pay per-call |
| Premium service (no trial) | x-402-amount: 500 + no register header | Pay per-call via facilitator |
The .agent-budget integration
With a .agent-budget file in the project root:
{
"daily_limit_usdc": 5,
"max_per_call_usdc": 1
}
An auto-mode agent can make autonomous payment decisions:
- Agent hits 402 → reads
x-402-amount: 500(500 credits = $2.50) - Agent checks
.agent-budget→max_per_call_usdc: 1→ $2.50 > $1.00 → REJECTED - Agent looks at
accepts[]for lower-cost options or tries a different endpoint - OR: agent registers for 500 free credits → cost is $0 → within budget → proceed
Without .agent-budget, the agent either: (a) refuses all payments, (b) asks the human for every transaction, or (c) spends without limits. .agent-budget gives the agent a middle path: spend autonomously, within declared limits.
The 13 payment paths in one 402 response
This is what differentiates a production 402 from a proof-of-concept. The accepts[] array in the live response contains 13 payment paths:
| # | Chain | Asset | Facilitator |
|---|---|---|---|
| 1 | Base | USDC | Direct (no facilitator) |
| 2 | Base | USDC | Coinbase CDP |
| 3 | Base | USDC | Dexter |
| 4 | Base | USDC | Circle Nano (GatewayWalletBatched) |
| 5 | Solana | USDC | PincerPay |
| 6 | Polygon | USDC | Polygon x402 |
| 7 | BSC | USDC | Binance |
| 8 | Injective | USDC | Injective x402 |
| 9 | Algorand | USDC | Plausible |
| 10 | XRPL | RLUSD | Direct |
| 11 | Cloudflare | USDC | Cloudflare Wallets |
| 12-13 | Additional Base paths (v1 compat, alternate routing) | ||
An agent with a Solana wallet picks path #5. An agent with a Cloudflare Wallet picks path #11. An agent using Coinbase picks path #2. The 402 response is a menu, not a single price tag — and the agent picks the cheapest path it can access.
The checklist for your own API
If you run an API that agents might call after August 14, here's what your 402 response needs:
- x-402-amount header — integer, smallest unit (cents or wei-equivalent)
- x-402-chain header — chain identifier the agent can resolve
- x-402-token header — token symbol or contract address
- x-402-recipient header — payment destination address
- JSON body with
x402Versionandaccepts[]array - Registration path — machine-parseable (header or JSON field)
- Trial path — anonymous access with clear remaining count
- Content-Type: application/json — not HTML
Test your endpoint in 30 seconds:
curl -s https://minia2a.uk/auto-mode-validator.html
3 days to auto mode. Make sure your 402 speaks machine.
Test your endpoint →
All traces reproduced live against minia2a.uk/x402/gas on August 10, 2026. Run them yourself — the 402 response is public and deterministic. Stats: 306 services, 14,750 trials, 63 registered wallets, 14 paid transactions. /api/agent-ready for machine-readable platform discovery.
Tags: HTTP 402, x402 protocol, Claude Code auto mode, agent payments, .agent-budget, machine-readable payments, USDC, Base