21 BTC
> AI agents · Lightning · L402 · ecash

Bitcoin for AI

Why AI agents need money without a bank, which protocols already let them pay in bitcoin per request, and where the idea is weak. With live Lightning data and a fee calculator.

Why AI agents need Bitcoin

> the argument in steps
  1. 01
    no bank
    an agent can't open an account or get a card
  2. 02
    a key
    a 256-bit random number, made in < 1 ms
  3. 03
    millisats
    Lightning splits 1 sat into 1,000
  4. 04
    L402
    payment inside the HTTP request, status 402

05 The next billion Bitcoin users won’t be people.

payment$0.0001
×3000
card fee$0.30

Based on the video @DocumentingBTC: “Here's why AI will buy all of the bitcoin” ↗ (11 October 2026). Retelling, caveats and graphics are ours; convert the amount to sats: calculator.

The wall: agents have no bank

An agent can write code, book a flight and hire another agent, then fail at the last step: paying. Cards and bank accounts are issued to people and companies after identity checks, and they assume a human is around to approve, dispute and reset passwords. An agent has no passport, no address and no credit history, so today it borrows a human's card or API key and inherits that human's limits.

Bitcoin asks only for a key

To receive bitcoin you need a private key: a 256-bit random number that a computer generates in well under a millisecond. Nobody approves it and nobody can refuse it. The rules are open source and the same for everyone, which matters for software that decides by reading code rather than trusting a brand.

Pay per word: why card fees break

Agents buy in tiny slices: per request, per token, per second. A typical online card fee is about $0.30 plus a percentage. On a $0.0001 request the fixed part alone is 3,000 times the payment, so cards simply cannot price machine-sized purchases; providers bundle them into monthly plans instead.

The Lightning Network moves bitcoin between channels in about a second and counts in millisatoshis: one satoshi split a thousand ways. At around $84,000 per BTC, $0.0001 is roughly 0.12 sat, or about 120 millisats, which Lightning can express and on-chain Bitcoin cannot.

L402: payment inside the web request

L402 revives the web's old HTTP 402 "Payment Required" status. The server answers a request with a Lightning invoice; the agent pays, retries with proof of payment and gets the data. No sign-up and no API key to leak: in Lightning Labs' words, credentials are purchased, not provisioned.

Lightning right now

Public Lightning capacity
3,619 BTC
$302.9M
Nodes with public channels
16,009
channels: 30,212
Median node fee
500 msat + 120 ppm
per hop
BTC price
$83,574
$0.0001 ≈ 120 msat

Source: open-source mempool Lightning API (graph snapshot 2026-10-11), price Coinbase. Public channels only. Full Lightning stats →

Micropayment: card vs Lightning

Plug in your own numbers. Defaults: a typical online card fee and the live median fee of a public Lightning node.

Card: fee per payment$0.30
3,000× the payment · 1,000 payments: $300.00
Lightning: routing fee$0.000418
500 msat · 4.2× the payment · 1,000: $0.4179

Payment = 119.7 millisats. Honestly: with the median base fee, a single Lightning hop costs more than a $0.0001 payment. It gets cheap with a direct channel (0 hops), zero-base-fee routes or batching, while a card's fixed part never goes away. Network median: snapshot 2026-10-11, mempool.

Convert any amount to sats →

Protocols for AI and Bitcoin

Each entry checked against its official repo, spec or site on 2026-10-11. Maturity is our call; "experimental" means new, few implementations, may change.

In productionBeta / early productionExperimentalNot Bitcoin: for contrast

L402 (formerly LSAT)

Lightning Labs
In production

The server answers a request with 402 and a WWW-Authenticate header holding a macaroon and a Lightning invoice. The client pays, gets the preimage as a receipt and retries with "Authorization: L402 macaroon:preimage". Aperture is the reverse proxy that puts this paywall in front of any REST or gRPC API.

Spec and the Aperture proxy have been used in Lightning Labs' own services for years.

GET /v1/data HTTP/1.1
→ 402 Payment Required
  WWW-Authenticate: L402 macaroon="AGIAJEem…", invoice="lnbc100n1…"

# pay the invoice, keep the preimage, retry:
GET /v1/data HTTP/1.1
Authorization: L402 AGIAJEem…:<preimage-hex>
→ 200 OK

HTTP 402 Payment Required

IETF (HTTP semantics, RFC 9110)
In production

A plain status code that says "pay first". On its own it carries no price or invoice; the protocols in this list each define the headers that do. That is why one agent HTTP client can learn several of them.

The status code exists in every HTTP stack, but RFC 9110 still marks it "reserved for future use": the payment format is up to L402, Cashu NUT-24 or x402.

HTTP/1.1 402 Payment Required
WWW-Authenticate: L402 …   # Lightning (L402)
X-Cashu: creqA…            # Cashu ecash (NUT-24)
PAYMENT-REQUIRED: …        # x402 (stablecoins)

Lightning Agent Tools (lnget, MCP)

Lightning Labs
Experimental

Seven skills plus an MCP server: run an LND node, pay L402 APIs with the lnget CLI (with a per-request cost cap), host paid endpoints with Aperture, bake scoped macaroons, and let an assistant read node state through 18 read-only MCP tools over Lightning Node Connect.

Released February 2026; new and moving fast. Keys stay on a remote signer by default.

# pay-per-request download, never more than 500 sats
lnget --max-cost 500 https://api.example.com/data.json

# read-only Lightning MCP server for an AI assistant
claude mcp add --transport stdio lnc -- npx -y @lightninglabs/lightning-mcp-server

Nostr Wallet Connect (NIP-47)

Nostr NIPs; Alby and others
In production

A wallet hands an app (or an agent) a connection string. The app sends encrypted Nostr events (kind 23194) asking pay_invoice, make_invoice or get_balance; the wallet replies with kind 23195. Each connection can have its own budget and permissions and can be revoked, so the agent never holds the wallet's keys.

Widely implemented by wallets and apps (Alby Hub, Primal, Zeus and more, see nwc.dev).

import { NWCClient } from "@getalby/sdk";
const nwc = new NWCClient({
  nostrWalletConnectUrl: process.env.NWC_URL, // nostr+walletconnect://…
});
await nwc.payInvoice({ invoice: "lnbc…" }); // within the budget set in the wallet

Alby Hub + Alby MCP server

Alby
Beta / early production

Alby Hub runs your Lightning node or wallet and issues NWC connections with budgets. The Alby MCP server turns one of those NWC connections into tools an LLM can call: pay and create invoices, check balance, pay Lightning addresses and fetch L402 resources.

Alby Hub is a production self-custodial node/wallet; the MCP server is newer (hosted or via npx).

# hosted MCP, authenticated by an NWC connection with a budget
claude mcp add --transport http alby https://mcp.getalby.com/mcp \
  --header "Authorization: Bearer nostr+walletconnect://…"
# or locally: npx -y @getalby/mcp

Lightning MCP servers

Lightning Labs, Alby, Fewsats, others
Experimental

MCP is how assistants like Claude or ChatGPT call outside tools. A Lightning MCP server exposes a node or wallet as tools: Lightning Labs' server is read-only node state, Alby's pays through a budgeted NWC connection, Fewsats' pays L402 offers from its managed wallet.

The Model Context Protocol itself is young; wallet servers differ in what they allow. Prefer read-only or budgeted ones.

{ "mcpServers": {
    "alby":    { "command": "npx", "args": ["-y", "@getalby/mcp"],
                 "env": { "NWC_CONNECTION_STRING": "nostr+walletconnect://…" } },
    "fewsats": { "command": "uvx", "args": ["fewsats-mcp"] } } }

BOLT12 offers

Lightning spec (BOLTs); author Rusty Russell
In production

An offer (lno1…) is a reusable payment code: the payer's wallet fetches a fresh invoice over onion messages each time. Good for an agent that bills repeatedly or receives from many payers without running a web server, and blinded paths hide the receiver's node.

Part of the BOLT spec since 2024; native in Core Lightning, Eclair/Phoenix and LDK. LND needs the separate LNDK add-on.

# Core Lightning: one reusable offer, any amount
lightning-cli offer any "agent tips"
# → { "bolt12": "lno1qgsq…", … }  (shareable, never expires unless you set it)

Cashu ecash (NUT specs)

Cashu (open source; creator calle)
Beta / early production

A mint issues blinded ecash tokens backed by bitcoin it holds; tokens are bearer strings an agent can pass in a header, private and instant. NUT-24 defines an X-Cashu header for 402 payments. Trade-off: the mint is custodial, so keep small amounts.

Core NUTs are implemented by several wallets and mints; NUT-24 (HTTP 402) is specified but has no listed implementations yet: experimental.

→ 402 Payment Required
  X-Cashu: creqA…        # amount, unit, accepted mints (NUT-18)
GET /v1/data
X-Cashu: cashuB…         # the token itself is the payment

Fedimint

Fedimint (open source; creator Eric Sirion)
Beta / early production

Like Cashu, but the mint is a federation of several guardians with a threshold, so no single operator can run off with the funds. fedimint-clientd gives a server or agent a REST API for ecash, Lightning and on-chain.

Running federations and the Fedi app exist; server-side agent use via fedimint-clientd is early.

fedimint-clientd --fm_db_path /var/fm --password "$PW" --invite_code "fed11…"
curl http://localhost:3333/v2/admin/info -H "Authorization: Bearer $PW"

Routstr

Routstr (open source)
Experimental

A marketplace for AI inference: providers announce models on Nostr, clients pay per request with Cashu. Routstr Core is a proxy in front of any OpenAI-compatible API, so the client just uses a Cashu token as its API key.

A young protocol; providers and models come and go.

from openai import OpenAI
client = OpenAI(base_url="https://api.routstr.com/v1",
                api_key="cashuBo2Ft…")   # ecash token = prepaid key
client.chat.completions.create(model="…", messages=[…])

PPQ.ai (PayPerQ)

PayPerQ
In production

Hundreds of brand-name models behind an OpenAI-compatible API, paid per query instead of by subscription. Some endpoints answer an unauthenticated request with 402 and a Lightning invoice.

A working pay-per-prompt service. No-account L402 works only on image, video and data endpoints; chat needs an API key and a balance (top up over Lightning or NWC).

curl -i -X POST https://api.ppq.ai/v1/images/generations -d '{…}'
# → 402 + Lightning invoice; pay, then replay with:
#   Authorization: L402 <token>:<preimage>

Fewsats

Fewsats
Beta / early production

Payment infrastructure for agents built around its L402 "offers" format (JSON offers in the 402 reply): the agent asks to pay, Fewsats enforces budgets and human approval, and pays over Lightning (or other methods). Ships a Python SDK with agent tools and an MCP server.

A startup service: a managed wallet with budgets and approvals, not self-custody.

from fewsats.core import Fewsats
fs = Fewsats()                                   # your Fewsats API key
offer = l402_offer["offers"][0]                  # JSON offers from the 402 reply
fs.pay_offer(offer["id"], l402_offer)            # budget + approval rules apply
tools = fs.as_tools()                            # same, as tools for an agent

x402

Coinbase → x402 Foundation
Not Bitcoin: for contrast

The same HTTP 402 idea: the server lists accepted payments, the client signs a stablecoin transfer and resends it in a header, a facilitator verifies and settles. Shown here as contrast: easy dollars for agents, at the price of an issuer who can freeze.

Live and growing, but it settles mostly in USDC stablecoins on chains like Base and Solana, not bitcoin. Issuers can freeze USDC.

app.use(paymentMiddleware({
  "GET /weather": { accepts: [/* USDC on Base, … */], description: "Weather data" },
}));

People and projects

More: People of Bitcoin · Explainer: Lightning, L402 and Plan ₿ Forum

Honest caveats

  • Someone still funds the agent. A human or company buys the bitcoin and sets the budget; agents mostly spend it rather than hoard it, so "AI will buy all the bitcoin" is a slogan, not a forecast.
  • Routing is not free. The median public Lightning node charges a base fee of about 500 millisats per hop, which is more than a $0.0001 payment. Real sub-cent payments need direct channels, zero-base-fee routes or batching, and most L402 prices today start at a sat or more.
  • Lightning needs liquidity and an online node or a provider. Custodial wallets are simpler but bring back an account, and sometimes identity checks.
  • Competition is real. Coinbase's x402 uses the same HTTP 402 idea with USDC stablecoins, and Visa, Mastercard and Stripe are building agent-payment products on card rails.
  • Safety: an agent with keys can be tricked or buggy. Cap spending, keep keys on a separate signer and start small.

Where the idea comes from

The argument that AI agents will become Bitcoin users comes from the video “Here's why AI will buy all of the bitcoin” ↗ by Documenting ₿itcoin (@DocumentingBTC) ↗, 11 October 2026 (listed in our People of Bitcoin). We don't re-host the video; the retelling, caveats, graphics and catalog are ours.

In the Wiki: AI agents and Bitcoin · L402 · Nostr Wallet Connect (NWC) · Cashu · Fedimint · x402 · Lightning Network

Not investment advice. Never give an AI agent a wallet with more than you are willing to lose.