Lightning Labs launches pi402 to let coding agents pay inference costs over Lightning
Key Facts
Lightning Labs announced on November 12, 2026, the launch of the pi402 toolkit, which enables coding agents running through Pi to pay for AI inference with bitcoin over the Lightning Network. The company said payments are made from within the coding agent, without accounts, API keys or card numbers. The tool targets this specific use case, connecting the agent to paid inference services rather than offering a general solution for all AI models or agents. Access to inference APIs relies on the L402 protocol, while the integrated Wavelength wallet handles Lightning payments. The move is part of Lightning Labs' efforts to connect payments directly to model requests, settling usage costs over the network while the agent runs.
According to Lightning Labs' explanation, the request cycle starts when the pi402 extension gives a Pi agent access to paid inference APIs through L402. When payment is required, the integrated Wavelength wallet handles bitcoin payments over Lightning. A dedicated provider then gathers the final credentials from the encrypted secret revealed after payment, allowing the request to proceed to the service API. This design combines payment with proof of entitlement to access the API in a single process. The announcement describes the wallet as part of the payment flow, with spending policies that set a per-request cap and a daily budget instead of allowing open-ended spending.
To calculate usage, the company added an integrated service called meterd that communicates with Aperture at four key points in each request. It first quotes a price for the usage package, then tracks token consumption and checks the remaining balance before settling the request's final cost. This arrangement ties the bill to the input and output tokens the request actually consumed. In an illustrative pricing model, Lightning Labs set a rate of 1 msat per input token and 2 msat per output token. The company estimated that this equates to about $0.80 and $1.61 per million tokens, respectively, based on the exchange rate used in the example. These are illustrative pricing figures, not a uniform rate for all inference services.
The controls announced by the company include a per-request spending cap and a daily budget enforced by a dedicated provider in the request flow. Lightning Labs said the agent framework itself can enforce budgets and rate limits. These restrictions let the agent's owner control how much can be spent while it runs, while the cost of each request remains tied to service usage. Aperture version 0.6.0 adds support for the MPP protocol alongside L402, allowing the buyer to choose the payment protocol it understands. The update gives service providers two payment paths within the infrastructure announced by Lightning Labs, depending on the protocol supported by the purchasing party.
On the seller side, Lightning Labs said Aperture can be placed in front of an existing inference API without modifying the API itself. Lightmeter provides the pricing logic, while the Wavelength wallet manages incoming liquidity over Lightning. The company's instructions call for using Aperture version 0.6.0 in the seller setup, along with running Lightmeter for pricing. This means a service provider must configure its payment acceptance flow for Pi agents to use the service through pi402. According to the company's description, implementation is not limited to installing the tool on the buyer's side; it also requires setup by the inference API provider seeking to collect payments this way.
pi402 follows earlier steps by the company to build tools for AI agents on the Lightning Network. On February 11, 2026, Lightning Labs announced the open-source release of a toolkit with seven composable skills for an agentic commerce stack. The company said at the time that the skills covered operating a Lightning node, remote signing, scoped credentials, paying for L402 APIs, hosting paid endpoints, and coordinating purchases and sales. Lightning Labs also described the L402 protocol as combining HTTP's 402 response code with the Lightning Network and cryptographic authentication tokens, enabling payment and access verification for enabled APIs without registration or an API key. pi402 adds an application for paying inference costs from within a coding agent to this broader set of tools and protocols.
The experiment comes amid interest among payment companies in identifying agents and controlling their permissions when they make payments. On October 20, 2026, Visa, BILL and Billtrust announced a live pilot that lets trusted agents initiate and complete approved buyer invoice payments through supplier portals. Visa said its Trusted Agent Protocol authenticates agents on restricted portals while leaving control and oversight with the supplier. The company's head of commercial payments said the pilot is testing identity, payment controls and transaction traceability across platforms. On risks, the International Monetary Fund said autonomous agents' reliance on third-party services may require sensitive data, including bank account details, card numbers and cryptographic wallet keys. The fund also said authentication, authorization and liability mechanisms raise questions because current payment systems were designed around a human user who explicitly approves a transaction.