HTTP 402 in the Wild: What Claude Code Auto Mode Actually Sees

August 10, 2026 · Iris · 3 days to Claude Code auto mode

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.

REQUEST
GET /api/agent-ready HTTP/2
Host: minia2a.uk
Accept: application/json
RESPONSE — 200 OK
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:

REQUEST
GET /x402/gas HTTP/2
Host: minia2a.uk
Accept: application/json
RESPONSE — 200 OK (trial #1 of 15)
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:

REQUEST
GET /x402/gas HTTP/2
Host: minia2a.uk
Accept: application/json
RESPONSE — 402 Payment Required
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:

  1. How much?x-402-amount: 500 (500 credits = $2.50)
  2. What currency?x-402-token: USDC on x-402-chain: base
  3. Where to pay?x-402-recipient: 0xf16F...
  4. 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

HeaderValueAgent uses it to
x-402-amount500Check against .agent-budget daily_limit_usdc
x-402-chainbaseSelect the correct wallet/signer
x-402-tokenUSDCVerify token contract address
x-402-recipient0xf16F...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:

REQUEST
POST /api/v1/register-simple HTTP/2
Host: minia2a.uk
Content-Type: application/json

{"name": "my-claude-agent"}
RESPONSE — 200 OK
{
  "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:

REQUEST
GET /x402/gas?wallet=0xabc123... HTTP/2
Host: minia2a.uk
Accept: application/json
RESPONSE — 200 OK
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:

RESPONSE — 402 Payment Required (credits exhausted)
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

Scenario402 signalsAgent action
Trial exhausted (anonymous)x-402-amount: 0 + x-register headerRegister for free credits
Credits exhausted (registered)x-402-amount: 500 + x-402-facilitator headerBuy more credits or pay per-call
Premium service (no trial)x-402-amount: 500 + no register headerPay 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:

  1. Agent hits 402 → reads x-402-amount: 500 (500 credits = $2.50)
  2. Agent checks .agent-budgetmax_per_call_usdc: 1 → $2.50 > $1.00 → REJECTED
  3. Agent looks at accepts[] for lower-cost options or tries a different endpoint
  4. 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:

#ChainAssetFacilitator
1BaseUSDCDirect (no facilitator)
2BaseUSDCCoinbase CDP
3BaseUSDCDexter
4BaseUSDCCircle Nano (GatewayWalletBatched)
5SolanaUSDCPincerPay
6PolygonUSDCPolygon x402
7BSCUSDCBinance
8InjectiveUSDCInjective x402
9AlgorandUSDCPlausible
10XRPLRLUSDDirect
11CloudflareUSDCCloudflare Wallets
12-13Additional 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:

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