Lampo

L402 explained: pay-per-request APIs over Lightning

L402 is a way to sell API access without accounts: the server asks for a Lightning payment in the HTTP response itself, and the proof of payment becomes the credential.

The flow

  1. Ask. Send the request without credentials. The server answers 402 Payment Required with a header like WWW-Authenticate: L402 macaroon="...", invoice="lnbc...".
  2. Pay. Pay the invoice with any Lightning wallet and keep the preimage, the secret your wallet receives when the payment completes.
  3. Retry. Send the same request with Authorization: L402 <macaroon>:<preimage>. The server checks that the preimage matches the invoice and serves the request.

Try it with curl

# 1. Ask: get the macaroon and the invoice
curl -si https://lampo.run/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"deepseek-ai/DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"hi"}]}'

# 2. Pay the invoice with your wallet and copy the preimage

# 3. Retry with the credential
curl https://lampo.run/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H "Authorization: L402 $MACAROON:$PREIMAGE" \
  -d '{"model":"deepseek-ai/DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"hi"}]}'

Bundles: pay once, call many times

Lampo uses Lightning Labs' Aperture with metered pricing: one payment buys a bundle of tokens, and the same credential keeps working, debited per request, until the bundle runs out. Then you get a new 402.

And MPP?

Lampo also offers the Payment HTTP Authentication Scheme (MPP) in the same 402 response, for clients that prefer it.

Live prices: lampo.run shows every model and bundle, updated every 10 minutes. The cheapest bundle is 1,000 sats (about $0.60) for about 2.5 million tokens of DeepSeek V4 Flash.
See models and prices