Built on x402 by Coinbase · 75M+ transactions settled

Monetize any API
for AI agents.

Add one function call. Set your price. AI agents pay per request in USDC — instantly, on-chain, to your wallet. Free and open source.

server.ts
import { monapi } from "@monapi/sdk";

// One line. That's it.
app.use(monapi({
  wallet: process.env.WALLET,
  price: 0.01,
}));
Terminal
$ curl -i /api/weather
HTTP/1.1 402 Payment Required

price     $0.01
token     USDC
network   base
wallet    0x83...913

→ Agent pays automatically via x402

HTTP/1.1 200 OK
{ "temp": 22, "city": "Berlin" }

Built on trusted, open infrastructure

Quick start

Add payments in 5 minutes.

Pick your framework. Your existing routes don't change.

server.ts
// npm install @monapi/sdk @x402/express
import express from "express";
import { monapi } from "@monapi/sdk";

const app = express();

// Global: every route costs $0.01
app.use(monapi({
  wallet: process.env.WALLET,
  price:  0.01,
}));

// Or per-route pricing:
app.use(monapi({
  wallet: process.env.WALLET,
  routes: {
    "/api/weather":  0.01,
    "/api/forecast": 0.05,
    "/api/search":   0.10,
  },
}));
// npm install @monapi/sdk @x402/next
import { withMonapi } from "@monapi/sdk/next";
import { NextResponse } from "next/server";

async function handler(request: Request) {
  return NextResponse.json({
    temp: 22,
    city: "Berlin",
  });
}

// Wrap your handler. Agents pay $0.01.
export const GET = withMonapi(handler, {
  wallet: process.env.WALLET,
  price:  0.01,
});
// npm install @monapi/sdk @x402/mcp
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { monapiMcp } from "@monapi/sdk/mcp";
import { z } from "zod";

const server = new McpServer({
  name: "my-server",
  version: "1.0.0",
});

// Create payment wrapper
const paid = monapiMcp({
  wallet: process.env.WALLET,
  price:  0.05,
});

// Wrap any tool handler
server.tool("search", { query: z.string() },
  paid(async (args) => ({
    content: [{ type: "text", text: "Results..." }],
  }))
);
Get started now Full documentation
The problem

AI agents can't sign up. You're losing revenue.

Agents can't fill forms, enter credit cards, or manage subscriptions. They hit your paywall and leave.

Without monapi
1

Agent discovers your API

Via MCP, search, or documentation.

2

Hits your signup page

Account creation, email, API key, card on file.

3

Agent can't continue

Can't fill forms or enter payment details.

4

Agent leaves silently

Finds an alternative or abandons the task.

$0 captured

A customer you never knew existed.

With monapi
1

Agent discovers your API

Via MCP, search, or documentation.

2

Receives HTTP 402

With the price you set, your wallet address, and token info.

3

Pays your price in USDC

$0.01 or $5 — you decide. On-chain, verified in under 2 seconds.

4

Gets the data, moves on

Your API responds normally. Agent continues its work.

Instant revenue

USDC in your wallet. No invoice, no delay.

Under the hood

How x402 works. 4 steps.

x402 is an open payment standard by Coinbase that embeds payments directly into HTTP requests.

Payments at the protocol level.

No SDKs on the client side. No API keys. No accounts. The payment information is embedded in standard HTTP headers. Any x402-compatible agent can pay automatically.

Supported by Coinbase AgentKit, Cloudflare, Vercel, and the growing x402 ecosystem.

Learn more about x402
1

Agent sends a normal HTTP request to your API

2

Server responds with HTTP 402 and payment terms

3

Agent signs a USDC payment and retries the request

4

Facilitator verifies, settles on-chain, API responds with HTTP 200

What you get

Everything included. Nothing to configure.

<2s

Settlement time

USDC on Base, Arbitrum, or Polygon. Gas fees are sponsored — agents only need USDC.

3

Frameworks

Express, Next.js, and MCP. One SDK, three entry points.

$100/day

Example revenue

10,000 requests at $0.01 each. You set the price, you keep 100%.

Non-custodial. Your money goes straight to your wallet.

USDC flows directly from the agent's wallet to yours via the x402 facilitator. monapi never holds, controls, or has access to your funds. No middleman. No delays. Gas fees are sponsored — agents only need USDC to pay.

Features

What's in the SDK today.

middleware

Payment gate

Intercepts requests. Returns 402 with machine-readable terms. Verifies on-chain payment. Passes the request through.

routes

Per-route pricing

Set different prices per endpoint. $0.01 for a weather lookup, $0.10 for a search. Configure it all in one object.

mcp

MCP monetization

Wrap any MCP tool handler. AI agents discover, pay per invocation, get results. No API keys needed.

chains

Multi-chain

Base, Arbitrum, and Polygon. All with sub-cent transaction fees. Testnet support for development.

gas-free

Zero gas for agents

Agents only need USDC, no ETH or MATIC. Gas fees are sponsored by the x402 facilitator via EIP-3009. One less barrier to adoption.

cli

Interactive setup

Run npx monapi init to auto-detect your framework, configure your wallet, and generate starter code.

Use cases

Built for anyone with an API.

If AI agents would pay for your data, monapi gets you there in minutes.

Data APIs

Weather, finance, search, geolocation. Agents need one-off lookups and can't subscribe. Charge per request instead.

MCP tools

You built a useful tool but giving it away is unsustainable. Charge per invocation with a single wrapper function.

AI/ML endpoints

Inference, embeddings, fine-tuned models. Agents pay per call instead of negotiating contracts.

Ready to get paid?

Install the SDK, add one line, start earning from AI agent traffic.

$ npm install @monapi/sdk
Read the docs View on GitHub

Free and open source. MIT licensed. Non-custodial. No monapi account needed.

FAQ

Common questions.

No. Install the npm package, add one middleware call, and provide a wallet address. monapi handles all protocol logic, payment verification, and settlement.

Create a free Coinbase wallet, or use MetaMask, Rainbow, or any EVM-compatible wallet. You just need a public address that can receive USDC.

Agents using Coinbase AgentKit, Cloudflare Workers AI, Vercel, and other x402-compatible clients. The ecosystem is growing fast. Agents without x402 support simply receive a 402 response they can't act on.

Yes. Use the routes config object to set a price per path. $0.01 for a weather lookup, $0.10 for a search. Keep some routes free while gating others.

Base, Arbitrum, and Polygon. All with sub-cent transaction fees. Each chain has testnet support (Base Sepolia, Arbitrum Sepolia, Polygon Amoy).

Nothing changes for them. monapi only activates for requests that don't carry a valid session or API key. Your authenticated human users are completely unaffected.

1 USDC = $1 always. Convert to USD or EUR through Coinbase, Kraken, or any major exchange. Many developers keep USDC as-is.

The SDK is free and open source (MIT). There are no monapi fees. The only cost is the blockchain gas fee (typically <$0.01 on Base, Arbitrum, and Polygon).