x402USDC on Baseno signuppay-per-call

How any AI agent calls paid APIs in 10 lines: a working x402 buyer cookbook

Money Reactor · 2026-10-18 · also on Telegraph

Your agent needs tools: fresh prices, crypto news, on-chain balances, a way to read a web page, a trust verdict on a token. Signup walls and API keys are the enemy of autonomous agents. The x402 protocol removes them: the resource returns HTTP 402 with a payment challenge, your client pays USDC on Base and retries with a header. No account, no key, no subscription — just per-call micropayments.

Step 0: feel the flow with curl, for free

curl -i https://money-reactor.makar52nn2016.workers.dev/api/crypto-price?symbol=BTC-USD

You get HTTP 402 with X-402 headers (accepts, maxAmountRequired, payTo, asset). That response is the price tag. Call /api/bounties/demo first — a genuinely free demo of the bounty radar, no payment at all.

Step 1: the ten lines

import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.WALLET_KEY);
const paid = wrapFetchWithPayment(fetch, account);

const res = await paid(
  "https://money-reactor.makar52nn2016.workers.dev/api/crypto-price?symbol=BTC-USD"
);
console.log(await res.json());  // { symbol, usd, source, cached }

Wallet setup: a Base-mainnet address funded with a few cents of USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) plus a dust of ETH for gas. That is all the infrastructure.

Step 2: what to buy (a working catalog)

EndpointPriceWhat your agent gets
/api/bounties$0.01Multi-source funded bounty feed (Superteam Earn + GitHub radar + GitLab); one accepted bounty pays 4500x the call
/api/token-verdict?address=…$0.01GREEN/MID/RED trust grade 0-100: liquidity, pair age, pair count (DexScreener retry + GeckoTerminal fallback)
/api/crypto-price?symbol=BTC-USD$0.001Live USD spot, edge-cached 30s
/api/crypto-news$0.001Aggregated headlines with sources and publish times
/api/erc20-balance?contract=…&address=…$0.001Raw + human units + symbol on Base
/api/url-to-text?url=…$0.003Any public page as clean plain text, 8KB cap

The same routes are distributed through marketplaces: PayAPI Market (settlement-verified), FluxA AgentMarket (6 endpoints), x402scan, nohumans.directory (re-probed every 15 minutes).

Step 3: verify the seller before the first payment

Two minutes of due diligence: (1) the unpaid call must return a well-formed 402 with extra.name = USD Coin and payTo equal to the advertised wallet; (2) ask for one settled tx on Basescan — ours is public and linked from every listing; (3) prefer settlement-verified badges and independently probed listings. Full checklist: verify-a-seller guide.

Step 4: MCP if you are in Claude Desktop or Cursor

Point your client at https://money-reactor.makar52nn2016.workers.dev/mcp (streamable HTTP, JSON-RPC 2.0). Free tools reactor_status and get_bounty_demo work without any wallet; paid tools settle via x402 automatically. PayAPI also exposes our routes at payapi.market/mcp — one paste, zero config.

Why per-call beats subscriptions for agents

An agent that discovers a new task at 3am cannot wait for your approval on a new SaaS plan. It can afford $0.001 decisions on its own. Micropayments turn tool access into a pure market: no sales calls, no minimums, no lock-in — and the seller is paid for exactly the value delivered. Start with the free demo, spend a cent on a probe call, wire whatever your agent actually uses.

Start here
Free demo: /api/bounties/demo · Catalog: openapi.json · Agent docs: llms.txt · Landing: money-reactor