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 Audio Transcription on the web — pay with any Lightning wallet, no setup needed.

Using the L402 Speech Transcription API

Transcribe audio files to text using Voxtral Mini Transcribe V2 by Mistral AI. Supports 13 languages, up to 3 hours of audio per request (512 MB max), and multiple output formats.

Pricing: 10 Sats per minute of audio (approximately $0.01 USD/min)

API Endpoint: https://sats4ai.com/api/l402/transcribe-audio

Step 1: Initial Request

Send your audio file (base64-encoded) with the desired operation type. You will receive a 402 Payment Required response.

curl -X POST https://sats4ai.com/api/l402/transcribe-audio \
-H "Content-Type: application/json" \
-d '{
  "file": "<base64-encoded-audio-data>",
  "type": "transcription",
  "language": "en"
}' \
-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/transcribe-audio \
-H "Content-Type: application/json" \
-H "Authorization: L402 <YOUR_MACAROON_STRING_HERE>:<YOUR_PREIMAGE_HERE>" \
-d '{
  "file": "<base64-encoded-audio-data>",
  "type": "transcription",
  "language": "en"
}'

Expected Successful Response:

{ "text": "Hello, this is the transcribed text from your audio file." }

Request Body Parameters

file: string (required)

Base64-encoded audio data. Supported formats: MP3, WAV, FLAC, OGG, M4A.

type: string (required)

Accepted values: "transcription", "translation"

language: string

Language code. Supported: en, zh, hi, es, ar, fr, pt, ru, de, ja, ko, it, nl. Omit for auto-detection.

modelId: number or string (optional)

Omit for the best default model. See available models.