Claude Code Auto Mode: 5-Minute Agent Payment Setup (Before Aug 14)

August 10, 2026 · Iris · Practical Tutorial

In four days, Claude Code ships auto mode as default for all Pro, Max, and Team users. When your agent encounters an HTTP 402 paywall autonomously, it needs to know: how much does this cost, can I afford it, and where do I send the money?

This tutorial gets your agent ready in 5 minutes. No API keys. No signup form. Just a config file and a working payment flow.

What You're Building

The end state: your Claude Code agent discovers an API it needs, tests it for free, and when trials run out, decides autonomously whether to pay — all without you clicking "approve."

It works because of three things:

  1. A .agent-budget file that tells the agent your spending limits
  2. HTTP 402 response headers that tell the agent the price and payment method
  3. A marketplace that lets agents test endpoints before paying

Step 1: Create Your .agent-budget File

Time: 30 seconds. Create a JSON file in your home directory that declares your agent's spending limits.
mkdir -p ~/.claude
cat > ~/.agent-budget << 'EOF'
{
  "daily_limit_usdc": 5.00,
  "max_per_call_usdc": 1.00,
  "default_facilitator": "coinbase-cdp",
  "approved_counterparties": ["*"],
  "require_receipt": true,
  "version": 1
}
EOF

Your agent now knows: spend up to $5/day, never more than $1 per call, always collect a receipt. In auto mode, any API call under $1 that fits within the daily cap is auto-approved. No permission prompt. No context switch.

The format is intentionally simple — any framework can parse a JSON file in an afternoon. If your agent framework doesn't natively read .agent-budget yet, add this to your CLAUDE.md:

Before making any paid API call: read ~/.agent-budget.
If call amount ≤ max_per_call_usdc AND day's running total + call ≤ daily_limit_usdc: auto-approve.
Otherwise: ask me.

Step 2: Discover an Endpoint Worth Paying For

Time: 60 seconds. Your agent browses the marketplace, finds an API, and tests it for free.

Every endpoint in the marketplace offers free trials. No wallet, no registration, no commitment. Your agent can call any of 317 APIs right now:

# Try the gas price oracle — useful for DeFi agents
curl -s https://minia2a.uk/x402/gas | jq

# Returns: { "ok": true, "gas": { "baseFee": "12.5 gwei", "fast": 15, "instant": 20 } }

# Check response headers for trial info
curl -sI https://minia2a.uk/x402/gas | grep x-anon
# x-anon-trial-remaining: 14
# x-anon-trial-max: 15

The trial counter tells your agent exactly how many free calls remain. When it hits zero, the endpoint returns HTTP 402.

Step 3: See What Happens When Trials Run Out

Time: 30 seconds. Simulate trial exhaustion with a probe request to see the machine-readable payment instructions.
curl -sI "https://minia2a.uk/x402/gas?probe=1"

# Look at the payment headers:
# x-402-amount: 500          → 500 = 5.00 USDC (cents)
# x-402-chain: base          → Base L2
# x-402-token: USDC          → USDC stablecoin
# x-402-recipient: 0xf16F... → payment destination
# www-authenticate: Payment id="...", method="intent=charge"
This is the key. In auto mode, your agent reads these headers, compares the amount against .agent-budget, and decides: $0.05 ≤ $1.00 max per call, $0.05 + $0.00 today ≤ $5.00 daily limit → auto-approve. No human needed. No permission prompt. The agent pays, gets the result, and continues its task.

Step 4: Register a Wallet (One-Time)

Time: 90 seconds. One API call creates a wallet, provisions 500 free credits, and returns your address. No signature. No browser. No human.
curl -s -X POST https://minia2a.uk/api/v1/register-simple \
  -H "Content-Type: application/json" \
  -d '{"name": "my-claude-agent"}' | jq

# Returns: { "wallet": "0x...", "credits": 500, "message": "..." }

Save the wallet address. Now your agent has 500 credits to spend across any endpoint. Each credit = one API call (priced per endpoint, typically 1-5 credits).

Step 5: Pay for a Call With Credits

Time: 30 seconds. Use your wallet to call any endpoint beyond the free trial limit.
# With wallet: credits are deducted automatically
curl -s "https://minia2a.uk/x402/gas?wallet=0xYOUR_WALLET" | jq

# Check remaining credits
curl -s "https://minia2a.uk/x402/gas?wallet=0xYOUR_WALLET" -I | grep x-credits
# x-credits-remaining: 495
What your agent should do in production: when x-credits-remaining drops below 10, send a USDC top-up to the wallet address. The credits auto-replenish on-chain. Your agent never runs dry mid-task.

The Full Auto-Mode Flow

Here's what the end-to-end flow looks like for your agent starting Aug 14:

Agent: "I need the current Ethereum gas price."
  → GET https://minia2a.uk/x402/gas
  ← 200 OK (trial call #1, x-anon-trial-remaining: 14)

Agent: *uses the data, continues working*

...15 calls later...

Agent: "I need the gas price again."
  → GET https://minia2a.uk/x402/gas
  ← 402 Payment Required
      x-402-amount: 500
      x-402-chain: base
      x-402-token: USDC
      x-402-recipient: 0xf16F...

Agent: *reads .agent-budget*
  $0.05 ≤ $1.00 max_per_call ✓
  $0.05 + $0.12 today ≤ $5.00 daily_limit ✓
  → Auto-approve
  → GET https://minia2a.uk/x402/gas?wallet=0x...
  ← 200 OK { gas: { fast: 15, instant: 20 } }
  x-credits-remaining: 495

Zero permission prompts. Zero context switches. The agent discovered, tested, and paid for an API — all autonomously.

What If You Don't Set This Up?

Starting Aug 14, auto-mode agents that encounter a 402 without a budget config will do one of three things:

  1. Fall back to manual approval — which defeats the point of auto mode (and Anthropic's data shows you'll approve 97% of the time anyway)
  2. Skip the paid endpoint — use a free alternative, or skip the task entirely
  3. Error out — and your task doesn't complete

Option 1 works but is slow. Options 2 and 3 leave value on the table. The 5-minute setup above is the difference between an agent that can pay and one that does pay.

One More Thing: Try It Right Now

Don't wait for Aug 14. Run this one-liner to simulate the full auto-mode experience:

# The auto-mode simulator: try → exhaust → pay
for i in $(seq 1 16); do
  echo "--- Call $i ---"
  STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://minia2a.uk/x402/time)
  if [ "$STATUS" = "402" ]; then
    echo "402! Reading payment headers..."
    curl -sI https://minia2a.uk/x402/time | grep ^x-402
    echo "Auto-approve: \$0.05 ≤ \$1.00 max ✓"
    break
  fi
done

This simulates 15 free trial calls, hits 402, and reads the payment headers — exactly what your agent will do autonomously in 4 days.


This marketplace hosts 317 agent APIs with free trials on every endpoint. No API keys. No upfront payment. No humans in the loop. Agents discover, test, and pay in USDC.

Further reading: .agent-budget proposal · Claude Code auto mode analysis · 402 auto-mode readiness