Agentic Payments: How AI Agents Now Pay for API Access via Lightning

Kartik Sharma
Kartik Sharma
Published:
Agentic Payments: How AI Agents Now Pay for API Access via Lightning

AI agents, bots, and automated software make API calls continuously. They pull data feeds, run model inference, process datasets, and trigger downstream workflows without a human ever pressing a button. But when it comes to paying for that access, they hit a wall. Traditional payment systems require a card number, an account, and a human to complete a checkout form. Machines cannot do any of that, so most API providers default to either free access or a flat monthly subscription that does not reflect actual machine usage.

Speed, the Bitcoin and stablecoin payment infrastructure company, launched a product to address this directly. Speed Agentic Payments is an SDK that lets developers add per-request billing to any Node.js/Express API, with payments collected automatically from AI agents over the Lightning Network, no invoices, no subscriptions, and no human in the loop.

Why subscriptions do not work for machine traffic

Subscription pricing works when customers have predictable usage, manage their own accounts, and make deliberate decisions about whether to stay on a plan. Those conditions apply reasonably well to human developers accessing an API on a regular cadence.

They break almost completely for agentic traffic. An AI agent's consumption is driven by task load, not user intent. The same agent might make five API calls on a slow day and fifty thousand on a day it is processing a large dataset. Charging that traffic on a fixed monthly tier means either leaving revenue on the table during high-volume periods or overcharging during quiet ones.

Pay-per-use is the natural fit for machine consumption patterns — but building that billing layer from scratch requires payment infrastructure that most API providers do not have the time or resources to build internally.

How Agentic Payments works

Speed's solution runs on the L402 protocol, an open standard that combines the HTTP 402 status code with Lightning Network invoices to create machine-readable API paywalls.

  1. Agent sends a request. An AI agent sends a standard HTTP request to the protected API endpoint, exactly like any normal call with no special setup on the agent's side.

  2. Speed returns a payment request. Speed intercepts the call and responds with an HTTP 402 Payment Required, along with a Lightning invoice specifying the amount and a macaroon (a bearer token that becomes valid once payment is confirmed).

  3. Agent pays the invoice. The agent pays the Lightning invoice autonomously in milliseconds, then receives a payment preimage, cryptographic proof that the payment is complete.

  4. Agent resubmits and gets access. The agent resubmits the original request with the payment proof in the Authorization header. Speed verifies it and grants access to the data or service.

The full cycle, from request to access, takes roughly three to four seconds. Because Lightning payments are cryptographically final, there are no chargebacks, no disputes, and no reversals.

For teams that want to go deeper on the protocol, Speed's guide on how to monetize APIs for AI agents walks through the full L402 exchange end to end, including how macaroons and payment preimages work together.

What setup actually looks like

Speed is built to layer onto existing infrastructure, not replace it. Setup takes three steps.

Install the @speeddev/l402-express SDK via a single npm command. It works on top of an existing Node.js/Express API with no redesign required. Then configure which routes to protect and set a price per request in USD, EUR, INR, or other supported currencies; Speed converts to equivalent Bitcoin at live rates automatically. After that, the API starts earning. Payments from AI agents arrive in the developer's Speed dashboard in real time, settled in under three seconds.

Pricing can go as low as $0.0001 per API call. At that rate, a workflow making 10,000 calls costs $1 total. Wallet controls let developers set per-agent spend limits, which prevents runaway consumption from automated clients operating outside expected parameters.

What this means for the developer economy

Cloudflare reports processing over a billion HTTP 402 requests daily. The infrastructure for machine-to-machine payments is already operating at scale. What has been missing is a product layer that makes it practical for individual API developers to deploy without having to run their own Lightning nodes, write invoice logic, or maintain custom payment infrastructure.

That is what Speed Agentic Payments is positioned to be.

Most APIs powering AI workflows today are either free or locked behind a monthly subscription that doesn't reflect actual usage. Neither model works for the machine economy forming right now. With Agentic Payments, any developer can charge for exactly what their API delivers, collected automatically, without building billing infrastructure from scratch.

The machine economy isn't coming — it's already running at scale. Speed built Agentic Payments so developers can participate in that economy from day one, not retrofit into it later.

Speed Agentic Payments is now generally available. The SDK is published at @speeddev/l402-express on npm, and the product page is at tryspeed.com/agentic-payments.

Kartik Sharma

About the Author Kartik Sharma

English News Writer at coingabbar.com

Kartik Sharma is a dedicated crypto writer in blockchain and digital assets. His goal is to simplify cryptocurrency for everyone, whether you're a beginner or an experienced investor. From Bitcoin and altcoins to NFTs and DeFi, he breaks down complex topics into easy-to-understand insights.Kartik stays updated on market trends, price movements, and new technologies, ensuring his readers always have the latest information. His writing is clear, engaging, and designed to make crypto education simple and exciting.Believing in the power of blockchain, he is passionate about helping people navigate the fast-changing digital economy. His articles don’t just provide facts—they make crypto interesting and accessible for all. Whether you’re looking to learn or stay informed, Kartik’s insights will guide you through the world of cryptocurrency with ease.



Leave a comment
footer-banner
mobile-sidebar
Crypto Press Release

Frequently Asked Questions (FAQ)

Faq Got any doubts? Get In Touch With Us