Why does an AI agent need pay per request for crypto data?

An autonomous agent does not have a credit card. It often does not have an email address either. What it has, if the builder gave it one, is a wallet holding a few dollars of USDC.

Until this month that agent's only route into our data was the free key ladder: mint a key from an email, confirm it, and subscribe with a card or a wallet for a month at a time. That is the right shape for a bot that polls all day. It is the wrong shape for a research agent that wakes up, asks three questions and goes back to sleep.

x402 pay per request closes that gap. Six endpoints now accept a signed USDC payment in place of an X-API-Key header. The agent pays per call, in cents, settles on Base with no gas, and never creates an account.

Which endpoints accept x402, and what do they cost?

Only six endpoints are on the per-request rail. They were chosen because a single response answers a whole question. Each is the Pro-shaped payload, so a paying agent gets the full universe, not the free tier's BTC-only scope.

Endpoint What it returns USDC per call
GET /api/v1/event/calendar Dated catalysts (unlocks, mints, listings, macro) with bias and magnitude 0.008
GET /api/v1/regimes/current The committed long-horizon cycle regime with rationale 0.01
GET /api/v1/market-intelligence/liquidations 24h long/short liquidation totals per symbol, full universe 0.01
GET /api/v1/market-intelligence/etf/{asset}/flows Daily spot ETF net flows for btc, eth or sol 0.01
GET /api/v1/quant/market HMM regime nowcast with 24h direction, vol, funding and liquidation-risk probabilities 0.015
GET /api/v1/quant/whales Classified Hyperliquid whale positioning across every account over $100k 0.03

The price list is machine-readable. GET https://cryptodataapi.com/api/v1/pricing returns the same table plus passes, subscriptions, archive files and a four-line how_to_pay walkthrough. Read it once at startup rather than hardcoding a number; the OpenAPI spec also carries x-price-usdc on each of these operations.

Endpoints that are not listed keep their existing rules. In particular the edge-proxied Hyperliquid paths such as gamma exposure still require a key.

How does the x402 402 handshake work?

The protocol is three HTTP round trips at most, and the second and third are usually one call from a client library.

  1. Ask without a key. The API answers 402 Payment Required. The JSON body carries an accepts[] array: the USDC amount in base units, the network (eip155:8453 is Base mainnet), the token contract and our payTo address.
  2. Sign the amount. Your wallet signs an EIP-3009 transferWithAuthorization for exactly that amount. Nothing is broadcast yet, and you spend no gas.
  3. Repeat the request with the signed payload in the x-payment header. A facilitator settles it on-chain, and the response is the data. The x-payment-response header carries the settlement receipt.

Here is what step one looks like on the cheapest endpoint. Note the amount of 8000: USDC has six decimals, so that is $0.008.

curl -s "https://cryptodataapi.com/api/v1/event/calendar?window_days=7" \
  -H "User-Agent: my-research-agent/1.0"
{
  "x402Version": 2,
  "error": "payment_required",
  "resource": {"url": ".../api/v1/event/calendar?window_days=7", "mimeType": "application/json"},
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:8453",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "amount": "8000",
    "payTo": "0xb48699946ce35fdab44b5cd99ad41eb8d977ba8b",
    "maxTimeoutSeconds": 300
  }],
  "price_usd": 0.008,
  "alternatives": {"...": "free key, passes, subscribe"}
}

The body also lists alternatives: how to mint a free key, buy a pass, or subscribe. An agent that reads the 402 has every option in front of it and can pick the cheapest one for its workload.

Working Python example with the x402 client

This is the same flow we used to verify the rail with real USDC on Base. It uses the official x402 Python package and eth-account. The wallet only needs USDC; the payment scheme is gasless for the payer.

import asyncio, httpx
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402_httpx_transport
from x402.mechanisms.evm.exact import register_exact_evm_client
from x402.mechanisms.evm.signers import EthAccountSigner

URL = "https://cryptodataapi.com/api/v1/quant/whales"
UA = {"User-Agent": "my-research-agent/1.0"}

async def main():
    signer = EthAccountSigner(Account.from_key(WALLET_PRIVATE_KEY))
    client = x402Client()
    register_exact_evm_client(client, signer)
    async with httpx.AsyncClient(transport=x402_httpx_transport(client),
                                 timeout=60, headers=UA) as paid:
        r = await paid.get(URL)          # 402 -> sign -> retry, handled inside
        r.raise_for_status()
        s = r.json()["summary"]
        print(s["net_bias"], s["long_pct"], s["total_net_usd"])
        print("receipt:", r.headers.get("x-payment-response"))

asyncio.run(main())

Three details matter in production:

Pay per request vs a pass vs a subscription: which is cheaper?

Per-request pricing is designed for sparse access. The break-even against the other rails is easy to compute, and the 402 body lists the cheaper rails for you under alternatives.

Workload Per request Cheapest alternative
20 whale reads in a day 20 × $0.03 = $0.60 Per request wins
200 mixed calls in one session roughly $2 to $4 1h Pro pass, $1.50
One feed polled every 5 minutes for a month 8,640 × $0.01 = $86.40 Pro monthly, $39
A backtest that needs 30 days of whale snapshots not available per request Pro Plus archives

The rule of thumb: under about 150 calls, pay per request. A working session, buy a pass. Anything that polls, subscribe. The pass and subscription rails also return a cdk_live_ key once, which per-request payments never do, and that key unlocks the MCP server and the rest of the API.

One more thing the per-request rail does for you: the first settled call mints a free-tier record for the payer's wallet. If you later buy a pass with the same wallet, the pass is attached to that record and the key is issued to you once.

When to use x402 pay per request

Reach for it when the agent is occasional, keyless, and budget-capped:

Skip it when the agent polls, when it needs the MCP tools, or when it needs history. Those are pass and subscription territory, and the next post in this series covers the passes.

Start at GET https://cryptodataapi.com/api/v1/pricing, fund a Base wallet with a dollar of USDC, and make the calendar call above. The whole loop costs less than a cent.

Frequently asked questions

Do I need an API key to use x402 pay per request?

No. Six endpoints accept a signed USDC payment in the x-payment header instead of an X-API-Key. Everything else on the API still needs a key.

How much does one x402 call cost?

Between $0.008 (event calendar) and $0.03 (Hyperliquid whale positioning) per call, paid in USDC on Base. The full list is at GET /api/v1/pricing.

Does the payer spend gas?

No. The exact scheme uses an EIP-3009 transferWithAuthorization signature; the facilitator submits it on-chain. The wallet only needs USDC.

When is a pass or subscription cheaper than pay per request?

Roughly above 150 calls in a session a 1h Pro pass at $1.50 wins, and anything that polls beats $39 a month by a wide margin: one feed every 5 minutes is 8,640 calls, about $86 per month per request.