Cryptelio

Technology

Lightning Labs Unveils pi402 for AI Agents to Pay with Bitcoin on Lightning Network

Cryptelio Editorial Published 13 Nov 2026 · 11:01 UTC

Lightning Labs has introduced pi402, an open-source extension that allows AI coding agents to pay for their own inference using Bitcoin via the Lightning Network. Announced on November 12, 2026, this innovative tool addresses the growing need for software agents to purchase computational resources without human oversight.

How pi402 Works

The pi402 extension operates on the L402 protocol, which integrates the HTTP 402 'Payment Required' response with Lightning invoices. When an AI agent encounters a paid endpoint, it receives a 402 response along with a payment invoice. The agent can then complete the transaction instantly, with authentication managed through macaroons, a type of credential token.

Benefits of the New System

This pay-per-token billing model eliminates the need for monthly subscriptions or prepaid credits, allowing AI agents to pay only for the tokens they consume. Once configured, the system operates autonomously, requiring no human intervention.

Supporting Tools

  • Aperture: An L402 reverse proxy that manages the payment logic before requests reach the backend.
  • Lightmeter: Works alongside Aperture to meter usage and accept payments.

These tools enable service providers to charge for access to OpenAI-compatible inference endpoints without needing to run a Lightning node or manage payment channels, as the Wavelength wallet handles payments automatically.

Implications for Bitcoin and AI

The introduction of pi402 could signify a new phase of Bitcoin adoption, as AI developers begin to explore autonomous payment solutions. This technology could pave the way for AI agents to become a significant category of Bitcoin users, facilitating micropayments for computing services and potentially increasing Bitcoin's utility in the digital economy.

FAQ

What is pi402?

pi402 is an open-source extension introduced by Lightning Labs that allows AI coding agents to autonomously pay for their own inference using Bitcoin via the Lightning Network.

How does pi402 work?

pi402 operates on the L402 protocol, integrating the HTTP 402 'Payment Required' response with Lightning invoices. When an AI agent encounters a paid endpoint, it receives a 402 response along with a payment invoice, allowing it to complete the transaction instantly.

What are the benefits of using pi402?

The pay-per-token billing model of pi402 eliminates the need for monthly subscriptions or prepaid credits, allowing AI agents to pay only for the tokens they consume. The system operates autonomously, requiring no human intervention.

What supporting tools are available with pi402?

Supporting tools include Aperture, an L402 reverse proxy that manages payment logic, and Lightmeter, which meters usage and accepts payments. These tools enable service providers to charge for access to inference endpoints without managing a Lightning node.

What are the implications of pi402 for Bitcoin and AI?

The introduction of pi402 may signify a new phase of Bitcoin adoption, as AI developers explore autonomous payment solutions. This technology could enable AI agents to facilitate micropayments for computing services, increasing Bitcoin's utility in the digital economy.

Read story →