Give your AI agent a Lightning wallet
An autonomous agent can't open an account or type a card number, and sharing your API key with it is risky. A Lightning wallet with a spending limit lets it buy exactly the compute it needs, and nothing more.
How it works
- The agent sends a normal OpenAI-style request.
- Lampo answers
402 Payment Requiredwith a Lightning invoice for a bundle of tokens. - The agent's wallet pays it, if it is within the limits you set, and retries with the proof of payment.
- The answer streams back. The same credential keeps working until the bundle is used up.
Option A: pi402 (Pi coding agent)
pi402 has a built-in wallet and two limits: PI402_MAX_SAT_PER_REQUEST (per payment; the default is 1,000 sats, enough for the DeepSeek V4 Flash bundle) and PI402_DAILY_CAP_SAT (per day).
Option B: any agent, with Alby's tools
Create a Nostr Wallet Connect connection with a budget in your wallet. The budget is the agent's hard limit. Then use Alby's CLI (fetch with --max-amount) or its MCP server (fetch_l402).
Safety tips
- Fund the agent's wallet with small amounts only, and top it up when needed.
- Use a per-payment cap, so a surprising invoice is refused.
- Prefer services that sell bundles: one payment covers many calls, with fewer chances for mistakes.
Live prices: lampo.run shows every model and bundle, updated every 10 minutes.
The cheapest bundle is 1,000 sats (about $0.60) for about 2.5 million tokens of DeepSeek V4 Flash.
See models and prices
See models and prices