en
Back to the list

Lightning Labs' pi402 Lets Coding Agents Pay in Bitcoin

source-logo  thedefiant.io 19 November 2026 01:59, UTC
image

Lightning Labs has released pi402, an open-source extension that lets the Pi coding agent pay bitcoin over the Lightning Network for AI inference—running a model to generate an answer. Buyers do not need an inference-service account, API key or card.

The company announced the extension on Nov. 12, 2026. That day, chief technology officer Olaoluwa Osuntokun also invited users to try his live endpoint. His separately configured public mainnet endpoint advertises DeepSeek v4.1 Flash inference served through Venice.

The release packages Lightning Labs' existing payment tools into a coding-agent extension. Buyers fund an embedded wallet. If the underlying model API requires credentials, the seller's gateway holds them rather than passing them to the buyer.

Know when your
coins move

Alerts, real-time prices, and market news — all in one app
qr-code Point your phone camera to install
4.8 based on 40K reviews in the App Store and Google Play

How the Agent Pays

According to the project's README, the agent sends an inference request to Aperture, the seller's gateway. If payment is needed, the gateway returns an HTTP 402 'Payment Required' response with a Lightning invoice. The extension checks its spending policy, pays through its embedded Wavelength wallet, caches the payment credential and retries the request. The model's response can then stream back.

With a metered seller, one bitcoin payment can cover multiple prompts. “One payment buys a bundle of tokens,” the README says. The seller's price server debits that prepaid balance based on reported input and output usage, with estimates used for completed streams without usage reports and some interrupted streams. The gateway asks for another payment when the bundle runs out, according to Aperture's metering documentation.

In Lightmeter's documented implementation, bundles are prepaid credit priced at a blended rate, with input and output tokens drawing them down at different rates, so the actual number of tokens covered depends on the mix.

Wavelength uses a swap server to pay Lightning invoices, so the buyer does not have to run a Lightning node or manage payment channels. The installation guide says the spending ceiling is checked against the invoice plus the swap fee; users can also set a daily cap.

The software defaults to a local development network, with mainnet use requiring explicit configuration. The extension registers Kimi, GLM and DeepSeek models, but which ones are actually served depends on the seller. Sellers can put the gateway in front of an OpenAI-compatible API and configure token prices and a markup.

Osuntokun's seller page quotes $0.375 per million input tokens and $1.50 per million output tokens, including a 25% markup on the seller's stated upstream costs. Dollar prices are fixed, while bitcoin amounts follow the spot exchange rate. The seller advertises a 500,000-token bundle usable for 30 days. These are that seller's terms, not network-wide prices; the examples on the pi402 product site use illustrative rates.

Bitcoin Settlement, Not a New 402 Standard

Lightning Labs' earlier L402 protocol already combined HTTP 402 responses with Lightning invoices. A buyer pays an invoice, then presents an authorization token and cryptographic proof of payment to access the service. The Defiant covered the launch of a dedicated L402 website in July; pi402 adds a Pi-specific buyer with an embedded wallet rather than inventing that payment mechanism.

For payment authorization, pi402 also supports MPP's Payment HTTP Authentication Scheme. It prefers an MPP charge offer by default, otherwise using L402 when available; MPP's session mode is not supported by the extension.

The x402 protocol similarly lets services charge without a checkout page, but does not prescribe a single payment rail. Coinbase's documentation describes a flow in which a client signs a payment and a facilitator verifies and settles it. The docs describe USDC as the most common asset, but x402 is network- and asset-flexible, including support for EVM networks and Solana. Its repository also contains a specification for bitcoin payments over Lightning.

thedefiant.io