17 APIs live on mainnet

Pay-per-call APIs
for AI agents

No API keys. No subscriptions. No rate limits.
Just send stablecoins with every request using the x402 payment protocol.

terminal
$ 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");

A vending machine for data and AI tools

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 accounts

No sign-up forms, no email verification, no dashboards. There is no concept of a "user" — just a wallet that pays.

No API keys

No secrets to rotate, no rate limit tiers, no usage quotas. The payment is the authentication.

No subscriptions

No monthly bills, no overage charges. Pay for exactly what you use — one tenth of a cent at a time.

How does money actually move?

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.

Built for autonomous software

AI agents, bots, and scripts that need to use external services without a human setting up accounts first.

AI research assistant

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.

crypto/price crypto/history ~$0.004/query

Portfolio tracker bot

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.

wallet/balances crypto/trending ~$0.006/check

Content creation agent

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.

image/fast image/quality $0.015–0.12/image

Coding assistant

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.

code/run $0.005/execution

Meeting transcription pipeline

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.

transcribe $0.10/recording

Decentralized data archival

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.

ipfs/pin ipfs/get $0.01/pin

Why this matters

The old way of using APIs doesn't work for autonomous software.

Today: the API key treadmill

  1. 01 Sign up for a service with email + password
  2. 02 Navigate a dashboard to generate an API key
  3. 03 Store the key securely (env vars, secrets manager)
  4. 04 Handle rate limits, quotas, and overage billing
  5. 05 Rotate keys periodically, manage per-service billing
  6. 06 Repeat for every new service your agent needs

With x402: just pay

  1. 01 Fund a wallet with stablecoins
  2. 02 Call any endpoint — payment is automatic
  3. 03 That's it. No keys, no accounts, no billing pages.

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.

Three networks, one protocol

Every endpoint accepts payment on any supported network. Pick the one that fits your agent's speed and cost requirements.

B

Base

eip155:8453
TokenUSDC
Decimals6
Confirmation~2s
FacilitatorCoinbase CDP
Coming Soon
M

MegaETH

eip155:4326
TokenUSDm
Decimals18
Confirmation~10ms
VerificationDirect on-chain
S

Solana

solana:5eykt4U…
TokenUSDC
Decimals6
Confirmation~400ms
FacilitatorCoinbase CDP

17 APIs, three categories

Production-grade endpoints backed by best-in-class providers. All priced for micropayments.

Compute

Fast Image Gen

$0.015

FLUX Schnell — ~2s generation

POST /api/image/fast

Quality Image Gen

$0.05

FLUX.2 Pro — production quality

POST /api/image/quality

Text-in-Image

$0.12

Ideogram v3 — logos, signage

POST /api/image/text

Code Execution

$0.005

Sandboxed Python, JS, Bash, R

POST /api/code/run

Transcription

$0.10

Deepgram Nova-3 with diarization

POST /api/transcribe
Crypto & Blockchain

Price Feed

$0.001

Real-time prices via CoinGecko

GET /api/crypto/price

Market Data

$0.002

Rankings, volume, market cap

GET /api/crypto/markets

Historical Data

$0.003

Price history, OHLC, charts

GET /api/crypto/history

Trending

$0.001

Currently trending coins

GET /api/crypto/trending

Coin Search

$0.001

Search by name or symbol

GET /api/crypto/search

Wallet Balances

$0.005

Multichain balances via Allium

POST /api/wallet/balances

Wallet Transactions

$0.005

Transaction history with labels

POST /api/wallet/transactions

Wallet P&L

$0.01

Realized & unrealized P&L

POST /api/wallet/pnl

Token Prices

$0.005

DEX-derived OHLC, 200 tokens/req

POST /api/token/prices

Token Metadata

$0.002

Name, symbol, decimals, chain

GET /api/token/metadata
Storage

IPFS Pin

$0.01

Pin JSON, files, or URLs

POST /api/ipfs/pin

IPFS Retrieve

$0.001

Fetch files by CID

GET /api/ipfs/get

Simple pricing

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

How it works

The x402 protocol turns HTTP into a payment rail. Three steps, fully automated.

1

Agent calls an endpoint

Your agent makes a normal HTTP request — GET /api/crypto/price?ids=bitcoin

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6Miw...
Content-Type: application/json
{ "error": "X-PAYMENT header is required", "accepts": [...] }
2

Agent signs a payment

The @x402/fetch wrapper reads the 402 response, picks a network, signs a stablecoin transfer, and retries with the payment attached.

X-PAYMENT: <base64-encoded signed payment>
GET /api/crypto/price?ids=bitcoin
3

Gateway verifies & responds

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.

HTTP/1.1 200 OK
PAYMENT-RESPONSE: <settlement receipt>
{ "bitcoin": { "usd": 97234.12 } }

Quick start

Five lines to make your first paid API call.

TypeScript
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 } }