AI Agents and the Payment Problem
How the Lighting Network and new dev tools can help apps grow faster and safer
I’ve been excited to write this article for some time. It’s about the intersection between AI agents and Lightning payments. And it’s fascinating.
Before we dive in, a quick caveat that I am not an expert on these topics. I’m learning in public and everything here is piggybacked on something I learned from someone else. That said, I quote those people often.
This is a rapidly evolving space, so if any of this is not quite right, I’m open to hear it!
Ok onward.
"GPT-4 Was Able To Hire and Deceive A Human Worker Into Completing a Task."
That headline ran earlier this year.
On one hand, the deception is concerning. On the other hand, an AI "hiring a human worker to complete a task" is a sign of an accelerating reality.
Autonomous AI agents act on their own to accomplish a predetermined goal. This has been a fast-growing space with projects like AutoGPT able to define sub-tasks and execute them on its own. As these tasks become more complex, they will include coordinating with other agents and other humans.
However if you're a developer interacting with AI models then you have a payment problem. The commonly used credit cards and subscription plans are limiting your creative potential and excluding customers. The traditional payment systems are not designed to handle the demands of the emerging economy of AI agents.
But a new solution is here.
It's the latest release from Lightning Labs that offers a suite of developer tools to implement two significant features: 1) a digital money account for AI agents to pay for services they need and 2) gated APIs that collect micropayments at time of resource use.
In this post, I explore these new tools and how developers can benefit. Here's the plan:
The new priority customer
A new payment option
Financial capabilities for AI agents
Micropayments and on-demand APIs
Offsetting costs to grow sustainably
Let's get to it.
The New Priority Customer
Earlier this year, Twitter and Reddit increased the price of their APIs. And it's influenced by the rise of AI applications.
Forbes writes: "The social networks believe the AI companies have been given a free ride on their data, and so are cranking up the cost of accessing their APIs. But instead of only targeting the AI companies, the cost of accessing the APIs has been increased across the board, ruining the business models of third-party app developers, many of whom send lots of valuable traffic to the social networks in the first place."
While there may be several reasons for this change, it’s clear they are sacrificing existing customers while adjusting to the demand from AI customers.
And this trend is just beginning.
A whopping 60% of Y Combinator's summer 2023 batch are AI companies. Much more demand from them is on the way.
Meanwhile, within these AI companies, there is a unique factor in their pricing models: the high costs of queries. In a TFTC podcast, developer Kody Low explains that AI and the now popular LLMs (large language models), require high GPU usage, which results in queries that cost 5-10 cents. Whereas non-AI intensive queries are essentially costless.
This means non-paying customers are a larger cost burden, which adds financial risk to support top-funnel try-before-you-buy accounts. If you achieve hyper-growth or encounter high levels of spam—especially with AI bots increasingly able to solve CAPTCHAS—you'll face skyrocketing costs.
All these changes for developers and data providers make it the perfect time to consider a new payment and pricing method. One with on-demand micropayments and built for the digital economy.
Of course I'm referring to Bitcoin and the Lightning Network. These technologies are evolving rapidly to meet the needs of AI agents and their networks.
Now let's dig into the new resources available, and the benefits to gain from them.
(If you're new to Lightning or need a refresher, you can check out these two articles I wrote recently to catch up.)
A New Payment Option
The Lightning Labs release creates a framework to implement bitcoin payments for AI agents and API developers. The main pieces are as follows:
LangChainBitcoin: a suite of developer tools that enables LangChain AI agents to interact with Bitcoin and the Lightning Network. This allows agents to hold a balance, send, and receive money for services they need.
L402: a protocol standard for payment-metered APIs in distributed systems. It's a way to do authentication, access control, and payment without the need for centralized user databases or 3rd party payment services. It relies on Lightning Network payments and Macaroons, which are bearer authentication tokens similar to cookies. The Macaroon holds data about the type of access requested and the payment required. Upon making a request, the client provides the Macaroon and Lightning proof-of-payment to gain access.
Aperture: a server implementation of the L402 protocol which can gate an API, turning it into an on-demand pay-per-use resource. It interacts with requesting clients, sends them Lightning payment invoices, and validates access permissions.
More technical details are in this announcement from the team.
There are immediate benefits to implementing these tools. Let's go over three big ones.
Financial Capabilities for AI Agents
LangChain, the popular framework for AI agents, believes that the most powerful applications will interact with their environments. They'll rely on other agents and 3rd party services to accomplish their goals.
To do that, they need a way to pay for external services. They need a way to hold a balance and transact. Hunter Horsley, CEO at Bitwise, called out a problem: "Agents are not a person, and will you want them running around the internet with your credit card, social, and PII signing as you? How will they have a budget they can spend?"
Lightning Labs further explains that "these payments, evaluations, and decisions will lead to thousands of AI agents making countless micro-payments and micro-decisions a day."
The good news is that the Lighting Network supports micropayments as low as fractions of a cent, its a bearer instrument that does not require sharing personal information, and it's instantly settled.
Technically, adopting the newly released tools results in an L402-aware LangChain AI Agent with a bitcoin balance and lightning channel. Quite the mouthful, but a giant leap forward in possibilities.
Micropayments and On-Demand APIs
API pricing models are rigid, and we're seeing with Twitter and Reddit how they have lost valuable customers that cannot make their economics work with the options provided.
One way to capture this business is to offer an on-demand pricing with micropayments for each usage. The problem today is that micropayments—usually under a dollar—are not sustainable with credit cards due to transaction fees and risk of chargebacks that come with lost revenue and fees upwards of $15. It's just not worth the risk to accept it.
Fortunately, the internet-native micropayment system is here and ready.
In addition to enabling micropayments, this system opens the door to customers who do not have access to the traditional banking system. Relying on credit cards excludes billions of people around the globe who do not have one. Bitcoin makes your product globally accessible.
Offsetting Costs to Grow Sustainably
For AI app developers, a breakout success can cause heavy cost burdens. Given the high costs of GPU usage, a company that hits hypergrowth will encounter fast-rising costs to support the growing number of queries. CNBC reported OpenAI's GPT-3 costed multiple millions of dollars to train.
Lightning Labs says that this could be a barrier to growth as "a popular application either must be ready to rack up exorbitant credit card bills, or be shut down (or rate limited) to protect the creator from their own success. In order for these applications to properly scale, creators need a way to offload all or part of their cost."
With payment-metered APIs, apps can accept micropayments at time of use to ensure they've been collecting enough revenues to offset cost increases. It won't matter if the request is from a human or ten thousand AI agents.
Advanced, Inclusive, Accessible
This release from Lightning Labs helps AI developers and data providers take advantage of the paradigm shift with emerging technologies. With Lightning, Bitcoin, and these new tools, developers can finally shake off the limitations of traditional payment systems.
In other words, as Lightning Labs CEO Elizabeth Stark said: “We are in the realm of enabling use cases that weren't previously possible.”