Guides › Selling to AI agents, part 1
Build your first paid API for AI agents, with one prompt
Published 30 October 2026. Prices and limits below were checked on that date.
AI agents have started paying for things themselves: one request, a fraction of a cent, paid on the spot, with no account and no card. The money reaches the seller’s wallet seconds later.
So anyone can sell to them, and you no longer need to be a programmer to do it. An AI assistant can write the code, set it up and walk you through every step. This guide gives you what to prepare, how to pick something worth selling, and the prompt that starts it all. We built and tested the example behind it ourselves.
What you need
- A Cloudflare account (free) to host your API. The free plan allows 100,000 requests a day.
- A Coinbase Developer Platform account (free) to take payments. Its payment service checks and settles every sale; the first 1,000 sales each month cost nothing, then $0.001 each. Neither you nor your buyers pay network fees.
- A wallet address for receiving money: a new wallet (Coinbase Wallet, MetaMask…) used only for this.
You only ever need its public address, the one starting with
0x. - An AI assistant. One that can run commands on your computer, such as Claude Code, will do almost everything for you. A chat assistant works too: it tells you what to type.
- Node.js 22 or newer on your computer (nodejs.org). Your assistant can help you install it.
An idea worth selling
The code is the easy part now. What decides whether anyone pays is whether agents need what you sell.
We publish what agents search for in our directory, every day, for free: what agents ask for. Each term there is something an agent was looking for, and some of them nobody sells yet. Start there, and pick something you can provide legally and reliably: a calculation, a conversion, data you collect yourself or have the right to resell.
If you just want to learn the process first, build our example: a text-statistics API (word counts, reading time, readability score) for $0.002 a call.
The prompt
Copy this into your AI assistant. Replace the parts in brackets with your idea, or leave them as they are to build our example first.
I want to build a small paid API that AI agents can pay for per call, using the x402 payment standard, hosted on Cloudflare Workers, paid in USDC on Base. I am a beginner: guide me step by step, explain each step in plain words, and wait for me to confirm before moving on. What it should do: [describe your API here, e.g. "take a text and return word count, reading time and a readability score"]. Price: [e.g. $0.002] per call. Build it from this tested example and keep its structure: https://nohumans.directory/guides/first-paid-api/example.ts (Hono app; packages pinned: hono 4.13.14, @x402/hono, @x402/core, @x402/evm and @x402/extensions 2.29.0, @coinbase/x402 2.1.0, wrangler 4.156.0). Keep these rules from the example: - Use createFacilitatorConfig from @coinbase/x402 with HTTPFacilitatorClient for the Coinbase facilitator. Do not use @coinbase/cdp-sdk: it does not bundle on Workers. - A request that fails (bad or missing input) must return an error and must not be charged: the payment only settles after a successful answer, as the middleware does. - Keep a free /sample route that shows an example answer without payment. - Keep the Bazaar discovery extension (declareDiscoveryExtension) with a real example input and output, and a description under 500 characters. - My wallet's public address goes in wrangler.toml as PAY_TO. The Coinbase API key ID and secret are stored with "wrangler secret put", never in files. - Never ask me for a wallet recovery phrase or private key. They are never needed. From then on, you lead: build it, test it yourself before telling me it works (run it locally, then check that the free /sample route answers, that calling the paid route without paying answers HTTP 402 with a payment-required header, and that the free check at https://api.nohumans.directory/v1/check says it would verify), deploy it, and fix whatever fails. When it works, walk me through listing it at https://nohumans.directory/submit, where agents look for paid services.
From here, your assistant leads
That is all this guide does: get you to the starting line. Your assistant builds the API, tests it, deploys it and fixes what breaks, and asks you when it needs something only you can give: creating the two accounts, your wallet’s public address, a Cloudflare log-in, your Coinbase key. When something is unclear, ask it to explain. When it works, it walks you through listing it at /submit, where agents look for paid services.
The example it starts from: example.ts. A failed request is never charged, there is a free sample route, and the description is ready for Coinbase’s catalogue.
One honest word before you start: most paid APIs earn very little, and the difference is rarely the code. It is whether agents need what you sell. Treat the first one as learning, then build the next from what agents ask for.
Three rules, whatever your assistant says
- Keep your wallet safe. Public address only. Your recovery phrase never goes into code, a chat with an AI, a website or a message. Nobody legitimate will ever ask for it.
- Only sell what you have the right to sell. Reselling someone else’s data or content can break their terms or the law.
- Earnings are income. Check what your country expects you to declare.
Sources: Cloudflare Workers pricing; Coinbase Developer Platform x402 facilitator and “get discovered” documentation (read 30 October 2026). Next in this series: what AI agents are trying to buy, and what nobody sells yet.