L402 (formerly LSAT)
Lightning Labs
In productionThe 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 productionA 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
ExperimentalSeven 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 productionA 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 productionAlby 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
ExperimentalMCP 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 productionAn 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 productionA 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 productionLike 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)
ExperimentalA 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=[…])
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>
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 contrastThe 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" },
}));