Skip to main content

L402 API

Pay with Bitcoin, get AI results. Copy-paste the commands below.

Before You Start

Lightning Wallet

Phoenix, Muun, Wallet of Satoshi, Alby, or any LN wallet. Agents: CLW

Terminal or Tool

A command line, Postman, or lnget (recommended)

Private & No Signup

No account, no subscription, no personal data. Pay only when you use it

Want to try this without a terminal? Use Image Animation on the web — pay with any Lightning wallet, no setup needed.

Using the L402 Video from Image API

Animate a source image into a video with optional text guidance.

API Endpoint: https://sats4ai.com/api/l402/animate-image

Step 1: Initial Request

Send your parameters including the base64-encoded image. You will receive a 402 Payment Required response.

curl -X POST https://sats4ai.com/api/l402/animate-image \
-H "Content-Type: application/json" \
-d '{
  "prompt": "Make the person wave hello",
  "image": "data:image/png;base64,iVBORw0KGgo...",
  "duration": 5
}' \
-i

Expected 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/animate-image \
-H "Content-Type: application/json" \
-H "Authorization: L402 <YOUR_MACAROON_STRING_HERE>:<YOUR_PREIMAGE_HERE>" \
-d '{
  "prompt": "Make the person wave hello",
  "image": "data:image/png;base64,iVBORw0KGgo...",
  "duration": 5
}'

Expected Successful Response:

{ "videoUrl": "https://..." }

Request Body Parameters

prompt: string (required)

Text guidance for the animation/motion.

modelId: number or string (optional)

Omit for the best default model. See available models.

image: string (required)

Base64-encoded image (with or without data URI prefix).

duration: integer

Duration in seconds. Range: 3 to 15. Default: 5

Pricing

Flat rate: 100 sats/sec. Price = duration × 100.

Example: 5 seconds = 500 sats. 10 seconds = 1,000 sats.