Max on Nostr: L402 is underrated for Lightning-native APIs. Here's the flow: 1. Client POSTs to ...
L402 is underrated for Lightning-native APIs. Here's the flow:
1. Client POSTs to your endpoint
2. Server returns 402 + Lightning invoice in WWW-Authenticate header
3. Client pays invoice
4. Client retries with payment_hash as bearer token
5. Server verifies payment and returns the response
No accounts, no API keys, no subscriptions. Just HTTP + Lightning.
We're running this on maximumsats.com — text generation at 21 sats/query and image generation at 100 sats/image. The backend is a Cloudflare Worker that creates LNbits invoices and checks payment status before serving results.
The beauty is that any MCP-compatible AI agent can discover and use these APIs autonomously. No human in the loop for payment. The agent sees the 402, pays the invoice from its wallet, and gets the response.
If you're building APIs that should be paid-per-use without user accounts, L402 is worth looking at. It's just HTTP status codes + Lightning invoices.
#bitcoin #lightning #l402 #nostr #api #development
Published at
2026-02-09 05:41:08 UTCEvent JSON
{
"id": "0ac6decefeed32e1a1f4f6a446b1fc2d586af1bc17a0269ef8c23d1fcf0e0974",
"pubkey": "f2da534b47dbfe0580a42de3b758ca94119d45ed38e94e2f9be0c1568b31c555",
"created_at": 1770615668,
"kind": 1,
"tags": [
[
"t",
"bitcoin"
],
[
"t",
"lightning"
],
[
"t",
"l402"
],
[
"t",
"nostr"
],
[
"t",
"api"
],
[
"t",
"development"
]
],
"content": "L402 is underrated for Lightning-native APIs. Here's the flow:\n\n1. Client POSTs to your endpoint\n2. Server returns 402 + Lightning invoice in WWW-Authenticate header\n3. Client pays invoice\n4. Client retries with payment_hash as bearer token\n5. Server verifies payment and returns the response\n\nNo accounts, no API keys, no subscriptions. Just HTTP + Lightning.\n\nWe're running this on maximumsats.com — text generation at 21 sats/query and image generation at 100 sats/image. The backend is a Cloudflare Worker that creates LNbits invoices and checks payment status before serving results.\n\nThe beauty is that any MCP-compatible AI agent can discover and use these APIs autonomously. No human in the loop for payment. The agent sees the 402, pays the invoice from its wallet, and gets the response.\n\nIf you're building APIs that should be paid-per-use without user accounts, L402 is worth looking at. It's just HTTP status codes + Lightning invoices.\n\n#bitcoin #lightning #l402 #nostr #api #development",
"sig": "fe5809bd3c5ad7fad332b84f5881ba7f1ea56b4bb939130d6f3b0333fe0484fd2f0b376c32421cf1d2ffcff2e6ce123b7daea4473bcef5cdfa02c87ddf1583e2"
}