Menu

Explorer & Settings

Tempo Explorer Submit Project
Back to all projects
A

APITOLL

by TasnidChain · Updated Feb 18, 2026
TypeScript TasnidChain/APITOLL

The commerce layer for the x402 agent economy — micropayments for AI agents on Base and Solana

5
Stars
0
Forks
TypeScript
Language
Feb 7, 2026
Created

In the AI payments ecosystem

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, monapi.

README.md View on GitHub →

API Toll

The payment layer for the AI agent economy.

Monetize APIs with USDC micropayments. Control agent spending. Settle instantly on Base & Solana.

CI npm: seller-sdk npm: buyer-sdk License: MIT TypeScript

WebsiteAPI DocsDashboardnpm PackagesQuick Start


What is API Toll?

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

Quick Start

Seller: Monetize Your API

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.

Buyer: Deploy an Agent with Budget Controls

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

MCP Server: Monetize Tools

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: "..." };
  }
);

Packages

Package Description npm
@apitoll/seller-sdk Express & Hono middleware for API monetization npm
@apitoll/buyer-sdk Agent wallet with auto-402 handling, policy engine, 5 signer modes npm
@apitoll/shared Shared types, USDC utilities, chain configs, plan limits npm
@apitoll/facilitator x402 payment relay — custodial wallet, on-chain verification npm
@apitoll/mcp-server Monetize MCP tools with x402 micropayments npm
@apitoll/langchain LangChain and CrewAI adapters for paid tools npm

How It Works

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

Signer Modes

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

Policy Engine

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 }

Live Deployment

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

Dashboard

The analytics dashboard at apitoll.com/dashboard provides:

  • Overview — Total spend, daily spend chart, success rate, avg latency
  • Transactions — Searchable, filterable transaction history
  • Agents — Manage agent wallets, policies, spending
  • Sellers — Register APIs, track revenue per endpoint
  • Discovery — Browse paid tools in the marketplace
  • Playground — Test API calls with live payment flow
  • Billing — Free / Pro / Enterprise tiers via Stripe
  • Revenue — Platform fee analytics (admin)
  • Webhooks, API Keys, Policies, Disputes, Deposits — Full management suite

Project Structure

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

Development

git clone https://github.com/TasnidChain/APITOLL.git
cd APITOLL
npm install
npm run build
npm test

Environment Variables

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.

Documentation

Built On

  • x402 Protocol — Open HTTP standard for internet-native payments
  • Base — Coinbase L2 for fast, cheap USDC payments (~$0.001/tx)
  • Solana — High-throughput chain for SPL token payments
  • Coinbase CDP — Facilitator and wallet infrastructure
  • Convex — Real-time serverless backend
  • Clerk — Authentication and user management
  • Stripe — Fiat billing and USDC on-ramp

License

MIT