How do I charge per API call without subscriptions or API keys?
Short answer: Use x402: your API answers an unpaid request with 402 Payment Required and a price, the client pays that exact amount in a stablecoin and retries, and your server responds once the payment is settled. No sign-up, no API keys for customers, no monthly plans. One middleware line adds it to an existing API.
Try Penni free in test mode · Check any URL with the free x402 checker
The classic way to sell an API is a sign-up page, API keys, a free tier, monthly plans and a billing system that tracks usage and charges a card at the end of the month. That is a lot of machinery, and it shuts out the customers who only want ten calls, or who are software themselves.
The pay-per-call alternative
With x402, payment is part of the HTTP request:
- A client calls
GET /v1/forecast?city=Amsterdam. - Your API answers
402 Payment Requiredwith the price, for example €0.002 in EURC on Base. - The client's wallet signs a payment for that amount and repeats the call with a
PAYMENT-SIGNATUREheader. - Your server has the payment verified and settled, then returns the forecast.
The client needs a wallet with stablecoins, not an account with you. x402 client libraries handle steps 2 and 3 automatically, so for the developer calling your API it is one wrapped fetch.
What you no longer need
- Customer accounts, API key issuing and key rotation.
- Usage metering, invoices and dunning for failed cards.
- Minimum prices: a call can cost €0.001.
- Waiting for payouts: the money is in your wallet within seconds.
You can keep your existing plans for big customers next to it: x402 adds a door for everyone else. The how it works page walks through a request from start to finish.
Adding it to your API
With Penni you set prices per path in a dashboard (/v1/forecast costs €0.002, /v1/history/** €0.01) and add one line to your server:
import { penni } from "@pennipay/x402/express";
app.use(penni({ siteId, apiKey }));
There is middleware for Express, Hono, Next.js and Fastify, plus guides for Python, Go and PHP, and a Cloudflare Worker that works in front of any API without code changes. Penni verifies and settles each payment for €0.002; the price your client pays goes to your wallet in full.
Getting found
Agents look for paid APIs in x402 catalogs. Penni can list your endpoints, with a description and their input and output, so agents know what you sell and how to call it. See discovery. Before you announce your API, run it through the free x402 checker: it shows the 402, the payment options and the discovery metadata exactly as an agent sees them.
Can I still offer a free tier?
Yes. Make some paths free, or set a default price of 0 and only charge the expensive endpoints.
What do my customers need?
A wallet with EURC or USDC on Base or Solana, and an x402 client library (available for JavaScript, Python, Go and others). No account with you or with Penni.
How do I test it?
Penni's test mode uses free testnet tokens on Base Sepolia and Solana Devnet. You can even let Penni's own test agent call and pay your endpoint from the dashboard.