# Lightning Labs launches pi402 so AI agents can buy inference with Bitcoin

> Source: <https://cryptobriefing.com/lightning-labs-pi402-ai-agents-bitcoin-inference/>
> Published: 2026-11-12 22:51:26+00:00

# Lightning Labs launches pi402 so AI agents can buy inference with Bitcoin

Bitcoin logo (public domain), by Grayliptrot via Wikimedia Commons (Public domain)

The open-source Pi extension lets coding agents pay per token over Lightning, with no accounts, API keys, or cards involved

Lightning Labs has released pi402, an open-source extension that lets AI coding agents pay for their own inference in [Bitcoin](https://cryptobriefing.com/markets/bitcoin/) over the Lightning Network.

There is no account signup, no API key, and no credit card. The agent sees a price, pays the invoice, and gets back to work.

The tool was unveiled on November 12, 2026, and is built for the Pi coding agent. It targets a specific and growing problem. Software agents increasingly need to buy compute, but nearly every compute vendor still assumes a human is holding the wallet.

## How pi402 actually works

The engine underneath pi402 is L402, a protocol Lightning Labs has been developing for some time. It pairs two pieces of plumbing that were not originally designed to meet.

The first is the HTTP 402 “Payment Required” response. The second is a Lightning invoice, which is a request for a specific amount of Bitcoin payable over the Lightning Network.

When an agent hits a paid endpoint, the server answers with a 402 and an invoice attached. The agent pays it, and the payment settles instantly.

Authentication runs through macaroons, a type of credential token. The result is pay-per-token billing. Instead of a monthly plan or a prepaid credit balance, the agent pays for exactly the tokens it consumes, request by request.

### The crypto and markets news you actually need—every morning.

Daily. Free. Join 34,000+ readers across crypto, finance, and policy.

Once the setup is configured, no human needs to step in. The agent handles the purchase loop on its own.

## The seller side and the wallet question

Payments need someone on the other end to accept them. For that, Lightning Labs is pointing sellers to two of its own tools.

Aperture is an L402 reverse proxy. It sits in front of a service and handles the “pay first, then get access” logic before requests reach the backend.

Lightmeter works alongside Aperture to meter usage and accept payments. Together they let a provider charge for access to an [OpenAI](https://cryptobriefing.com/markets/openai/)-compatible inference endpoint.

Neither buyers nor sellers need to run a Lightning node or manage payment channels. Instead, the Wavelength wallet takes care of payments. Wavelength is built on Ark and automatically moves funds between Ark and Lightning.

As for cost, the demo pricing is approximately $0.375 per million input tokens and $1.50 per million output tokens.

## A year of building toward this

pi402 did not appear out of nowhere. It caps a run of releases from Lightning Labs across 2026 that all lean in the same direction.

In February, the company launched agent tooling aimed at letting software interact with Lightning payments. In October, Wavelength went live on mainnet.

Each step filled a gap. The agent tools gave machines a way to transact, Wavelength removed the node-management burden, and pi402 now packages it all into something a coding agent can use for a concrete purchase: inference.

**Disclosure:** This article was edited by Vivian Nguyen. For more information on how we create and review content, see our [Editorial Policy](https://cryptobriefing.com/editorial-policy/).
