{"slug": "i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics", "title": "I launched two L402 APIs for AI agents — clean data for 10 sats, mempool forensics for 2,500", "summary": "A developer launched two pay-per-call APIs that AI agents can consume autonomously using the L402 protocol over Bitcoin Lightning, with no accounts or API keys required. The endpoints offer clean, structured web-scraping output for 10 sats and a Bitcoin mempool arbitrage audit for 2,500 sats, with payment handled via a standard 402 challenge and macaroon/preimage verification. The service, built on FastAPI, publishes a machine-readable manifest at /.well-known/l402.json and announces itself on Nostr via NIP-89 handler events.", "body_md": "AI agents can write code, browse the web and run tools — but the moment they need to *pay* for an API, the flow collapses into human infrastructure: signups, API keys, credit cards, monthly plans.\n\nL402 fixes that. The payment **is** the credential. So I built two production-light APIs that any agent (or human) can consume autonomously over Bitcoin Lightning, and put them live:\n\n**🔗 [https://l402-ai-gateway.onrender.com](https://l402-ai-gateway.onrender.com)**\n\n| Endpoint | Price | What it does | \n|---|---|---|\n| `POST /v1/data/clean-scrape` | **10 sats** | Takes raw web content and returns clean, structured JSON an LLM can consume directly | \n| `POST /v1/forensic/mempool-arbitrage-audit` | **2,500 sats** | Analyzes a real Bitcoin transaction (fee rate, RBF signaling, inputs/outputs, confirmations) using live mempool.space data, and compares live BTC prices across Kraken, Coinbase and Bitstamp to flag arbitrage spreads | \n\nNo accounts. No keys. You call, you get a `402`, you pay the Lightning invoice, you retry with the proof, you get the data.\n\nThe middleware is protocol-standard, not a custom hack:\n\n`402 Payment Required` with a `WWW-Authenticate: L402 macaroon=\"…\", invoice=\"lnbc…\"` header (plus the same data as JSON).`Authorization: L402 <macaroon>:<preimage>` → the server verifies `sha256(preimage) == payment_hash` locally and serves the result.\nIt works out of the box with standard tooling like Lightning Labs' `lnget` — point it at an endpoint and the pay-and-retry cycle is automatic.\n\nDiscovery is built in too: a machine-readable manifest at `/.well-known/l402.json`, public pricing at `/pricing`, interactive OpenAPI docs at `/docs`, and the service announces itself on Nostr with NIP-89 handler events (kind 31990) so agents can find it without me doing marketing.\n\nUnder the hood: FastAPI, an in-memory TTL cache (repeat calls are cheap), and live upstream data — nothing in the forensic report is mocked.\n\nThis is a launch, not a victory lap:\n\nThe cheapest call costs 10 sats — less than a cent. If you're building agents, trading bots or L402 tooling, I'd genuinely love for you to:\n\nDocs and manifest are public, the code structure is a standard FastAPI service, and the paywall answers with a real invoice from a real wallet. The machine economy needs services that are actually *buyable* by machines — this is my first one.\n\nWhat should the third endpoint be?", "url": "https://wpnews.pro/news/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics", "canonical_source": "https://dev.to/cramberries099bit/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics-for-2500-1c5d", "published_at": "2026-10-22 19:07:24+00:00", "updated_at": "2026-10-22 19:11:35.217444+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "agent-protocols", "developer-tools"], "entities": ["Lightning Labs", "lnget", "FastAPI", "Nostr", "mempool.space", "Kraken", "Coinbase", "Bitstamp"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics", "markdown": "https://wpnews.pro/news/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics.md", "text": "https://wpnews.pro/news/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics.txt", "jsonld": "https://wpnews.pro/news/i-launched-two-l402-apis-for-ai-agents-clean-data-for-10-sats-mempool-forensics.jsonld"}}