Gate your API behind USDC micropayments. One line of code.
Tollgate turns any Next.js Route Handler into a pay-per-call API. Agents sign EIP-712 IOUs; we settle them on Base. Non-custodial — Tollgate never touches your USDC.
// app/api/summarize/route.ts
import { createTollgate, withTollgate } from "@tollgatepay/next";
import { usd } from "@tollgatepay/core";
const tollgate = createTollgate({
apiKey: process.env.TOLLGATE_API_KEY!,
payoutAddress: process.env.TOLLGATE_PAYOUT_ADDRESS as `0x${string}`,
developerSalt: process.env.TOLLGATE_DEV_SALT as `0x${string}`,
});
export const POST = withTollgate(
tollgate,
{ price: usd("0.01") }, // $0.01 per call, in micro-USDC
async (req) => {
const { text } = await req.json();
return Response.json({ summary: text.slice(0, 160) });
},
);
Uses @tollgatepay/next and @tollgatepay/core. Works on Vercel Edge, Cloudflare Workers, and Node.
How it works
Three steps. Approve once; sign IOUs per call; settle in batches. No per-call gas, no custody, no surprises.
Approve
The agent approves a USDC allowance to your payout address once, on-chain. This caps their total exposure; no streaming approvals per call.
IOU
Each request, the agent signs a tiny EIP-712 IOU asserting the cumulative amount owed to this (agent, developer, path). Your Route Handler verifies the signature in microseconds.
Settlement
Periodically the settler batches outstanding IOUs into a single on-chain USDC transfer. Gas costs scale with settlements, not with requests.
See the 402 flow
Click through the three-step challenge. No real money, no real keys — just the headers and status codes your agent will see.
Built for agent operators
Running a fleet of agents? Tollgate gives you fleet-level trust tiers, bulk provisioning, and a shared blacklist so one bad actor in your fleet doesn't nuke your reputation with every merchant.
Bulk provisioning
Mint and rotate agent keys in batches. CLI + API.
Fleet-wide caps
Per-agent and per-fleet exposure caps, enforced at the edge.
Shared reputation
Agents inherit your fleet score. Settles go faster when you’ve earned trust.
Developer trust signals
Open-source SDK
The TS + Python SDKs are open source. The 402 flow is a published spec; any x402-compatible agent can call you.
Non-custodial
Tollgate never holds customer funds. Agents approve USDC directly to your payout address. We sign nothing on your behalf.
Audited contracts
CREATE2-deployed anchor + settlement contracts, deterministic on every EVM chain. External audit before mainnet.
Join the waitlist
We're onboarding a small private beta first. Share your GitHub handle so we can see what you're building and prioritise accordingly.
Your email + GitHub handle are the only fields we collect. See our privacy page.