0x72e395b972e3…72e395bc
Lightning Labs Lets AI Coding Agents Pay for Inference in Bitcoin
Lightning Labs' pi402 extension lets the Pi coding agent pay for AI inference in Bitcoin over Lightning, billing per token with no accounts, API keys or credit cards.

Outputs
Lightning Labs launched pi402, an open-source extension letting the Pi coding agent pay for AI inference in BTC over Lightning.
Demo pricing: about $0.375 per million input tokens and $1.50 per million output tokens.
The flow uses HTTP 402 payment requests, Lightning invoices, the L402 protocol and macaroons for authentication.
Providers can pair Aperture, an L402 reverse proxy, with Lightmeter to bill OpenAI-compatible endpoints.
The launch follows Lightning Labs' October mainnet debut of Wavelength, which lets agents transact in BTC without human approval.
Lightning Labs has shipped pi402, an open-source extension that lets the Pi coding agent pay for AI inference in Bitcoin (BTC) over the Lightning Network. The release gives developers a per-token billing mechanism for machine consumers of AI services — no account, no API key, no credit card on file.
The mechanics are deliberately simple. When an agent requests a paid service, the server answers with an HTTP 402 payment request and a Lightning invoice. The agent settles the invoice and gets access. That's the whole loop.
Under the hood, pi402 builds on the L402 protocol and uses macaroons — a type of credential token — for authentication. Billing runs on tokens actually consumed, not on a monthly plan or a prepaid balance. For an agent making intermittent, unpredictable calls, that metering model maps cleanly onto how inference costs actually accrue.
What does this change for inference providers?
The short answer: they can now sell to software instead of to people. Providers pair Aperture, Lightning Labs' L402 reverse proxy, with Lightmeter to meter usage and accept payments on OpenAI-compatible endpoints. The Wavelength wallet handles settlement and moves funds between Ark and Lightning. Neither the buyer nor the seller has to run a Lightning node or manage payment channels — historically the steepest barrier to Lightning adoption outside the payments niche.
The pricing in the demo makes the economics concrete. Input tokens cost roughly $0.375 per million; output tokens run about $1.50 per million. Those are metered, per-request rates. A coding agent that spikes its usage at 3 a.m. simply pays for what it burns, and the provider collects without provisioning accounts or chasing invoices.
A second step in a deliberate sequence
This isn't a standalone experiment. Pi402 follows Lightning Labs' October mainnet launch of Wavelength, a wallet built specifically for AI agent payments. Wavelength lets agents send and receive BTC over Lightning without a human approving each transaction — the piece pi402 now plugs into a real developer workflow.
Put the two together and the trajectory is clear. Lightning Labs is assembling a stack where autonomous software agents hold wallets, receive HTTP 402 challenges, pay Lightning invoices, and consume services end to end. The human operator sets the budget once. The agent handles the rest.
Why HTTP 402, and why it matters
The 402 status code — "Payment Required" — has sat in the HTTP specification, largely unused, since the web's early days. L402 revives it as a machine-native paywall: a challenge-response handshake that software can complete without a checkout page, a subscription form, or a fraud-review queue.
That matters for the emerging AI agent economy. Agents can't type card numbers, and API-key billing was designed for developers, not for autonomous workloads that spawn, spend, and terminate in minutes. Credential-based, pay-per-token access removes the account as a unit of commerce entirely.
What to watch next
The open question is adoption beyond the demo. Aperture and Lightmeter are available now for any inference provider running OpenAI-compatible endpoints, and pi402's code is open source — meaning any agent framework, not just Pi, can wire it in. If even a handful of independent providers turn on 402-gated endpoints in the coming months, per-token Bitcoin metering stops being a Lightning Labs showcase and becomes infrastructure.
via tokenpost.com (Source)
More from Marcus Bennett
Show full bio
Senior reporter covering money, funding and market shifts around crypto and web3 industry at Mempool Brief.
1,031 articles