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 3D Model Generation on the web — pay with any Lightning wallet, no setup needed.

Using the L402 3D Model Generation API

Generate a 3D model from an image. Upload a photo of an object and receive a downloadable 3D model.

API Endpoint: https://sats4ai.com/api/l402/generate-3d-model

Step 1: Initial Request

Send the image as a base64 data URI. You will receive a 402 Payment Required response.

curl -X POST https://sats4ai.com/api/l402/generate-3d-model \
-H "Content-Type: application/json" \
-d '{
  "image": "data:image/png;base64,iVBORw0KGgo..."
}' \
-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/generate-3d-model \
-H "Content-Type: application/json" \
-H "Authorization: L402 <YOUR_MACAROON_STRING_HERE>:<YOUR_PREIMAGE_HERE>" \
-d '{
  "image": "data:image/png;base64,iVBORw0KGgo..."
}'

Expected Successful Response:

{ "modelUrl": "https://..." }

Note: 3D model generation may take up to 5 minutes. The request will wait until the model is ready.

Request Body Parameters

image: string (required)

Base64 data URI of the source image. Must include the data URI prefix.

Accepted formats: image/png, image/jpeg, image/webp

Example: "data:image/png;base64,iVBORw0KGgo..."