The commerce layer for the x402 agent economy — micropayments for AI agents on Base and Solana
APITOLL is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on ai-agents, base, express, hono. It currently has 5 GitHub stars and 0 forks, and sits alongside related tools like x402-sdk, piprail, Agent402, monapi, prim.sh, provider.
The payment layer for the AI agent economy.
Monetize APIs with USDC micropayments. Control agent spending. Settle instantly on Base & Solana.
Website • API Docs • Dashboard • npm Packages • Quick Start
API Toll lets AI agents pay for API calls using USDC stablecoins on Base and Solana — powered by the x402 protocol (HTTP 402 Payment Required).
For API sellers: Add 3 lines of middleware to monetize any endpoint with per-request micropayments.
For agent builders: Give your agents a wallet with budget controls and they auto-handle payments.
Agent calls API ─────► 402 Payment Required ─────► Agent pays USDC
│
◄───── 200 OK + data ◄───── Facilitator verifies on-chain
npm install @apitoll/seller-sdk
import express from "express";
import { paymentMiddleware } from "@apitoll/seller-sdk";
const app = express();
app.use(
paymentMiddleware({
walletAddress: "0xYourUSDCWallet",
endpoints: {
"GET /api/data": {
price: "0.005", // $0.005 USDC per request
chains: ["base"],
description: "Premium data feed",
},
},
})
);
app.get("/api/data", (req, res) => {
res.json({ data: "premium content" });
});
Requests without payment get HTTP 402 with payment requirements. Agents pay and retry automatically.
npm install @apitoll/buyer-sdk
import { createAgentWallet, createFacilitatorSigner } from "@apitoll/buyer-sdk";
const agent = createAgentWallet({
name: "ResearchBot",
chain: "base",
policies: [
{ type: "budget", dailyCap: 50, maxPerRequest: 0.10 },
{ type: "vendor_acl", allowedVendors: ["*"] },
{ type: "rate_limit", maxPerMinute: 60 },
],
signer: createFacilitatorSigner(
"https://pay.apitoll.com",
process.env.FACILITATOR_API_KEY!,
process.env.AGENT_WALLET!
),
});
// Auto-handles 402 → policy check → sign → retry
const data = await agent.fetch("https://api.apitoll.com/api/search?q=AI+agents");
npm install @apitoll/mcp-server
import { z } from "zod";
import { createPaidMCPServer } from "@apitoll/mcp-server";
const server = createPaidMCPServer({
walletAddress: "0xYourWallet",
});
// Paid tool — $0.01 per call
server.paidTool(
"analyze_data",
"AI-powered data analysis",
z.object({ data: z.string() }),
{ price: 0.01, chains: ["base"] },
async ({ data }) => {
return { analysis: "..." };
}
);
| Package | Description | npm |
|---|---|---|
@apitoll/seller-sdk |
Express & Hono middleware for API monetization | |
@apitoll/buyer-sdk |
Agent wallet with auto-402 handling, policy engine, 5 signer modes | |
@apitoll/shared |
Shared types, USDC utilities, chain configs, plan limits | |
@apitoll/facilitator |
x402 payment relay — custodial wallet, on-chain verification | |
@apitoll/mcp-server |
Monetize MCP tools with x402 micropayments | |
@apitoll/langchain |
LangChain and CrewAI adapters for paid tools |
1. Agent requests resource → GET /api/data
2. Server returns 402 ← HTTP 402 + payment requirements (PAYMENT-REQUIRED header)
3. Agent's policy engine checks → Budget OK? Vendor allowed? Rate limit?
4. Agent signs USDC payment → via facilitator, local wallet, or direct transfer
5. Agent retries with payment → GET /api/data + X-PAYMENT header
6. Facilitator verifies on-chain → Confirms USDC transfer on Base or Solana
7. Server returns data ← 200 OK + data
8. Transaction indexed → Dashboard updates in real-time
The buyer SDK supports 5 ways for agents to sign payments:
| Mode | Function | Who Holds Keys | Use Case |
|---|---|---|---|
| Facilitator | createFacilitatorSigner() |
Facilitator service | Easiest setup, custodial |
| Local EVM | createLocalEVMSigner() |
Agent (self-custody) | Agent holds EVM private key, facilitator relays |
| Direct EVM | createDirectEVMSigner() |
Agent (fully sovereign) | No facilitator needed, direct on-chain |
| Local Solana | createLocalSolanaSigner() |
Agent (self-custody) | Agent holds Solana keypair, facilitator relays |
| Direct Solana | createDirectSolanaSigner() |
Agent (fully sovereign) | No facilitator needed, direct SPL transfer |
The buyer SDK enforces policies before any payment is signed:
// Budget — daily/weekly caps, per-request maximums
{ type: "budget", dailyCap: 50, weeklyCap: 200, maxPerRequest: 0.10 }
// Vendor ACL — whitelist/blacklist sellers
{ type: "vendor_acl", allowedVendors: ["api.weather.pro", "neynar.com"] }
// Rate Limits — per-endpoint request throttling
{ type: "rate_limit", maxPerMinute: 60, maxPerHour: 1000 }
| Service | URL |
|---|---|
| Landing page | apitoll.com |
| Dashboard | apitoll.com/dashboard |
| Seller API (75 endpoints) | api.apitoll.com |
| Swagger API Docs | api.apitoll.com/api/docs |
| Discovery API | apitoll.com/api/discover |
| What Is It? | apitoll.com/what |
The analytics dashboard at apitoll.com/dashboard provides:
APITOLL/
├── packages/
│ ├── shared/ Core types, USDC utilities, chain configs, security helpers
│ ├── seller-sdk/ Express & Hono payment middleware for API monetization
│ ├── buyer-sdk/ Agent wallet with auto-402 handling, policy engine, 5 signers
│ ├── facilitator/ x402 payment relay with custodial wallet (Base + Solana)
│ ├── mcp-server/ MCP server with paid tools support
│ └── langchain/ LangChain and CrewAI adapters for paid tool execution
├── apps/
│ ├── dashboard/ Next.js analytics dashboard (Convex + Clerk + Stripe)
│ ├── seller-api/ Production seller API with 75 paid endpoints
│ ├── agent-client/ Example agent that auto-pays for APIs
│ ├── indexer/ PostgreSQL transaction indexer (Hono)
│ └── discovery/ Tool discovery & marketplace API (Hono)
├── convex/ Serverless backend — 29 tables, real-time queries
├── examples/ Working examples for sellers, agents, MCP, LangChain
├── docs/ Quick start, architecture, deployment, self-custody guides
├── scripts/ Wallet setup, seed data, testing utilities
└── infra/ PostgreSQL schema for optional indexer
git clone https://github.com/TasnidChain/APITOLL.git
cd APITOLL
npm install
npm run build
npm test
Copy .env.example and fill in your values. Key variables:
| Variable | Required For | Description |
|---|---|---|
NEXT_PUBLIC_CONVEX_URL |
Dashboard | Convex deployment URL |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Dashboard | Clerk auth public key |
CLERK_SECRET_KEY |
Dashboard | Clerk auth secret |
STRIPE_SECRET_KEY |
Billing | Stripe payments |
FACILITATOR_PRIVATE_KEY |
Facilitator | Hot wallet private key |
FACILITATOR_API_KEYS |
Facilitator | Comma-separated API keys |
BASE_RPC_URL |
On-chain verification | Base L2 RPC endpoint |
SOLANA_RPC_URL |
Solana payments | Solana RPC endpoint |
REDIS_URL |
Rate limiting | Redis connection string |
See .env.example for the full list.
x402 SDK for AI agent payments - Base & Solana USDC micropayments
x402 (HTTP 402 Payment Required) SDK + MCP server: let any API charge for itself and any AI agent pay for itself, USDC & stablecoins across EVM, Solana & 8 more chain families, in a couple of lines. Backendless, no fee, self-custodial, paid straight to your wallet. TypeScript, MIT.
500+ pay-per-call web tools + skill packs for AI agents — every one tested, priced, and settled on-chain. Paid in USDC over x402 on 8 chains, or free via proof-of-work on the pure-CPU tools. Self-hostable, MCP-native, deterministic. Plus the open x402 index (Find / Route / Leaderboard).
One-line API monetization for AI agents. Pay-per-request USDC payments via x402. Express, Next.js, MCP.
Infrastructure primitives for autonomous agents. No signup. No GUI. No KYC. Pay with USDC, get resources.
x402 service provider tooling for Azeth — gate Hono endpoints behind x402 payments
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.
DePIN for Vintage Hardware — Proof-of-Antiquity blockchain where old machines outmine new ones. AI-powered hardware fingerprinting, 15+ CPU architectures, Solana bridge (wRTC). $0 VC.
🚀 Curated list of x402 resources: HTTP 402 Payment Required protocol for blockchain payments, crypto micropayments, AI agents, API monetization. Includes SDKs (TypeScript, Python, Rust), examples, facilitators (Coinbase, Cloudflare), MCP integration, tutorials. Accept USDC payments with one line of code. Perfect for AI agent economy.
Client SDK for the Vybe x402 API. Pay-per-call USDC over HTTP and prepaid-credit WebSocket streaming for Vybe's Solana analytics API. Built for AI agents.
The financial operating system for AI agents. A single HTTP client that intercepts '402 Payment Required', routes across x402, L402, and MPP, persists credentials as recoverable assets, enforces per-envelope budgets, and emits a structured trace.