Understanding Agent Payments

As outlined in the project’s README, the agent initiates an inference request directed at Aperture, which serves as the seller’s gateway. Should payment be necessary, the gateway responds with an HTTP 402 ‘Payment Required’ status along with a Lightning invoice. The extension verifies its spending policy, processes the payment using its integrated Wavelength wallet, stores the payment credentials, and then retries the request. Consequently, the model’s response can be streamed back.

For sellers utilizing a metered approach, a single bitcoin transaction can facilitate multiple prompts. The README explains, “One payment secures a bundle of tokens.” The seller’s pricing server deducts from this prepaid balance based on the reported input and output usage, employing estimates for completed streams lacking usage reports and for certain interrupted streams. Once the bundle is exhausted, the gateway requests an additional payment, referencing Aperture’s metering guidelines.

In Lightmeter’s referenced implementation, bundles are prepaid tokens offered at a mixed rate. Input and output tokens deplete the bundle at varying rates, thus the actual token coverage is influenced by their combination.

The Wavelength framework utilizes a swap server to fulfill Lightning invoices, meaning buyers do not need to manage a Lightning node or handle payment channels themselves. According to the installation documentation, the spending limit is evaluated against both the invoice amount and the swap fee; users have the option to establish a daily expenditure limit as well.

The software is set by default to operate on a local development network, with mainnet usage necessitating specific configuration. The extension incorporates Kimi, GLM, and DeepSeek models, though availability hinges on the seller’s configuration. Sellers are permitted to situate the gateway in front of an OpenAI-compatible API and adjust token pricing along with any applicable markups.

On Osuntokun’s seller page, the pricing is listed as $0.375 per million input tokens and $1.50 per million output tokens, which includes a 25% markup based on the seller’s initial costs. While dollar rates remain constant, the bitcoin amounts fluctuate according to the current market exchange rate. The seller promotes a bundle of 500,000 tokens that remain valid for up to 30 days. It’s essential to note that these terms apply specifically to that seller and are not standardized across the network; illustrative rates are featured on the pi402 product site.

Bitcoin Settlement as an Alternative to New 402 Protocols

The prior L402 protocol from Lightning Labs already integrated HTTP 402 responses with Lightning invoices. In this setup, a buyer fulfills an invoice and subsequently provides an authorization token along with cryptographic proof of payment to access the service. The Defiant reported on the rollout of a dedicated L402 website in July; pi402 enhances this by offering a Pi-specific buyer with an embedded wallet without creating a new payment mechanism.

For authorizing payments, pi402 also accommodates MPP’s Payment HTTP Authentication Scheme. By default, it favors a charge offer through MPP, resorting to L402 when feasible; however, MPP’s session mode is not supported by this extension.

The x402 protocol similarly enables services to charge without necessitating a checkout interface, but it does not mandate a single payment method. Coinbase’s materials outline a process where a client completes a payment, which is then verified and settled by a facilitator. Although USDC is identified as the most prevalent asset, x402’s network and asset flexibility extends to various options, including EVM networks and Solana. Furthermore, the repository provides specifications for processing bitcoin payments via Lightning.

₿ The Weekly Bitcoin Brief Top crypto stories + our BTC chart call, every Sunday. Free. Unsubscribe anytime.
Share.