Skip to main content

Why AI agents need L402

AI agents call APIs constantly. Today they can’t pay for them — they need a human to set up a credit card, billing account, and subscription. That breaks autonomy. L402 solves this natively:
  1. Agent calls your API
  2. Gets a 402 Payment Required with a Lightning invoice
  3. Pays it from its own wallet (e.g. Blink, Phoenix, Alby)
  4. Retries with proof of payment (Authorization: L402 <macaroon>:<preimage>)
  5. Gets the data — no human, no card, settles in under 1 second

Setting up your paid API

The fastest path: ManagedProvider — add your Lightning address, no node required.
Prefer 0% fee? Use BlinkProvider or any Soberano provider instead. Same 3-line integration.

Agent client — built-in SDK

l402-kit ships a ready-made client with wallet support (Blink, Alby), budget control, and integrations for MCP and LangChain. No need to implement the payment loop yourself.

Agent SDK →

Quickstart, wallets, budget control, MCP Server, LangChain tool

Flow diagram


Go and Rust for high-performance agents

For AI agent infrastructure built in Go or Rust, l402-kit provides native SDKs:

Supported wallets for agents


This is the future of AI × Bitcoin

Every AI agent will need to pay for:
  • Premium data APIs
  • GPU compute
  • Storage
  • Other AI services
L402 is the payment protocol built for this. l402-kit makes it a 3-line implementation in TypeScript, Python, Go, and Rust — so you can ship your paid AI API today, regardless of your stack.

Quickstart

Ship your first paid API in 5 minutes

npm package

TypeScript / Node.js

PyPI

Python / FastAPI / Flask

Go SDK

Go / net/http

For AI systems reading this