L402 API Access
Use AI tools by paying with Bitcoin. No signup. No API keys.
Pay with Bitcoin. Get AI Results.
Access 30+ AI services using Lightning Network micropayments. No signup, no monthly subscription, no data collection. Just Sats.
Not a developer? You can use all of these tools directly on the web — browse available tools and pay with any Lightning wallet, no setup needed.
New: full reference for L402, MCP, WebLN, async jobs, error codes, dedup, auto-routing and CORS — see /docs.
⚡
No Signup
No accounts, no emails, no passwords
💰
Pay Per Use
No subscriptions. Only pay when you use it
🔒
Private
No personal data collected. Ever
₿
Bitcoin Native
Lightning payments settle in seconds
How It Works
Send Your Request
Call any API endpoint with your data. You'll get back a Lightning invoice to pay.
Pay with Lightning
Pay the invoice with any Lightning wallet. Takes seconds, costs pennies.
Get Your Result
Re-send the same request with your proof of payment. Done.
Building an autonomous agent? MCP handles payment negotiation inline — no header parsing or retry logic needed. See why MCP vs raw HTTP matters or go straight to the MCP docs.
Services & Pricing
All prices in Satoshis (1 Sat ~ $0.001 USD). Click any service for full instructions.
| Service | Price |
|---|---|
| Image Generation | 100-200 Sats/image |
| Text Generation | 5-15 Sats minimum |
| Video Generation | 300-550 Sats/sec |
| Video from Image | 100 Sats/sec |
| Music Generation | 300 Sats/song |
| Text to Speech | 10-100 chars/sat |
| Speech Transcription | 10 Sats/minute |
| Image Analysis | 21 Sats/image |
| 3D Model Generation | 350 Sats/model |
| File Conversion | 100 Sats/file |
| OCR / Text Extraction | 10 Sats/page |
| SMS Service | varies by country |
| Automated Phone Call | varies by country & duration |
| AI Phone Call | ~150-250 Sats/call |
| Send Fax | 500 Sats (≤10 pages) +50/page |
| Receive Fax | 500 Sats (+200 OCR) |
| Email Sending | 200 Sats/email |
| Voice Cloning | 7,500 Sats |
| Image Editing | 200-450 Sats/edit |
| PDF Merge | 100 Sats |
| HTML to PDF | 50 Sats |
| Document Translation | From 4 Sats |
| Receipt OCR | 50 Sats/page |
| Background Removal | 5 Sats/image |
| Image Upscaling | 5 Sats/image |
| Face Restoration | 5 Sats/image |
| NSFW Detection | 2 Sats/image |
| Object Detection | 5 Sats/image |
| Smart Object Removal | 15 Sats/image |
| Photo Colorization | 5 Sats/image |
| Image Deblurring | 20 Sats/image |
Easiest Way: Use lnget
lnget is Lightning Labs' official CLI for L402 APIs — handles request, payment, and authentication in a single command. Install: go install github.com/lightninglabs/lnget/cmd/lnget@latest
Copy and paste any of these examples:
Generate an image:
lnget -X POST https://sats4ai.com/api/l402/generate-image \
-d '{"prompt":"A cat on the moon"}'Generate text:
lnget -X POST https://sats4ai.com/api/l402/generate-text \
-d '{"input":[{"role":"user","content":"Explain Bitcoin"}]}'Transcribe audio:
lnget -X POST https://sats4ai.com/api/l402/transcribe-audio \
-d '{"file":"<base64-audio>","type":"transcription"}'lnget auto-pays the Lightning invoice, caches the token, and returns the result. Subsequent calls to the same endpoint reuse the cached token.
L402 tokens expire after 10 minutes — pay the invoice and submit your request within that window. Media URLs (images, video, audio) expire after 2 hours. Download or display them promptly.
Building autonomous agents? CLW is a Bitcoin wallet built for AI agents — lets them receive, hold, and spend sats programmatically.
Auto-Paying L402 Libraries
These open-source libraries handle L402 payment automatically — your code makes a normal HTTP request, the library detects the 402 challenge, pays the invoice, and retries with proof. No payment logic needed.
npm install l402-requestsl402-requests — three lines of TypeScript. Supports Strike, LND, NWC (Alby Hub, CoinOS), with built-in budget controls and spending logs.
pip install l402-requestsl402-requests — same auto-paying flow for Python.
dotnet add package l402-dotnetl402-dotnet — same auto-paying flow for .NET.
import { get } from 'l402-requests';
// That's it. The library pays the Lightning invoice automatically.
const response = await get("https://sats4ai.com/api/l402/generate-text", {
method: "POST",
body: JSON.stringify({ input: [{ role: "user", content: "Explain Bitcoin" }] })
});Manual Flow (Step by Step)
If you prefer to handle payments yourself (or want to understand how L402 works under the hood):
Send your request to the API endpoint
You'll get a 402 Payment Required response with a Lightning invoice and a macaroon (access token).
Pay the Lightning invoice
Use any Lightning wallet (Phoenix, Muun, Wallet of Satoshi, Alby, etc.). For autonomous AI agents, see CLW. Save the preimage (proof of payment) your wallet gives you.
Re-send the exact same request with your payment proof
Add this header: Authorization: L402 <macaroon>:<preimage>
Click any service below for the exact copy-paste commands.
Refunds & Error Handling
All services use prepaid invoices — payment settles instantly before the AI task runs. If the task fails after payment, you get an automatic refund via LNURL-withdraw.
What happens on failure
If the AI provider returns an error after you've paid, the response includes a refund object with an lnurl_withdraw field — a bech32-encoded LNURL-withdraw URL you can use to pull your sats back.
For agents
Check response.error_code to decide how to recover, then parse response.refund.lnurl_withdraw to claim the refund programmatically with any LNURL-compatible wallet or library.
Error codes
TIMEOUT — retry later or try a different model
CONTENT_FILTERED — rephrase prompt (safety filter triggered)
RATE_LIMITED — wait and retry
INVALID_INPUT — fix parameters
SERVICE_ERROR — try different model or contact support
For humans
On the web dashboard, the LNURL-withdraw link is displayed as a QR code you can scan with any Lightning wallet.
Rate limiting
The first 2 failures per 15-minute window receive a full refund. After that, a 2 sat routing fee is deducted from each refund to discourage abuse. This resets every 15 minutes.
// Example error response with refund
{
"error": "Image generation timed out",
"error_code": "TIMEOUT",
"refund": {
"charge_id": 12345,
"refund_amount": 200,
"lnurl_withdraw": "lnurl1dp68gurn8ghj7...",
"status": "pending"
}
}What is L402?
L402 is a standard that lets you pay for API access with Bitcoin instead of signing up for accounts and handing over personal data. It combines:
- Lightning Network — instant Bitcoin payments (fractions of a penny)
- Macaroons — tamper-proof access tokens (like a receipt)
The result: pay-per-use AI with full privacy. No accounts, no API keys, no credit cards, no monthly bills. You only pay for what you use, and we never know who you are.
For Developers: All endpoints and pricing are available as machine-readable JSON at /.well-known/l402-services, /api/l402/models, /api/models/routing, and /api/discover (semantic tool search). View L402 code examples (Python, Node.js, curl) or the MCP server repo on GitHub. Found a bug? Report it on GitHub or join the discussions.
Get Started
Pick a service to see full instructions with copy-paste examples.
Image Generation
Create images from text prompts
Text Generation
AI chat and text completion
Video Generation
Generate videos from text
Video from Image
Animate images into video
Music Generation
Full songs with AI vocals, BPM/key control
Text to Speech
3 tiers: OmniVoice Global (602+ langs), Inworld Max Premium (#1 ELO), Minimax Studio (voice cloning)
Speech Transcription
Transcribe audio to text
Image Analysis
Ask AI about any image
3D Model Generation
Turn photos into 3D models
File Conversion
Convert between file formats
OCR / Text Extraction
Extract text from PDFs and images
SMS Service
Send text messages globally
Automated Phone Call
Place calls with TTS or audio playback. Pricing scales with duration and destination.
AI Phone Call
Send an AI voice agent to make a two-way phone call with transcript and analysis
Send Fax
Send a fax worldwide — PDF (from URL) or typed text. No fax machine required
Receive Fax
Open a 24h window to receive a fax at our shared number, delivered to your email. Optional OCR
Email Sending
Send a one-off email to any address — no account, no domain setup, no monthly fee
Voice Cloning
Clone a voice from an audio sample for use with TTS
Image Editing
Edit images with AI — background removal, style transfer, object removal
PDF Merge
Merge multiple PDFs into a single document
HTML to PDF
Convert HTML or Markdown to PDF documents
Document Translation
Translate text across 119 languages with ultra-fast AI
Receipt OCR
Extract structured data from receipts and invoices
Background Removal
Remove background from any image, get transparent PNG
Image Upscaling
Upscale images 2x or 4x with neural super-resolution
Face Restoration
Restore blurry or damaged faces to sharp, natural quality
NSFW Detection
Classify image safety (normal/suggestive/explicit). Falcons.ai — 100x cheaper than an LLM
Object Detection
Detect and locate objects by name with bounding boxes. Grounding DINO (ECCV 2024)
Smart Object Removal
Remove objects by describing what to remove — no mask needed. Grounding DINO + Bria Eraser
Photo Colorization
Colorize black-and-white or grayscale photos with vivid, natural color. DDColor (ICCV 2023)
Image Deblurring
Fix blurry or out-of-focus photos. NAFNet (ECCV 2022, SOTA). Real pixel reconstruction