Skip to main content
We’ve tested tens of thousands of endpoints and found that the hand-rolled ones tend to break in the details, with malformed 402 challenges, network identifiers agents can’t settle against, and missing discovery metadata. The @agentcash/router gets all of this right for you. The router is the fastest and most effective way to ship an API on x402 and MPP. Just define routes with a fluent builder, and the router handles payment challenges, verification, settlement, wallet identity, and discovery.

What you get

Every pricing model. One route definition and support every pricing model across x402 and MPP.
router.route('search').paid('0.01').handler(run);                 // fixed price
router.route('research').upTo('0.05').handler(meter);             // billed as the handler works
router.route('llm').session({ unitCost: '0.0001' }).stream(gen);  // per-unit, SSE streaming
Discovery built in. Your route definitions generate the documents that get you indexed by x402scan, mppscan, and AgentCash, so agents can instantly find, understand, and call your API.
GET /openapi.json   → OpenAPI 3.1 with pricing extensions
GET /llms.txt       → plain-text guidance for agents
Identity without accounts. .siwx() verifies who’s calling with a wallet signature, giving you per-user state with no signup flow or API keys.
router.route('inbox').siwx().handler(async ({ wallet }) => inboxFor(wallet));
router.route('report').paid('0.01').siwx().handler(fn);  // pay once, replay free

Deploy in one click

The recommended way to start is the Vercel template: a working pay-per-call API that exercises every pricing mode. Deploy with Vercel See the quickstart for the full walkthrough.

Quickstart

Deploy the template or add the router to an existing app.

Routes and pricing

Every auth mode with examples.

Hosting

Next.js, Hono, Bun, Node, and discovery endpoints.

Configuration

Environment variables, KV stores, and plugin hooks.