3285c920-c

ConfirmedInfrastructure695 words3 min decode

Lightning Labs' pi402 Lets Coding Agents Pay AI APIs in Bitcoin

Lightning Labs' pi402 uses HTTP 402 invoices, an embedded Wavelength wallet and metered token bundles to let coding agents pay compatible AI APIs in Bitcoin.

Lightning Labs' pi402 Lets Coding Agents Pay in Bitcoin
WitnessLightning Labs' pi402 Lets Coding Agents Pay in Bitcoinpixelcreatures / pixabay

Outputs

  1. Pi402 uses an HTTP 402 response and an embedded Wavelength wallet to settle inference requests in Bitcoin.

  2. One seller charges $0.375 per million input tokens and $1.50 per million output tokens.

  3. Osuntokun's 500,000-token bundle is usable for 30 days and carries a 25% upstream-cost markup.

  4. One Bitcoin payment can cover multiple prompts on metered Aperture sellers, with estimates used when usage reports are unavailable.

  5. Pi402 prefers MPP charge offers, falls back to L402 and excludes MPP session mode.

Lightning Labs' pi402 lets coding agents pay for AI inference with Bitcoin over Lightning, according to the project README. It sends an inference request to Aperture, receives an HTTP 402 “Payment Required” response with a Lightning invoice, and pays through an embedded Wavelength wallet before retrying.

How does pi402 settle an inference request?

Pi402 checks its spending policy before payment, caches the payment credential and retries the request. The model’s response can then stream back to the agent. Operationally, billing sits inside the software request loop rather than a separate checkout page.

With a metered seller, one Bitcoin payment can cover multiple prompts. The README says, “One payment buys a bundle of tokens.” The seller’s price server debits that prepaid balance according to reported input and output usage.

Aperture’s metering documentation says the gateway asks for another payment when the bundle runs out. It uses estimates for completed streams without usage reports and for some interrupted streams, so the final debit can rely on an estimate in those cases. The result is a prepaid API meter, but missing or incomplete usage data can alter the charge.

What does metered access cost?

Lightmeter’s documented implementation prices bundles as prepaid credit at a blended rate. Input and output tokens draw down that credit at different rates, so actual token capacity depends on the mix, not just the bundle headline.

Osuntokun’s seller page lists $0.375 per million input tokens and $1.50 per million output tokens. The page advertises a 500,000-token bundle usable for 30 days and includes a 25% markup on stated upstream costs.

Dollar prices stay fixed, while Bitcoin amounts follow the spot exchange rate. These are that seller’s terms, not network-wide prices; examples on the pi402 product site are illustrative, so no standard tariff emerges. Buyers therefore face both token mix and seller-specific markups, making the headline bundle size an incomplete measure of cost.

Which operational limits remain?

Wavelength uses a swap server to pay Lightning invoices, so buyers do not have to run a Lightning node or manage payment channels. The installation guide says the spending ceiling covers the invoice plus the swap fee, and users can also set a daily cap.

The software defaults to a local development network, while mainnet use requires explicit configuration. That default leaves live Bitcoin settlement contingent on an operator changing the setting; the documentation gives no seller count, transaction volume or confirmed mainnet deployment.

The extension registers Kimi, GLM and DeepSeek models, but the seller determines which ones the gateway serves. Sellers can place Aperture in front of an OpenAI-compatible API and configure token prices and a markup, leaving model access and pricing under merchant control. The setup reduces node maintenance, but it does not remove merchant pricing authority or the need for deliberate mainnet activation.

Does pi402 create a new payment standard?

Lightning Labs’ earlier L402 protocol already combined HTTP 402 responses with Lightning invoices. A buyer pays the 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 a new payment mechanism. For authorization, it prefers an MPP charge offer under the Payment HTTP Authentication Scheme and falls back to L402 when available, while the extension does not support MPP session mode.

The x402 protocol also allows services to charge without a checkout page, but it does not prescribe a single payment rail. Coinbase’s documentation describes a client signing a payment and a facilitator verifying and settling it; USDC is the most common asset, although x402 supports EVM networks and Solana.

The x402 repository also contains a specification for Bitcoin payments over Lightning. Pi402’s distinction lies in giving coding agents a wallet-aware buyer, not in replacing L402, MPP or x402.

The next test comes as sellers move from the default local development network to explicitly configured mainnet deployments. Pi402’s practical reach will depend on those operators accepting MPP or L402 offers, publishing metering terms and supporting the models buyers expect.

via cryptonews.net (Source)

More from Elena Vasquez

Elena Vasquez

Show full bio

Staff writer covering regulation, policy and their impact on crypto and web3 industry at Mempool Brief.

1,576 articles