On this page
Lightning Labs has released pi402, an open-source extension that lets the Pi coding agent pay for AI inference with Bitcoin over the Lightning Network. Most outlets date the launch to November 12. It is an early but concrete example of software agents paying for services on their own.
Key takeaways
- pi402 is an open-source extension for the Pi coding agent.
- The agent pays per request, with no account, API key or card.
- It builds on the L402 protocol, which combines the HTTP 402 “Payment Required” status with a Lightning invoice.
- It currently targets Pi; providers must set up the billing side themselves.
How it works
When the agent calls a paid model endpoint, the server answers with an HTTP 402 response and a Lightning invoice. The agent pays the invoice and then receives access, one request at a time. There is no subscription and no prepaid balance: the agent pays for the tokens it actually uses.
On the seller side, providers can put Aperture, an L402 reverse proxy, in front of an OpenAI-compatible endpoint and meter usage with a companion tool called Lightmeter. Settlement is handled by Wavelength, so neither buyers nor sellers need to run a Lightning node or manage payment channels. Wavelength’s mainnet wallet for agent payments launched in October.
Pricing in the demo
One outlet reports demo pricing of about $0.375 per million input tokens and $1.50 per million output tokens. That figure appears in a single report and is a demo number, not a published market price.
Why it matters
Autonomous agents are awkward customers for card-based billing: they cannot fill out signup forms, and a stolen API key can run up a large bill. Per-request micropayments remove the account step and cap exposure to whatever the agent has been funded with. Bitcoin and Lightning are one option; the broader idea of using HTTP 402 for machine payments is what other payment systems are also exploring.
Limits and open questions
- pi402 mainly serves Pi users today.
- No adoption numbers or list of supporting inference providers has been announced.
- Bitcoin price swings and Lightning liquidity are practical concerns for anyone funding an agent wallet.
This article is informational and not financial advice.



