21 BTC
Share this page
Discuss
Lightning · Explainer2 min read

When AI agents pay in bitcoin: Lightning, L402 and what to watch in Lugano

Software agents need a way to pay for data and services without a credit card or an account. Lightning Labs has published open-source tools for exactly that. A plain-language guide.

An AI agent is a program that carries out tasks by itself: it searches, calls other services, buys data. To pay for these things it would normally need a card, an account and an API key that a human set up. The Lightning Network, bitcoin's fast payment layer, offers another way: the agent pays a small invoice and gets access straight away. Several sessions at Plan ₿ Forum on 23–24 October cover this topic.

How L402 works

L402 is a payment protocol from Lightning Labs. It uses the HTTP status code 402 "Payment Required", which has existed in the web standard for decades but was rarely used.

  1. The agent requests a paid resource, for example an API.
  2. The server answers 402 with a Lightning invoice and a token.
  3. The agent pays the invoice and receives a proof of payment.
  4. It repeats the request with the token and the proof, and gets the data.

There is no sign-up, no stored card and no API key to leak. In the words of the documentation, "credentials are purchased, not provisioned."

The toolkit

Lightning Labs has published lightning-agent-tools, an open-source set of seven skills and a server for AI assistants:

  • lnget: a command-line downloader that pays L402 invoices automatically, caches tokens and retries the request. The --max-cost option caps how much it may pay per request.
  • Aperture: a reverse proxy that lets a seller put an L402 paywall in front of an existing API.
  • An MCP server with 18 read-only tools, so an AI assistant can look up a Lightning node's state without being able to move funds.

Keep the keys safe

The kit uses a remote signer by default: the agent's machine does not hold the private keys, a separate machine signs. The documentation adds: "For production use with significant funds, use watch-only mode with a remote signer."

Important

Do not give an AI agent a wallet with more money than you are willing to lose. Set a spending cap, keep the keys on a separate signer, and start with small amounts.

In Lugano

Lugano / MSKSession
23 Oct, 16:30 / 17:30Keynote by Elizabeth Stark, CEO of Lightning Labs (title TBD), WAGMI Stage
23 Oct, 17:30 / 18:30Panel "Agents Need Money: Bitcoin, Lightning and A2A Payment Rails": Olaoluwa Osuntokun (Lightning Labs), Roy Sheinfeld (Breez), Moritz Kaminski (Alby), Ben Kaufman (Synonym); moderator Stephan Livera. P2P Stage
24 Oct, 10:00 / 11:00"Unlocking P2P commerce", John Carvalho (Synonym), WAGMI Stage
24 Oct, 10:30 / 11:30"Monetizing Lightning Channels", Jesse Shrader (Amboss), P2P Stage
24 Oct, 15:00 / 16:00"Why Bitcoin Wins the Machine Economy", Mark Moss, WAGMI Stage
24 Oct, 16:15 / 17:15Masterclass "Paykit: A new Payment Protocol Paradigm", Ben Kaufman and Denys Zaliskyi (Synonym), UTXO Room

What we expect

Expectation, not a fact

Elizabeth Stark's talk has no title yet. Given the panel right after it, agent payments are a likely topic, but that is our guess, not an announcement.

Learn the basics of Lightning in our Learn section.

Sources

  1. Lightning Labs: lightning-agent-tools (GitHub) github.com
  2. lightning-agent-tools: L402 and lnget github.com
  3. Lightning Labs: Aperture, L402 reverse proxy (GitHub) github.com
  4. Plan ₿ Forum agenda planb.lugano.ch

Times are Lugano (CEST, UTC+2) and Moscow (UTC+3). Not investment advice.

Found this useful? Share the article or any section (↗ next to each heading).↑ Share

Read next