with one click
lnget
HTTP client with automatic L402 Lightning micropayment support
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
HTTP client with automatic L402 Lightning micropayment support
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | lnget |
| version | 0.2.0 |
| description | HTTP client with automatic L402 Lightning micropayment support |
| metadata | {"openclaw":{"requires":{"bins":["lnget"]},"capabilities":["http_download","l402_payment","token_management","event_logging"],"interfaces":["cli","mcp"],"input_format":"json","output_format":"json","auth_methods":["lnd_macaroon","lnc_pairing","env_vars"]}} |
Download files with automatic L402 Lightning micropayments. When a server returns HTTP 402 Payment Required with an L402 challenge, lnget pays the Lightning invoice and retries the request automatically.
Tokens are cached per-domain so subsequent requests reuse them without additional payments.
# From source
go install github.com/lightninglabs/lnget/cmd/lnget@latest
# Or build locally
make install
# Fetch URL, get JSON metadata + response body inline
lnget --json --print-body https://api.example.com/data.json
# Pipe response body to stdout (two ways)
lnget -q https://api.example.com/data.json | jq .
lnget -o - https://api.example.com/data.json
# Preview payment without spending
lnget --dry-run https://api.example.com/paid-endpoint
# Agent-first: JSON input + output
lnget --json --params '{"url": "https://api.example.com/data", "max_cost": 500}'
# Introspect full CLI schema
lnget schema --all
--json for machine-readable output--dry-run first before making payments to preview cost--print-body with --json to get response content inline-q or -o - when you only want the raw response body--fields on list commands to limit output to needed fields--force on destructive commands (tokens clear) in non-TTY modelnget schema <command> for parameter detailslnget has three distinct output modes. Understanding them prevents the
common mistake of expecting the response body from --json.
--json (metadata mode)Returns structured metadata about the download. Does NOT include the response body by default.
$ lnget --json https://example.com/price/USD
{
"url": "https://example.com/price/USD",
"output_path": "USD",
"size": 67,
"content_type": "application/json",
"status_code": 200,
"l402_paid": false,
"duration": "431ms",
"duration_ms": 430
}
--json --print-body (metadata + body)Includes the response body as a "body" field in the JSON output.
Only works for text content types under 1MB.
$ lnget --json --print-body https://example.com/price/USD
{
"url": "https://example.com/price/USD",
"output_path": "USD",
"size": 67,
"content_type": "application/json",
"status_code": 200,
"l402_paid": false,
"duration": "431ms",
"duration_ms": 430,
"body": "{\"USD\":98234.50}"
}
-q or -o - (raw body to stdout)Pipes the response body directly to stdout with no metadata.
Best for piping into jq or other processors.
$ lnget -q https://example.com/price/USD
{"USD":98234.50}
$ lnget -o - https://example.com/price/USD
{"USD":98234.50}
Always preview before paying:
$ lnget --dry-run https://api.example.com/paid-endpoint
{
"dry_run": true,
"url": "https://api.example.com/paid-endpoint",
"has_cached_token": false,
"requires_l402": true,
"invoice_amount_sat": 100,
"within_budget": true,
"max_cost_sats": 1000
}
Exit code 10 on success (no action taken).
# Set max payment (default: 1000 sats)
lnget --max-cost 500 https://api.example.com/data
# Set max routing fee (default: 10 sats)
lnget --max-fee 5 https://api.example.com/data
# Disable auto-pay entirely
lnget --no-pay https://api.example.com/data
Use --params for structured request specification:
lnget --json --params '{
"url": "https://api.example.com/data",
"method": "POST",
"headers": {"Content-Type": "application/json"},
"data": "{\"query\": \"value\"}",
"max_cost": 500,
"max_fee": 5
}'
# List tokens (limit output for context window)
lnget tokens list --json --fields domain,amount_sat --limit 10
# Stream as NDJSON (one object per line)
lnget tokens list --ndjson
# Show token for a specific domain
lnget tokens show example.com --json
# Remove token for a domain
lnget tokens remove example.com
# Clear all tokens (requires --force in non-TTY)
lnget tokens clear --force
# Check connection status
lnget ln status --json
# Get detailed node info
lnget ln info --json
# Pair with LNC (secure stdin method)
echo "word1 word2 ... word10" | lnget ln lnc pair --stdin
# List saved LNC sessions
lnget ln lnc sessions --json
# List all commands
lnget schema
# Schema for a specific command
lnget schema tokens
# Full CLI schema tree (JSON)
lnget schema --all
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments or payment too expensive |
| 3 | L402 payment failed |
| 4 | Network or connection error |
| 5 | Authentication failure |
| 6 | Rate limited |
| 10 | Dry-run completed (no action taken) |
Errors are JSON on stderr:
{"error": true, "code": "payment_failed", "message": "no route found", "exit_code": 3}
Config file: ~/.lnget/config.yaml
# Show current config
lnget config show --json
# Set values via JSON
lnget config set --from-json '{"l402": {"max_cost_sats": 5000}}'
# Set single value via dot-path
lnget config set l402.max_cost_sats 5000
# Initialize default config
lnget config init
export LNGET_LN_MODE=lnd # or: lnc, none
export LNGET_LN_LND_HOST=localhost:10009
export LNGET_LN_LND_TLS_CERT=/path/to/tls.cert
export LNGET_LN_LND_MACAROON=/path/to/admin.macaroon
export LNGET_LN_LNC_PAIRING_PHRASE="word1 word2 ... word10"
Expose lnget as typed MCP tools for agent frameworks:
lnget mcp serve
Available tools: download, dry_run, tokens_list, tokens_show,
tokens_remove, ln_status, events_list, events_stats, config_show.
body=$(lnget -q https://api.example.com/data)
echo "$body" | jq '.result'
# Step 1: dry-run to see cost
result=$(lnget --dry-run https://api.example.com/paid)
amount=$(echo "$result" | jq '.invoice_amount_sat')
# Step 2: pay if within budget
if [ "$amount" -lt 500 ]; then
lnget --json --print-body https://api.example.com/paid
fi
if lnget tokens show example.com --json >/dev/null 2>&1; then
echo "Token cached, no payment needed"
fi
lnget -o large-file.zip https://api.example.com/file.zip
lnget -c -o large-file.zip https://api.example.com/file.zip
| Path | Description |
|---|---|
~/.lnget/config.yaml | Configuration file |
~/.lnget/tokens/<domain>/ | Cached L402 tokens |
~/.lnget/events.db | Payment event log |
~/.lnget/lnget.log | Application log |
~/.lnget/lnc/sessions/ | Saved LNC sessions |