L402 API Catalog › AI/LLM Utilities
LLM Prompt L402 API
GPT-4o-mini access with 128 token limit. Quick AI completions.
500 sats per call, paid over the Lightning Network. No API key and no signup: the first request answers 402 Payment Required with a Lightning invoice, and repeating the request with the proof of payment returns your data.
l402_llm_prompt
500 sats
Parameters
prompt Your prompt text
Call it with curl
The first call answers 402 with a Lightning invoice in the WWW-Authenticate header. Pay it from any Lightning wallet, then repeat the call with the L402 token and preimage.
curl -X POST https://lightningfaucet.com/api/ \
-H "Content-Type: application/json" \
-H "Authorization: L402 $MACAROON:$PREIMAGE" \
-d '{"action":"l402_llm_prompt","prompt":"Summarize the Lightning Network in two sentences."}'
What comes back
A successful call returns JSON, with the delivered content merged over the standard L402 receipt fields. Example values, not live data.
{
"success": true,
"http_code": 200,
"service": "llm_prompt",
"timestamp": "2026-09-11T15:04:05+00:00",
"paid_sats": 500,
"response": "The Lightning Network settles Bitcoin payments in payment channels held between two parties, so only the opening and closing balances touch the chain. That keeps transfers near-instant and the fees measured in fractions of a sat.",
"model": "gpt-4o-mini",
"tokens_used": 94,
"prompt_tokens": 31,
"completion_tokens": 63
}
Call it from an AI agent
With lightning-wallet-mcp the payment is handled for you. From the CLI:
lw pay-api "https://lightningfaucet.com/api/l402/llm_prompt?prompt=Summarize+the+Lightning+Network+in+two+sentences."
In Claude Code, Cursor or any MCP host, ask the agent to call pay_l402_api with that URL. The fee is 1% of the price, rounded down, so calls under 100 sats carry no platform fee.
Questions
How much does the LLM Prompt API cost?
Each call costs 500 sats, paid as a Lightning invoice at request time. There is no subscription, no minimum and no monthly bill: you are charged for the calls you make.
Do I need an API key or an account?
No. Payment is the authentication. The first request answers 402 Payment Required with a Lightning invoice; settling it returns a preimage that authenticates the retry.
What does LLM Prompt return?
A JSON object carrying response, model, tokens_used, prompt_tokens and completion_tokens. See the example response above for the exact shape.
Related endpoints
All AI/LLM Utilities endpoints · How L402 authentication works · List your own API on the gateway