On November 12 Lightning Labs released pi402, an extension for the Pi coding agent with an embedded Wavelength Lightning wallet. When the agent calls a paid inference API, it pays automatically over L402 or MPP, and the proof of payment doubles as the API key, so there is no sign-up and no credit card. Sellers put Aperture v0.6.0 in front of an existing inference API and price per token with meterd or lightmeter. The whole stack is open source (MIT). Lightning Labs' example rate of 1 msat per input token and 2 msat per output token works out to about $0.80/$1.61 per million tokens at a bitcoin price of about $80,500.
Key Takeaways
- ✓Quick start: buyers run pi install npm:@lightninglabs/pi-402, then top up with a Lightning invoice via /fund or on-chain via /deposit
- ✓Two protocols: Aperture v0.6.0 (released November 5) supports both L402 and MPP, the Machine Payments Protocol from Stripe and Tempo (IETF draft-httpauth-payment-00)
- ✓Per-token billing: the example rate of 1 msat per input token and 2 msat per output token is about $0.80/$1.61 per million tokens at a bitcoin price of about $80,500
- ✓Budget controls: the extension enforces a per-request ceiling and a daily budget, and a footer shows the wallet balance and each payment live
- ✓Fully open source: the pi-402 extension, Aperture and the lightmeter reference server are open source, with pi-402 under MIT; the demo pays for Kimi K3.1 Pro inference
Key Decision Metrics at a Glance
Turn your technical choice into a development budget
Compare 40 dev plans & simulate token costs vs $20/mo subscriptions
Project Links & Resources
Direct AccessIn-Depth Technical Analysis
Background and the problem
In Lightning Labs' official post, co-founder Olaoluwa Osuntokun argues that inference compute cannot be taken back once spent, while card payments can be charged back, so sellers fall back on sign-up walls, fraud checks and minimum top-ups. The post cites an August screenshot from OpenCode CEO Dax claiming $323 million in fraud blocked by Stripe over a few days (OpenCode's figure). For agents that want to buy their own compute, accounts, API keys and cards are all friction.
Architecture and how it works
pi402 builds on L402: an unpaid request gets an HTTP 402 with a Lightning invoice and an incomplete macaroon credential, and the preimage revealed by paying completes it, so payment is authorization. Aperture v0.6.0 supports both L402 and MPP from Stripe and Tempo, and the buyer picks the one it speaks. A new meterd price server hooks into quoting, deduction, balance checks and final settlement to bill per token. Lightmeter is the reference implementation: it reads upstream price lists, converts dollar prices to millisatoshis at the BTC/USD rate and keeps accounts in SQLite. On the buyer side, the extension embeds a Wavelength wallet via wasm, and the agent never sees the payment step.
Benchmarks and measured results
This is payments infrastructure and Lightning Labs has published no performance benchmarks. The quantifiable figure is its example rate: 1 msat per input token and 2 msat per output token, about $0.80/$1.61 per million tokens at a bitcoin price of about $80,500. Real prices move with the exchange rate and each seller's pricing. Lightning payments settle with finality within seconds.
Getting started for developers
Buyers run pi install npm:@lightninglabs/pi-402, fund the wallet with /fund, point it at an L402 seller and set a per-request ceiling and daily budget. Sellers put Aperture v0.6.0 in front of an existing inference API and price it with a meterd JSON file or lightmeter, without changing the API. Bitcoin price swings affect real costs, so production agents should run with a budget cap.
Benchmark side-by-side against alternatives, or calculate monthly token cost vs subscription break-even.
Discussion & Comments
0Sign in to join the discussion
Connect with AI developers to exchange benchmark insights.