Selling APIs to AI agents with x402: 69 endpoints, Cloudflare Workers, zero API keys
说明与用途
作者使用 x402 和 Cloudflare Workers 构建了 69 个无密钥 API 端点,使 AI 代理能够即时按调用付费且无需注册。
问题
AI agents need paid data and inference services without traditional API keys or signup, requiring a frictionless payment flow.
结果
The author successfully launched 69 endpoints across data, inference, and composite brief services within 48 hours, achieving 2k requests but no paid calls yet, demonstrating the feasibility of zero-key, pay-per-call API access for AI agents.
工作流
- 1. Agent requests endpoint (e.g., GET /v1/fx/EUR).
- 2. Server responds 402 Payment Required with price and wallet address.
- 3. Agent signs a USDC transfer on Base and retries request with X-PAYMENT header.
- 4. Server verifies payment, returns JSON response.
- 5. Settlement occurs only after a 2xx response, ensuring no charge for failed calls.
证据
An AI agent needs the EUR/EGP rate. It calls GET /v1/fx/EUR. The server answers 402 Payment Required with a price ($0.01) and a wallet. The agent signs a USDC transfer on Base, retries with an X-PAYMENT header, gets JSON.
WorldData402 — 39 data endpoints: FX for 160+ currencies, historical rates, SEC company filings, EU public tenders, World Bank indicators, EU VAT validation, public holidays, geocoding, weather, air quality, earthquakes, Wikipedia, arXiv, Crossref, RDAP, DNS, npm/PyPI, barcodes. $0.01–$0.05 per call.
Inference402 — 15 endpoints on Cloudflare Workers AI: chat (small/large), structured JSON output, summarize, translate (plus an Arabic-tuned route that handles Egyptian dialect), extract, classify, sentiment, keywords, rewrite, embeddings, moderation, image description, Whisper transcription. $0.002–$0.02.
Briefs402 — 10 composite reports (company, country, market, tenders, domain due-diligence, location, research literature, product, package risk, long-document translation). It calls the other two internally and sells the finished brief for $0.10–$0.50.
- 记录日期: 2026-10-20T13:41:34.222Z