$npx -y skills add lightninglabs/lightning-agent-tools --skill lngetInstall and use lnget, a Lightning-native HTTP client with automatic L402 payment support. Use when downloading files behind Lightning paywalls, managing L402 tokens, checking Lightning backend status, or making HTTP requests that may require micropayments.
| 1 | # lnget - Lightning-Native HTTP Client |
| 2 | |
| 3 | lnget is a wget/curl-like CLI that natively handles L402 (Lightning HTTP 402) |
| 4 | authentication. When a server responds with HTTP 402 and an L402 challenge, |
| 5 | lnget automatically pays the Lightning invoice and retries with the paid token. |
| 6 | |
| 7 | **Source:** `github.com/lightninglabs/lnget` |
| 8 | |
| 9 | ## Quick Start |
| 10 | |
| 11 | ```bash |
| 12 | # 1. Install lnget |
| 13 | skills/lnget/scripts/install.sh |
| 14 | |
| 15 | # 2. Initialize config (auto-detects local lnd) |
| 16 | lnget config init |
| 17 | |
| 18 | # 3. Fetch an L402-protected resource |
| 19 | lnget --max-cost 1000 https://api.example.com/paid-data |
| 20 | ``` |
| 21 | |
| 22 | ## Installation |
| 23 | |
| 24 | ```bash |
| 25 | skills/lnget/scripts/install.sh |
| 26 | ``` |
| 27 | |
| 28 | This will: |
| 29 | - Verify Go is installed |
| 30 | - Run `go install github.com/lightninglabs/lnget/cmd/lnget@latest` |
| 31 | - Verify `lnget` is on `$PATH` |
| 32 | |
| 33 | To install manually: |
| 34 | |
| 35 | ```bash |
| 36 | go install github.com/lightninglabs/lnget/cmd/lnget@latest |
| 37 | ``` |
| 38 | |
| 39 | Or build from source: |
| 40 | |
| 41 | ```bash |
| 42 | git clone https://github.com/lightninglabs/lnget.git |
| 43 | cd lnget |
| 44 | make install |
| 45 | ``` |
| 46 | |
| 47 | ## Basic Usage |
| 48 | |
| 49 | ### Downloads |
| 50 | |
| 51 | ```bash |
| 52 | # Fetch URL (output to stdout) |
| 53 | lnget https://api.example.com/data.json |
| 54 | |
| 55 | # Save to file |
| 56 | lnget -o data.json https://api.example.com/data.json |
| 57 | |
| 58 | # Quiet mode for piping |
| 59 | lnget -q https://api.example.com/data.json | jq . |
| 60 | |
| 61 | # Resume partial download |
| 62 | lnget -c -o largefile.zip https://api.example.com/largefile.zip |
| 63 | |
| 64 | # Custom HTTP method with data |
| 65 | lnget -X POST -d '{"query":"test"}' https://api.example.com/search |
| 66 | |
| 67 | # Custom headers |
| 68 | lnget -H "Accept: text/plain" https://api.example.com/data |
| 69 | ``` |
| 70 | |
| 71 | ### Payment Control |
| 72 | |
| 73 | ```bash |
| 74 | # Set maximum auto-pay amount (satoshis) |
| 75 | lnget --max-cost 5000 https://api.example.com/expensive.json |
| 76 | |
| 77 | # Set maximum routing fee |
| 78 | lnget --max-fee 50 https://api.example.com/data.json |
| 79 | |
| 80 | # Preview without paying (shows 402 challenge details) |
| 81 | lnget --no-pay https://api.example.com/data.json |
| 82 | |
| 83 | # Custom payment timeout |
| 84 | lnget --payment-timeout 120s https://api.example.com/data.json |
| 85 | ``` |
| 86 | |
| 87 | ### Output Modes |
| 88 | |
| 89 | ```bash |
| 90 | # JSON output (default, best for programmatic use) |
| 91 | lnget --json https://api.example.com/data.json |
| 92 | |
| 93 | # Human-readable output |
| 94 | lnget --human https://api.example.com/data.json |
| 95 | |
| 96 | # Verbose mode (shows L402 flow details) |
| 97 | lnget -v https://api.example.com/data.json |
| 98 | |
| 99 | # Disable progress bar |
| 100 | lnget --no-progress -o file.zip https://api.example.com/file.zip |
| 101 | ``` |
| 102 | |
| 103 | ## Subcommands |
| 104 | |
| 105 | ### Token Management (`lnget tokens`) |
| 106 | |
| 107 | Tokens are cached per-domain at `~/.lnget/tokens/<domain>/token.json` and |
| 108 | reused automatically on subsequent requests. |
| 109 | |
| 110 | ```bash |
| 111 | # List all cached tokens |
| 112 | lnget tokens list |
| 113 | |
| 114 | # Show token for a specific domain |
| 115 | lnget tokens show api.example.com |
| 116 | |
| 117 | # Remove token for a domain (forces re-authentication) |
| 118 | lnget tokens remove api.example.com |
| 119 | |
| 120 | # Clear all tokens |
| 121 | lnget tokens clear --force |
| 122 | ``` |
| 123 | |
| 124 | ### Configuration (`lnget config`) |
| 125 | |
| 126 | ```bash |
| 127 | # Initialize config file at ~/.lnget/config.yaml |
| 128 | lnget config init |
| 129 | |
| 130 | # Show current configuration |
| 131 | lnget config show |
| 132 | |
| 133 | # Show config file path |
| 134 | lnget config path |
| 135 | ``` |
| 136 | |
| 137 | ### Lightning Backend (`lnget ln`) |
| 138 | |
| 139 | ```bash |
| 140 | # Check backend connection status |
| 141 | lnget ln status |
| 142 | |
| 143 | # Show detailed node info |
| 144 | lnget ln info |
| 145 | ``` |
| 146 | |
| 147 | #### LNC (Lightning Node Connect) |
| 148 | |
| 149 | ```bash |
| 150 | # Pair with a node via LNC pairing phrase |
| 151 | lnget ln lnc pair "your-pairing-phrase" |
| 152 | |
| 153 | # Ephemeral pairing (no session persistence) |
| 154 | lnget ln lnc pair "phrase" --ephemeral |
| 155 | |
| 156 | # List saved LNC sessions |
| 157 | lnget ln lnc sessions |
| 158 | |
| 159 | # Revoke a session |
| 160 | lnget ln lnc revoke <session-id> |
| 161 | ``` |
| 162 | |
| 163 | #### Neutrino (Embedded Wallet) |
| 164 | |
| 165 | ```bash |
| 166 | # Initialize embedded neutrino wallet |
| 167 | lnget ln neutrino init |
| 168 | |
| 169 | # Get address to fund wallet |
| 170 | lnget ln neutrino fund |
| 171 | |
| 172 | # Check wallet balance |
| 173 | lnget ln neutrino balance |
| 174 | |
| 175 | # Show sync status |
| 176 | lnget ln neutrino status |
| 177 | ``` |
| 178 | |
| 179 | ## Configuration File |
| 180 | |
| 181 | Config lives at `~/.lnget/config.yaml`. Run `lnget config init` to create it. |
| 182 | |
| 183 | **Note:** `lnget config init` may generate incorrect YAML key names (e.g., |
| 184 | `tlscertpath` and `macaroonpath` instead of `tls_cert` and `macaroon`) due to |
| 185 | missing yaml struct tags in the lnget source. Use the example below as the |
| 186 | reference config format. If your config was generated by `lnget config init`, |
| 187 | verify the `ln.lnd` keys match the format shown here. |
| 188 | |
| 189 | ```yaml |
| 190 | l402: |
| 191 | max_cost_sats: 1000 # Max invoice to auto-pay |
| 192 | max_fee_sats: 10 # Max routing fee |
| 193 | payment_timeout: 60s # Payment timeout |
| 194 | auto_pay: true # Enable auto-payment |
| 195 | |
| 196 | http: |
| 197 | timeout: 30s |
| 198 | max_redirects: 10 |
| 199 | user_agent: "lnget/0.1.0" |
| 200 | allow_insecure: false |
| 201 | |
| 202 | ln: |
| 203 | mode: lnd # Options: lnd, lnc, neutrino |
| 204 | lnd: |
| 205 | host: localhost:10009 |
| 206 | tls_cert: ~/.lnd/tls.cert |
| 207 | macaroon: ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon |
| 208 | network: mainnet |
| 209 | |
| 210 | output: |
| 211 | format: json |
| 212 | progress: true |
| 213 | verbose: false |
| 214 | |
| 215 | tokens: |
| 216 | dir: ~/.lnget/tokens |
| 217 | ` |