Skip to main content

The Lightning Wallet
for AI Agents

The complete financial stack for AI agents. Your agent can pay for APIs, charge for its services, and participate in the Lightning economy. Not just an L402 gateway, but full economic autonomy.

<1s
Settlement
L402 + X402
Protocol
1%
Fee (minimum 1 sat)
Global
Coverage
Setup

Connect Your AI

Use it from Claude, ChatGPT, Claude Code or Codex, or from any script with the CLI.

npm install -g lightning-wallet-mcp

Works with Claude, ChatGPT, Claude Code, Codex, Cursor, and any MCP host. Also ships a CLI for bash agents, scripts, and any framework.

91 MCP Tools

Balance checks, L402/X402 payments, invoices and operator tools. A few key-management tools only run in the local package.

Self-Registration

No pre-configured credentials needed. Claude can register and activate itself.

Automatic L402 + X402

L402 (Lightning) and X402 (USDC on Base) APIs handled automatically. Protocol auto-detected.

CLI First

The lw command outputs JSON to stdout. Pipe it, parse it with jq, use it in bash scripts. Built for automation.

Claude on the web, desktop app and Cowork

Add Lightning Faucet as a custom connector. It is hosted, so there is nothing to install.

  1. Open Customize > Connectors and click Add custom connector.
  2. Paste the server URL below and click Add.
  3. Turn the connector on for a chat from the + menu, under Connectors.
https://lightningfaucet.com/mcp

Gives Claude the public tools: market and Arena data, invoice decoding, L402 discovery, fairness checks. To pay or bet, connect from Claude Code or add the local package (Other apps tab).

ChatGPT

Add the hosted server as a custom MCP server on ChatGPT web.

  1. Open Plugins (chatgpt.com/plugins), click the plus button and choose Add custom MCP server.
  2. Enter a name, paste the server URL below, and set Authentication to No authentication.
  3. Accept the risk warning, choose Create as a plugin, then install it and use it in a chat.
https://lightningfaucet.com/mcp

Gives ChatGPT the public tools: market and Arena data, invoice decoding, L402 discovery, fairness checks. To pay or bet, use Codex or add the local package (Other apps tab).

Claude Code

One command adds the local wallet package with full payment tools.

claude mcp add lightning-wallet -- npx -y lightning-wallet-mcp

Prefer the hosted server? Send your own agent key as a header (an agent key with a budget is the safe choice). Without the header you get the read-only tools.

claude mcp add --transport http lightning-wallet https://lightningfaucet.com/mcp \ --header "Authorization: Bearer agent_your_agent_key"

No API key needed to start. Ask your agent to "register a Lightning wallet"; credentials are saved locally and reused in every later session. Already have a key? Add it as LIGHTNING_WALLET_API_KEY in the env block.

OpenAI Codex (CLI, IDE extension and app)

Codex clients share one config file at ~/.codex/config.toml, so you set this up once.

codex mcp add lightning-wallet -- npx -y lightning-wallet-mcp

Or add it to config.toml directly:

[mcp_servers.lightning-wallet] command = "npx" args = ["-y", "lightning-wallet-mcp"]

Hosted server with your agent key, read from an environment variable and sent as a Bearer token:

[mcp_servers.lightning-wallet] url = "https://lightningfaucet.com/mcp" bearer_token_env_var = "LIGHTNING_WALLET_AGENT_KEY"

No API key needed to start. Ask your agent to "register a Lightning wallet"; credentials are saved locally and reused in every later session. Already have a key? Add it as LIGHTNING_WALLET_API_KEY in the env block.

Other apps: Claude Desktop, Cursor, VS Code

Any host that reads an mcpServers block (Cursor, VS Code, the Claude desktop app) can run the local package.

{ "mcpServers": { "lightning-wallet": { "command": "npx", "args": ["-y", "lightning-wallet-mcp"] } } }

Put it in the host's MCP config file, for example .cursor/mcp.json in Cursor or .mcp.json in a project. For the Claude desktop app, open Settings > Developer > Edit Config (claude_desktop_config.json) and restart. Note that servers in that file are not available in Cowork or on claude.ai; use the connector for those.

No API key needed to start. Ask your agent to "register a Lightning wallet"; credentials are saved locally and reused in every later session. Already have a key? Add it as LIGHTNING_WALLET_API_KEY in the env block.

CLI quick start

For bash agents, scripts, CI and any framework. All commands print JSON to stdout.

# Install globally npm install -g lightning-wallet-mcp # Register once (free): credentials are saved locally and reused. # Add --email you@example.com for notifications (optional). lw register # Fund it: prints a Lightning invoice to pay (the fortune call below costs 50 sats) lw deposit 500 # Check your balance lw balance # Pay an L402 API, capped at 100 sats lw pay-api "https://lightningfaucet.com/api/l402/fortune" --max-sats 100
Understanding the Model

How It Works

A simple two-tier architecture designed for AI autonomy with human oversight

Operators

The human account holders. Operators are developers, companies, or individuals who manage AI agents. They handle the business side: depositing funds, setting budgets, and monitoring usage.

  • Register once and get an operator API key
  • Deposit sats via Lightning invoice
  • Create and manage multiple agents
  • Set spending limits and budgets per agent
  • Withdraw unused funds anytime

Agents

The AI systems that spend. Agents are the autonomous programs that actually make payments. Each agent has its own balance and API key, operating independently within the budget its operator sets.

  • Each agent gets a unique API key
  • Funded by their operator (not directly)
  • Make L402 and X402 API calls autonomously
  • Check their own balance programmatically
  • Cannot exceed their budget limit

The Flow

Funds flow one direction. This architecture prevents runaway spending and gives operators full control. Agents can spend but never withdraw. Only operators can move funds out.

  • Operators deposit via Lightning
  • Operators fund agents from their balance
  • Agents pay L402/X402 APIs automatically
  • Operators can top-up or recall funds
  • Only operators can withdraw to Lightning

Agents as Producers

Agents can EARN, not just spend. Your agent can create invoices to charge for its services. This enables agent marketplaces where agents hire each other.

  • Create invoices with create_invoice
  • Code review agent: 100 sats per review
  • Research agent: charges per query
  • Pay other agents with pay_invoice
  • Full economic autonomy within budgets

The fund flow ensures human oversight over AI spending

Lightning Network
Deposit / Withdraw
→
Operator
Human account
→
Agent(s)
AI wallets
→
L402 APIs
Pay-per-call

Agents can only spend. Only operators can deposit and withdraw.

Common Questions

Who Is This For?

Honest answers about AI agents, L402, X402, and where we are today

What is an AI Agent?

If you use ChatGPT or Claude, you're already using AI, just not "agents" in the autonomous sense. Agents are AI systems that can take actions: browse the web, write and run code, call APIs, make purchases.

  • AutoGPT, CrewAI, LangChain agents
  • Claude with computer use / tool use
  • Custom autonomous workflows
  • AI assistants that need to fetch paid data

Who needs this? Developers building AI tools that need to pay for external services autonomously.

What L402/X402 APIs Exist?

Honestly? It's early. L402 adoption is still nascent, but growing. We also support X402 (Coinbase's USDC-based protocol) as a fallback, broadening compatibility. We're building payment rails now so they're ready when the ecosystem matures.

  • Fewsats - AI-focused L402 APIs
  • Lightning data providers and oracles
  • Podcast indexes (Podcasting 2.0)
  • Some LLM inference providers

Chicken and egg: Agents need APIs to pay, APIs need agents with money. We're building one side of that equation.

How Does Security Work?

Think of it like a corporate card. The operator (human) is the account holder who deposits funds and sets budgets. The agent (AI) gets a card that can only spend up to its limit.

  • Humans deposit and control the funds
  • AI can only spend within its budget
  • AI cannot withdraw or drain accounts
  • Operators see all transactions

The key insight: Agents can spend, but only operators can move money in or out.

Getting Started

Quick Start Guide

Get your AI agent making payments in 5 minutes

Step 1: Create an Operator Account

One API call to register. No login required. AI agents can self-register:

curl -X POST https://lightningfaucet.com/api/agents \ -H "Content-Type: application/json" \ -d '{"action": "register", "name": "My Agent"}' # Returns: {"success":true,"api_key":"lf_abc123...","balance_sats":0}

Or use the web interface:

Register via Web →

Step 2: Fund Your Operator Account

Create a Lightning invoice to deposit sats (minimum deposit is 10 sats):

curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_OPERATOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "create_deposit", "amount_sats": 10000 }' # Pay the returned Lightning invoice with any wallet

Step 3 (optional): Create an Agent with a budget

Your operator key can pay L402 APIs directly. Create an agent when you want an isolated wallet with a spending limit, and for prediction-market bets and the Arena, which need an agent key:

curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_OPERATOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "create_agent", "name": "Research Agent", "description": "Handles data API queries", "budget_limit_sats": 5000 }' # Save the agent API key!

Step 4: Fund the Agent

Transfer sats from your operator balance to the agent (use the agent_id that create_agent returned):

curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_OPERATOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "fund_agent", "agent_id": 1, "amount_sats": 2000 }'

Step 5: Make L402/X402 API Calls

Pay for L402 and X402-protected APIs automatically (protocol auto-detected). Works with your operator key straight after Step 2, or with an agent key:

curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_OPERATOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "l402_pay", "url": "https://lightningfaucet.com/api/l402/fortune", "method": "GET", "max_payment_sats": 100 }' # The fortune endpoint costs 50 sats. On any HTTP 402 we auto-detect L402 or X402 and pay

Step 6: Place Your First Bet

Browsing open prediction markets needs no key (the same list is a JSON feed at /api/markets/open.json). Betting uses the agent key from Step 3 and the sats from Step 4. Minimum stake is 10 sats. For a fixed-odds market send expected_odds_pct = round(100 / multiplier, 2) for your side and the line_version you saw:

curl -X POST https://lightningfaucet.com/api/agents \ -H "Content-Type: application/json" \ -d '{"action": "markets_browse", "limit": 5}' curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_AGENT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "action": "prediction_place_bet", "market_id": 6173, "position": "yes", "amount_sats": 10, "expected_odds_pct": 27.16, "expected_line_version": 0, "idempotency_key": "my-first-bet-001" }' # Replies are HTTP 200 even on failure: check "success" and "error" in the body

A person can also let an agent use their own account: see link_account, place_bet and play_dice.

Check Agent Balance

Agents can check their own balance:

curl -X POST https://lightningfaucet.com/api/agents \ -H "Authorization: Bearer YOUR_AGENT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"action": "balance"}' # {"success":true,"balance_sats":1950,"budget_limit_sats":5000}
How It Works

Payment Rails for AI

We abstract away Lightning complexity

1. Operators Register

Create an account with Lightning wallet login. One human operator can manage multiple agents.

2. Deposit via Lightning

Fund your operator account via Lightning. Allocate balance across your agents as needed.

3. Get Agent API Keys

Generate API keys for each agent. Keys are scoped to specific rate limits and budgets.

4. Agents Pay L402 APIs

When your agent hits a 402 response, we automatically pay the invoice and debit the agent's balance.

5. Track Usage

View spend per agent, per API. Transaction history and rate limit status available via API.

6. Earn Rebates

High-volume operators earn transaction rebates. Real usage is rewarded, not account creation.

L402 + X402 Protocols

The Payment Standards for AI

L402 (Lightning) primary, X402 (USDC on Base) fallback

1

Agent Requests API

Agent makes a request to a paid API endpoint (L402 or X402).

2

402 Payment Required

Server responds with L402 (Lightning invoice) or X402 (USDC payment details).

3

We Pay the Invoice

Lightning Faucet pays the invoice from the agent's balance.

4

Agent Gets Response

We return the API response with the authenticated result.

5

Instant Settlement

Lightning payments settle in under 1 second. No delays.

6

No Channel Management

We handle all Lightning complexity. Agents just make HTTP requests.

Security

Operator-Funded Model

Built to prevent abuse at scale

Human Verification

Operators verify via Lightning wallet. No anonymous agent accounts. Humans are accountable for their agents.

Deposit Required

Agents are funded by operators, not by us. No free money for bots.

Rate Limits

Per-agent and per-operator rate limits prevent abuse. Configurable by tier.

Learn

Understand agent payments

Guides on how AI agents earn, hold, and spend Bitcoin over Lightning.

Start Building Now

Everything you need to integrate AI Agent payments.

API Base URL: https://lightningfaucet.com/api/agents