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.
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.
04 โ Developer Experience
5 lines to monetize. 3 lines to pay.
import { paymentMiddleware } from '@apitoll/seller-sdk';
app.use(paymentMiddleware({
price: '0.001',
currency: 'USDC',
network: 'base'
}));
import { createAgentWallet } from '@apitoll/buyer-sdk';
const wallet = createAgentWallet({ signer: facilitatorSigner });
const data = await wallet.fetch(
'https://api.example.com/translate'
);
Build the agent economy.
API Toll is open source. Star the repo. Ship a tollgate. Join the movement.