open source ยท x402 protocol ยท Base L2

The internet's
toll booth
for AI agents

API Toll lets AI agents pay for API calls with USDC micropayments. No API keys. No subscriptions. No humans in the loop.

scroll to understand
01 โ€” The Problem

APIs were built for humans.
Agents aren't human.

Today, if an AI agent needs to use a paid API, a human has to sign up, enter a credit card, manage billing, and monitor usage. This breaks at scale.

Today
๐Ÿฝ๏ธ

The Fancy Restaurant

  • 1 Make a reservation (sign up)
  • 2 Show membership card (API key)
  • 3 Human places the order
  • 4 Get a monthly bill (subscription)
  • 5 Human manages 15 restaurants
API Toll
๐Ÿช

The Vending Machine

  • 1 Walk up to the machine
  • 2 Drop in a digital coin (USDC)
  • 3 Get the result
  • 4 Walk away
  • 5 Done. Milliseconds.
02 โ€” How It Works

Five steps. Fractions of a second.

Built on HTTP 402 โ€” the status code reserved since 1997 for exactly this moment.

1

Agent Requests

Calls a paid API endpoint

GET /api/data
โ†’
2

402 Response

Server says "pay me"

HTTP 402
โ†’
3

Agent Pays

USDC proof in header

X-PAYMENT: ...
โ†’
4

Verified

Onchain settlement

Base L2
โ†’
5

Fulfilled

Data returned

HTTP 200 โœ“
03 โ€” Now Scale It

One agent is cool.
A thousand is an economy.

Imagine agent teams โ€” each one paying for specialized services autonomously. That's not a feature. That's a new economic layer for the internet.

๐Ÿ”

Research Agent

Pays $0.002 per web scrape. Calls 500 sources. Total cost: $1. No subscription needed.

๐ŸŒ

Translation Agent

Charges $0.001 per paragraph. Serves 10,000 agents daily. Earns passively.

๐Ÿ–ผ๏ธ

Image Analysis Agent

$0.005 per image. Other agents call it as a tool. Fully autonomous commerce.

๐Ÿค– ๐Ÿ’ฐ ๐Ÿค– ๐Ÿ’ฐ ๐Ÿค–

Agents paying agents.
That's the future.

API Toll is the payment rail that makes it possible. Open source. Open protocol. Open economy.

04 โ€” Developer Experience

5 lines to monetize. 3 lines to pay.

seller SDK
buyer SDK
// Monetize any API endpoint
import { paymentMiddleware } from '@apitoll/seller-sdk';

// That's it. One line to add a toll.
app.use(paymentMiddleware({
  price: '0.001',   // $0.001 per request
  currency: 'USDC',
  network: 'base'
}));

// Agents pay automatically. You earn automatically.
// Give your agent a wallet and let it pay
import { createAgentWallet } from '@apitoll/buyer-sdk';

const wallet = createAgentWallet({ signer: facilitatorSigner });

// Fetch like normal โ€” payment handled on 402
const data = await wallet.fetch(
  'https://api.example.com/translate'
);

// Agent sees 402 โ†’ pays USDC โ†’ gets data โœ“

Build the agent economy.

API Toll is open source. Star the repo. Ship a tollgate. Join the movement.

โญ Star on GitHub Learn x402 โ†’
Protocol
x402
Currency
USDC
Chains
Base L2 + Solana
License
MIT
Status
โ— Live