← Guides Guide

How can AI agents pay for my API, tool or MCP server?

Short answer: Give your endpoint an x402 price. Agents with an x402 client and a stablecoin wallet read the price from the 402 response, pay it and retry in the same round trip, without signing up or using an API key. A facilitator such as Penni verifies and settles each payment to your wallet.

AI agents increasingly do work on their own: they look things up, call tools, buy data and chain services together. When an agent finds a useful API that wants a sign-up form, an API key and a credit card, it stops. A human has to step in. Agents need a way to pay that works inside the request.

How agent payments work

x402 is an open standard for exactly this, started by Coinbase and now developed by the x402 Foundation. The agent has a wallet with stablecoins (a budget set by its owner). When it calls your endpoint:

  1. Your server answers 402 Payment Required with what it costs, in which token and to which address.
  2. The agent decides whether the price is acceptable, signs a payment for that amount and calls again.
  3. Your server has the payment verified and settled, and answers normally.

The whole exchange takes about two seconds. The agent never creates an account with you, and you never handle its card details. How it works shows the full flow.

What you can sell this way

  • APIs: data, search, enrichment, conversion, scoring. Priced per call.
  • Content: articles, reports, datasets, images. Priced per page or file.
  • AI tools and MCP servers: an MCP server that agents reach over HTTP can sit behind the same middleware; you set a price per endpoint path.
  • Compute: model outputs, rendering, anything expensive enough to charge for per request.

Making sure agents find you

Agents choose tools from catalogs. With x402 "Bazaar" discovery metadata, your endpoints describe themselves: what they do, how to call them and what they return. Penni publishes this for you and lists opted-in sites in a public catalog. You can check how your endpoint looks to an agent with the free x402 checker.

Setting it up

With Penni: create a site, set prices per path, add a receiving wallet, and connect your server with middleware (Node.js, Python, Go, PHP), a Cloudflare Worker or three HTTP calls. Payments are in EURC or USDC on Base or Solana, or USDM on Cardano, and go straight to your wallet. Penni charges €0.002 per settlement. See why teams choose Penni.

Which AI agents can pay with x402?

Any agent built with an x402 client library and given a wallet, which includes agent frameworks and wallet kits from Coinbase and others. The number is growing quickly; the protocol is open, so no agent needs permission from you or from Penni.

Can an agent overpay or be overcharged?

No. The agent signs a payment for the exact amount, token and recipient in your 402 response, and checks it before signing. It can't be settled for more.

What if the agent pays and my server fails?

Penni settles a payment only when your server asks it to, after it has the payment verified. The usual pattern is verify, do the work, then settle and respond.

Let AI pay for your work. Start free in test mode.

Create a free account