The Ledger
Lightning Labs ships Pi extension for bitcoin-paid AI inference
Lightning Labs released pi402, an extension that lets coding agents using Pi pay for AI inference with bitcoin over Lightning. The package includes per-token metering, spending limits and an embedded wallet, while sellers can use Aperture to charge for API access.

Bitcoin payments inside the coding harness
AI coding agents can now buy model inference with bitcoin inside the Pi coding harness, using Lightning payments that settle in seconds, according to Lightning Labs’ pi402 announcement. The company published the release on November 12, 2026, describing pi402 as an extension for Pi, a coding-agent harness with a plugin system. Lightning Labs says buyers do not need to create accounts, manage API keys or enter card numbers to pay.
The extension connects to Pi’s model-provider system and uses L402 to access paid inference APIs. A custom provider manages the request from the initial call through payment and retry, while applying a ceiling to each request and a daily spending budget. The extension also displays the wallet balance and payments in a footer; Lightning Labs says the agent otherwise experiences the process as a normal turn.
Two payment protocols and token pricing
Aperture version 0.6.0 adds support for MPP alongside L402. The release identifies MPP as the Machine Payments Protocol from Stripe and Tempo, and says Aperture can advertise both protocols so a buyer can select the option its software supports. Lightning Labs describes MPP’s HTTP scheme as an IETF draft, rather than a finalized standard.
The release adds pricing APIs for charging based on the input and output tokens used, rather than treating every inference request as the same size. Lightning Labs’ example accounting rate is 1 msat per input token and 2 msat per output token, which the company calculates as roughly $0.80/$1.61 per million tokens at the same exchange rate used in its example. The figures are an illustration of the pricing model, not a stated price for every model or provider.
Aperture’s embedded meterd price server handles four parts of the process: returning a quote when a payment challenge is created, deducting the token allotment used, checking whether the credential can cover a request, and subtracting the final cost after the response. It accepts a JSON file with input and output rates for each model. Lightning Labs says providers can replace the basic pricing logic through the same hook.
Lightmeter is the company’s reference implementation for provider pricing. It reads model costs and an upstream provider’s catalog, then uses a BTC/USD spot rate to convert prices quoted in dollars per million tokens into millisatoshis per token. The daemon can add a seller margin, according to the release, and its accounting data is stored in a SQLite database with an append-only layer.
Wallets for buyers and sellers
The pi402 extension embeds a Wavelength wallet in Pi through a custom wasm extension. Buyers can use the new /fund command to create an invoice that deposits funds into a wallet managed by the harness. For an on-chain deposit, /deposit returns an address; the release says funds sent there are automatically swept into the Wavelength wallet.
On the seller side, Aperture can connect directly to a Wavelength wallet. Lightning Labs says the wallet manages sellers’ inbound liquidity. The company’s setup instructions tell buyers to install pi402 through Pi, fund the wallet and connect to a seller; sellers can place Aperture v0.6.0 in front of an existing inference API and use Lightmeter for pricing.
Sources
- Original source Lightning Labs lightning.engineering
Companies in this story
Related stories
- Lightning force-closes cost 2–6 times more in fees, preprint finds
- Core Lightning flaw let a peer crash nodes by reusing a funding outpoint
- LNbits issues 1.7.1 security patch after wallet vulnerability
- Circle details Anduin payment-graph reputation test for AI agents
- ENS Forum Post Outlines Shared Schema for Agent Cards