No API key, no account, no credit card. The agent asks an API for data, gets 402 Payment Required with a Lightning invoice, pays a few sats, shows the proof, and gets the answer. Machine to machine.
Say it like this:
Scan with any Lightning wallet. The agent is waiting for the payment, then it carries on by itself.
curl -i 'https://codeorange.dev/api/l402?tool=price'
# → HTTP/1.1 402 Payment Required
# → WWW-Authenticate: L402 macaroon="…", invoice="lnbc100n1…"
# pay the invoice, keep the preimage, then:
curl -H 'Authorization: L402 <macaroon>:<preimage>' 'https://codeorange.dev/api/l402?tool=price'
The same pattern powers Lightning Labs' Aperture and pi-402, which let a coding agent pay for its own AI model calls. Data from mempool.space. Payments go to Code Orange's Lightning wallet.