No API keys. No subscriptions. No rate limits.
Just send stablecoins with every request using the x402 payment protocol.
$ curl https://x402-gateway-production.up.railway.app/api/crypto/price?ids=bitcoin
HTTP/1.1 402 Payment Required
# Response includes payment instructions — your agent pays automatically
$ # With x402 fetch wrapper, it's one line:
import { wrapFetchWithPayment } from "@x402/fetch";
const paidFetch = wrapFetchWithPayment(fetch, wallet);
const data = await paidFetch("https://x402-gateway-production.up.railway.app/api/crypto/price?ids=bitcoin");
Instead of signing up for a dozen services, managing API keys, and juggling subscriptions — software just sends a fraction of a cent and gets back useful work.
No sign-up forms, no email verification, no dashboards. There is no concept of a "user" — just a wallet that pays.
No secrets to rotate, no rate limit tiers, no usage quotas. The payment is the authentication.
No monthly bills, no overage charges. Pay for exactly what you use — one tenth of a cent at a time.
The money is stablecoins — digital dollars that live on a blockchain. Think of them like casino chips, except they're always worth exactly $1 and you can send them anywhere in the world in seconds.
When your software calls an endpoint, it gets back a "402 Payment Required" response — like a toll booth. The payment library reads the price, signs a stablecoin transfer from your wallet, and re-sends the request with the payment attached. The whole thing happens in one round-trip. Your code just sees the data come back.
This is what the x402 protocol does — it bakes payments into regular web requests. No checkout pages, no invoices, no payment processors. Just HTTP with money built in.
AI agents, bots, and scripts that need to use external services without a human setting up accounts first.
You ask your AI "what happened to Bitcoin this week?" It calls the price and history endpoints, pays a fraction of a cent per call, and gives you a chart and summary. It never needed a CoinGecko account.
A trading bot checks wallet balances every hour, looks at trending coins, pulls price history for analysis. It can run 1,000 calls for about $1–2. No API key management, no rate limit headaches.
An AI writing a blog post needs a custom illustration. It calls the image generation endpoint, pays 1.5 cents, and gets a unique image in 2 seconds. No Midjourney subscription, no credits system.
An AI agent needs to verify that generated code actually runs. It sends the code to the sandbox, pays half a cent, and gets back the output — without needing Docker or a dev environment.
An app records a meeting, sends the audio to the transcription endpoint, and gets back a full transcript with speaker labels — who said what, with timestamps. Ten cents per recording.
An agent generating reports pins them to IPFS for a penny each. The data becomes permanent, publicly addressable, and doesn't depend on any single company's servers staying online.
The old way of using APIs doesn't work for autonomous software.
It's the difference between having a gym membership and paying 10 cents every time you use a treadmill. For software that runs autonomously, the pay-per-use model is simpler, cheaper, and requires zero human setup.
This is especially powerful for autonomous agents — software that operates without a human babysitting it. An agent can discover available services, compare pricing across networks, and pay on the fly, all programmatically. No human needs to create accounts or manage credentials for it.
Every endpoint accepts payment on any supported network. Pick the one that fits your agent's speed and cost requirements.
Production-grade endpoints backed by best-in-class providers. All priced for micropayments.
FLUX Schnell — ~2s generation
POST /api/image/fast
FLUX.2 Pro — production quality
POST /api/image/quality
Ideogram v3 — logos, signage
POST /api/image/text
Sandboxed Python, JS, Bash, R
POST /api/code/run
Deepgram Nova-3 with diarization
POST /api/transcribe
Real-time prices via CoinGecko
GET /api/crypto/price
Rankings, volume, market cap
GET /api/crypto/markets
Price history, OHLC, charts
GET /api/crypto/history
Currently trending coins
GET /api/crypto/trending
Search by name or symbol
GET /api/crypto/search
Multichain balances via Allium
POST /api/wallet/balances
Transaction history with labels
POST /api/wallet/transactions
Realized & unrealized P&L
POST /api/wallet/pnl
DEX-derived OHLC, 200 tokens/req
POST /api/token/prices
Name, symbol, decimals, chain
GET /api/token/metadata
Pin JSON, files, or URLs
POST /api/ipfs/pin
Fetch files by CID
GET /api/ipfs/get
No tiers. No commitments. Pay exactly what each call costs in stablecoins. Prices are enforced by the protocol.
| Endpoint | Price |
|---|---|
| /api/crypto/price | $0.001 |
| /api/crypto/markets | $0.002 |
| /api/crypto/history | $0.003 |
| /api/crypto/trending | $0.001 |
| /api/crypto/search | $0.001 |
| /api/wallet/balances | $0.005 |
| /api/wallet/transactions | $0.005 |
| /api/wallet/pnl | $0.01 |
| /api/token/prices | $0.005 |
| /api/token/metadata | $0.002 |
| /api/image/fast | $0.015 |
| /api/image/quality | $0.05 |
| /api/image/text | $0.12 |
| /api/code/run | $0.005 |
| /api/transcribe | $0.10 |
| /api/ipfs/pin | $0.01 |
| /api/ipfs/get | $0.001 |
The x402 protocol turns HTTP into a payment rail. Three steps, fully automated.
Your agent makes a normal HTTP request — GET /api/crypto/price?ids=bitcoin
The @x402/fetch wrapper reads the 402 response, picks a network, signs a stablecoin transfer, and retries with the payment attached.
The gateway verifies the payment on-chain (or via the facilitator), executes the API call, and streams back the result. The settlement receipt is in the response headers.
Five lines to make your first paid API call.
import { wrapFetchWithPayment } from "@x402/fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
// 1. Create a wallet (needs USDC on Base)
const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const wallet = createWalletClient({ account, chain: base, transport: http() });
// 2. Wrap fetch — it handles 402 negotiation automatically
const paidFetch = wrapFetchWithPayment(fetch, wallet);
// 3. Call any endpoint — payment happens transparently
const res = await paidFetch(
"https://x402-gateway-production.up.railway.app/api/crypto/price?ids=bitcoin"
);
const data = await res.json();
console.log(data); // { bitcoin: { usd: 97234.12 } }