Skip to main content

AI Spending Guidelines

This guide provides recommended budget configurations for different AI agent use cases when using the pay_invoice tool.

Quick Reference

Use CasePer RequestPer SessionWallet Balance
Testing/Development100 sats1,000 sats5,000 sats
Light Browsing50 sats500 sats2,000 sats
Research Sessions200 sats2,000 sats10,000 sats
API Integration500 sats5,000 sats20,000 sats
Heavy Usage1,000 sats10,000 sats50,000 sats

Configuration Examples

Minimal (Testing)

For initial testing and learning:

export L402_MAX_SATS_PER_REQUEST=100
export L402_MAX_SATS_PER_SESSION=1000

Wallet funding: 5,000 sats (~$5)

Use for:

  • Learning how pay_invoice works
  • Testing your MCP configuration
  • Paying a few test invoices

Conservative (Light Usage)

For occasional, supervised use:

export L402_MAX_SATS_PER_REQUEST=50
export L402_MAX_SATS_PER_SESSION=500

Wallet funding: 2,000 sats (~$2)

Use for:

  • Accessing a few L402-protected resources
  • Light browsing of paid content
  • One-off API calls

Moderate (Research)

For research sessions with multiple data sources:

export L402_MAX_SATS_PER_REQUEST=200
export L402_MAX_SATS_PER_SESSION=2000

Wallet funding: 10,000 sats (~$10)

Use for:

  • Research involving multiple paid APIs
  • Gathering data from various sources
  • Extended work sessions

Professional (API Integration)

For development and integration work:

export L402_MAX_SATS_PER_REQUEST=500
export L402_MAX_SATS_PER_SESSION=5000

Wallet funding: 20,000 sats (~$20)

Use for:

  • Testing API integrations
  • Development workflows
  • Automated data collection (supervised)

Cost Estimation

Common Operations

OperationTypical Cost
Single API call1-100 sats
Premium content access10-500 sats
AI model API (per request)50-200 sats
Data feed query10-100 sats
Image generation100-1000 sats

Session Estimates

Task TypeEstimated Cost
10-minute research100-500 sats
1-hour development session500-2,000 sats
Day of API testing2,000-5,000 sats

Session Management

Starting a Session

  1. Check wallet balance before starting
  2. Review budget limits - are they appropriate?
  3. Define scope - what will the AI be doing?
  4. Monitor actively during first few uses
# Check balance before starting
check_wallet_balance

# Verify budget configuration
configure_budget # Shows current limits

During a Session

  • Watch for unexpected payment patterns
  • If limits are hit, evaluate if more budget is needed
  • Consider resetting session if scope changes
# Reset session spending counter
configure_budget resetSession=true

Ending a Session

  • Review all payments made
  • Check remaining balance
  • Note any unexpected charges
# Review what was spent
get_payment_history limit=50

Budget Strategy

Start Low

Begin with minimal limits and increase only as needed:

  1. Week 1: 100 sats/request, 1,000 sats/session
  2. Week 2: Evaluate - were limits hit? Why?
  3. Week 3: Adjust based on actual usage patterns
  4. Ongoing: Find your comfortable baseline

Per-Request vs Per-Session

Per-request limit protects against:

  • Single large accidental payment
  • Overpaying for one service

Per-session limit protects against:

  • Many small payments adding up
  • Extended sessions draining funds
  • Runaway loops

When to Increase Limits

Increase limits when:

  • You consistently hit limits for legitimate use
  • You understand why limits are being reached
  • You're comfortable with the higher exposure

Do NOT increase limits:

  • Just because limits were hit
  • Without understanding what payments were made
  • To avoid supervision

Refill Strategy

  1. Keep wallet balance low - Only what you need for near-term use
  2. Refill frequently in small amounts
  3. Never exceed what you're willing to lose
  4. Track refills to understand true spending over time

Example Refill Schedule

Usage LevelRefill AmountFrequency
Light5,000 satsMonthly
Moderate10,000 satsBi-weekly
Heavy25,000 satsWeekly

Troubleshooting Budget Issues

"Exceeds per-request limit"

Your payment request is larger than L402_MAX_SATS_PER_REQUEST.

Options:

  1. Increase per-request limit if payment is legitimate
  2. Find alternative service with lower cost
  3. Skip the payment if not essential

"Would exceed session budget"

You've spent most of your session budget.

Options:

  1. Reset session: configure_budget resetSession=true
  2. Increase session budget (with caution)
  3. End session and review payments

Wallet balance low

Your OpenNode account needs more funds.

Options:

  1. Add funds via OpenNode dashboard
  2. Transfer from another Lightning wallet
  3. Adjust budget limits to match available funds