L402 API
Pay with Bitcoin, get AI results. Copy-paste the commands below.
Choose a service:
Before You Start
Want to try this without a terminal? Use Image Analysis on the web — pay with any Lightning wallet, no setup needed.
Using the L402 Image Analysis API
Analyze and describe image content using AI vision models. Ask questions about any image.
API Endpoint: https://sats4ai.com/api/l402/analyze-image
Step 1: Initial Request
Send the image (base64 or data URI) with your question. You will receive a 402 Payment Required response.
curl -X POST https://sats4ai.com/api/l402/analyze-image \
-H "Content-Type: application/json" \
-d '{
"image": "data:image/png;base64,iVBORw0KGgo...",
"prompt": "What objects are in this image?"
}' \
-iExpected Response Headers:
www-authenticate: L402 macaroon="<YOUR_MACAROON>", invoice="<LIGHTNING_INVOICE>"Step 2: Pay the Lightning Invoice
Pay the invoice and save the preimage.
Step 3: Final Request
Send the exact same request with the Authorization header.
Important: The JSON payload must be identical to Step 1.
curl -X POST https://sats4ai.com/api/l402/analyze-image \
-H "Content-Type: application/json" \
-H "Authorization: L402 <YOUR_MACAROON_STRING_HERE>:<YOUR_PREIMAGE_HERE>" \
-d '{
"image": "data:image/png;base64,iVBORw0KGgo...",
"prompt": "What objects are in this image?"
}'Expected Successful Response:
{ "content": "The image shows a cat sitting on a wooden table near a window..." }Request Body Parameters
image: string (required)
Base64-encoded image or data URI (e.g. data:image/png;base64,...). If no prefix is provided, data:image/png;base64, is assumed.
prompt: string
Question to ask about the image. Default: "What's in this image?"
modelId: number or string (optional)
Omit for the best default model. See available models.