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 Deblurring on the web — pay with any Lightning wallet, no setup needed.
Image Deblurring via L402
Recover detail from camera-shake and accidental motion blur using NAFNet (ECCV 2022, SOTA on GoPro/SIDD benchmarks). Real pixel reconstruction, not just sharpening. Also supports denoising (grainy/noisy photos).
Best for: handheld shake, bumped camera, whole-frame uniform blur. NOT effective for: intentional panning blur, bokeh/depth-of-field, or artistic motion effects.
API Endpoint: https://sats4ai.com/api/l402/deblur-image
Constraints
- Image must be base64-encoded (with or without
data:prefix) - Processing takes ~2 minutes (slowest of the image tools)
- Returns JSON with image URL
- 20 sats per image
Step 1: Initial Request (get Invoice)
Send your base64 image. You will receive a 402 Payment Required response with a Lightning invoice.
Request body:
{
"image": "<base64-encoded-blurry-image>"
}Example curl command:
curl -X POST https://sats4ai.com/api/l402/deblur-image \
-H "Content-Type: application/json" \
-d '{
"image": "<base64-encoded-blurry-image>"
}' \
-iStep 2: Pay the Lightning Invoice
Pay the invoice with any Lightning wallet. Save the preimage your wallet provides after payment.
Step 3: Re-send with Payment Proof
The JSON payload must be identical to Step 1.
curl -X POST https://sats4ai.com/api/l402/deblur-image \
-H "Content-Type: application/json" \
-H "Authorization: L402 <YOUR_MACAROON>:<YOUR_PREIMAGE>" \
-d '{
"image": "<base64-encoded-blurry-image>"
}'Successful response includes image_url (URL to deblurred image — download promptly).
Easier: Use lnget
lnget handles the full L402 flow automatically.
IMAGE_B64=$(base64 -w0 blurry.png)
lnget -X POST https://sats4ai.com/api/l402/deblur-image \
--json "{\"image\":\"$IMAGE_B64\"}"Python Example
import requests, base64
# Encode blurry image
with open("blurry.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
payload = {
"image": image_b64,
"task_type": "Image Debluring (GoPro)" # or "Image Debluring (REDS)", "Image Denoising"
}
# Step 1 — get invoice
r = requests.post("https://sats4ai.com/api/l402/deblur-image",
json=payload,
headers={"Content-Type": "application/json"})
# Step 2 — pay invoice with your Lightning wallet, get preimage
# Step 3 — re-send with auth
r2 = requests.post("https://sats4ai.com/api/l402/deblur-image",
json=payload,
headers={
"Content-Type": "application/json",
"Authorization": "L402 <macaroon>:<preimage>"
})
result = r2.json()
print(result["image_url"]) # URL to deblurred image (download promptly)Request Parameters
image: string required
Base64-encoded blurry or noisy image.
task_type: string (optional, default "Image Debluring (GoPro)")
"Image Debluring (GoPro)" for camera shake (default), "Image Debluring (REDS)" for video frame blur, or "Image Denoising" for grain/noise removal.
Pricing
20 sats per image.
Use Cases
- Rescue photos ruined by camera shake or hand tremor
- Recover detail from accidental bumps during long exposures
- Remove grain/noise from low-light or high-ISO images
- Clean up scanned documents before OCR