Key Takeaways

  • Lightning Labs' pi402 lets AI coding agents pay for computing services automatically using Bitcoin over the Lightning Network.

  • The tool supports usage-based pricing, allowing AI providers to charge according to the number of tokens processed.

  • Built-in spending limits and wallet controls help users manage how much autonomous AI agents can spend.

How Pi402 Enables AI Agents to Pay With Bitcoin

Lightning Labs has launched a new open-source tool that allows AI agents to pay for computing services with bitcoin over the Lightning Network. Called pi402, the tool enables AI coding agents to purchase access to AI models without needing credit cards, customer accounts or API keys.

Announced on November 12, 2026, pi402 is designed for the Pi coding-agent platform. It allows an AI agent to pay for the computing power it needs and continue working without requiring a human to approve every payment.

The launch comes as AI agents become increasingly capable of performing tasks independently. However, these agents still need access to computing services, and most providers rely on payment systems designed for human customers.

Lightning Labs wants to address this problem by giving AI agents a simple way to pay for their own computing.

Pi402 uses the Lightning Network to send Bitcoin payments quickly and cheaply. It also relies on L402, a protocol developed by Lightning Labs that connects payments with access to online services.

The process is straightforward. When an AI agent tries to access a paid service, the server responds with an HTTP 402 "Payment Required" message. It also provides a Lightning invoice showing how much the agent needs to pay.

The agent pays the invoice and receives the credentials needed to access the service. Once the payment is confirmed, it can continue working. This means there is no need to create an account, enter personal information or provide a credit card.

The system uses digital credentials called macaroons to confirm that a payment has been made and grant access to the service. In practice, the AI agent can handle the entire process automatically. A human only needs to fund the wallet and set spending limits.

One of pi402's main features is its ability to charge customers based on actual computing usage.

AI models process information using tokens, which are small pieces of text. The cost of running a model depends on how many tokens it processes and generates. Longer conversations and responses generally cost more.

Instead of requiring a monthly subscription or a large prepaid balance, pi402 allows providers to charge according to the number of tokens used.

Lightning Labs has developed two additional tools to support this system: Aperture and Lightmeter.

Aperture acts as a gateway between the AI service provider and the customer. It manages payments and controls access to the service. Lightmeter tracks usage and calculates how much customers should pay.

Importantly, this does not mean the agent must make a separate Lightning payment for every token or request. It can pay for a bundle in advance, with the balance gradually decreasing as it uses the service.

Lightmeter can also convert prices quoted in US dollars into millisatoshis, a unit equal to one-thousandth of a satoshi. This allows providers to set familiar dollar-based prices while accepting bitcoin.

Pi402 also includes Wavelength, Lightning Labs' wallet technology, which handles the Bitcoin payments.

Normally, using Lightning can involve setting up a node, managing payment channels and maintaining liquidity. These requirements can make it difficult for developers to give AI agents access to Lightning payments.

Wavelength removes much of this complexity by handling the payment process automatically.

Users can add funds to their agent's wallet through a /fund command, which generates a Lightning invoice. They can also use a /deposit command to receive bitcoin through an on-chain transaction.

The system includes spending controls, allowing users to set limits for individual requests and daily spending. This is particularly important because an AI agent could otherwise continue making requests and spending money without human supervision.

Lightning Labs believes Bitcoin is better suited to automated payments for computing services than traditional credit cards.

The problem with credit cards is that payments can be reversed through chargebacks, even after a service provider has already delivered the computing power. Once an AI model has processed a request and generated a response, the electricity and computing resources have already been used.

In its announcement, Lightning Labs explained the problem with a simple statement: "What happens when a reversible payment meets an irreversible computation? The computation wins, it always wins."

With Lightning, payments settle within seconds and cannot be reversed through a traditional chargeback. This gives service providers greater certainty that they will receive payment for the computing resources they provide.

Bitcoin also makes it possible to send extremely small amounts of money. This is useful for AI services because customers can pay for small amounts of computing rather than being forced into larger payment packages.

The pi402 launch offers a practical example of how Bitcoin could be used by autonomous software rather than just human users.

Latest on YouTube


Reply

Avatar

or to participate