Skip to main content
PressL402Music

Featured on lncurl.lol: Generate Music with L402 — Pay with Bitcoin, Get a Song

lncurl.lol just published the second post in their L402 tutorial series — this time generating original songs with custom lyrics through Sats4AI's music endpoint. One command, one Lightning payment, one MP3. They even wrote songs about the agent economy.

1 command1 payment1 songZero accountsL402 protocol

What They Built

lncurl.lol is building a series of tutorials that each demonstrate L402 in action with a different Sats4AI endpoint. Last week it was image generation. This week: music. Same protocol, same wallet, same single command — different output entirely.

They sent a style prompt and custom lyrics to the /api/l402/generate-music endpoint, paid a Lightning invoice, and got back an MP3. Two songs total — an upbeat synthwave track and a boom bap hip-hop joint — both with lyrics about L402, agent wallets, and permissionless payments.

The Command

The entire flow is a single command using Alby's fetch-l402 CLI:

npx -y @getalby/cli fetch-l402 \
  -u https://sats4ai.com/api/l402/generate-music \
  -m POST \
  -H '{"Content-Type": "application/json"}' \
  -b '{
    "prompt": "upbeat synthwave, driving 80s bassline",
    "lyrics": "Spinning up at midnight...",
    "sample_rate": 44100,
    "bitrate": 256000,
    "audio_format": "mp3"
  }'

The CLI handles the L402 handshake automatically: sends the request, receives the 402, pays the Lightning invoice, retries with the receipt, and returns the result. No manual invoice handling.

What Happens Under the Hood

Request

The CLI sends a POST with the prompt, lyrics, and audio parameters to the music endpoint.

402 Response

The server returns HTTP 402 Payment Required with a Lightning invoice and a macaroon.

Payment

The CLI pays the Lightning invoice from the connected wallet. Settlement is instant.

Authenticated retry

The CLI re-sends the original request with the payment receipt in the Authorization header.

Song delivered

The server generates the song and returns an MP3 URL. One payment, one song.

The Songs

They wrote original lyrics for both tracks — about the L402 protocol, lncurl instant wallets, Nostr Wallet Connect, the Alby payments skill, and the agent economy. Two genres, same endpoint:

Track 1: Upbeat Synthwave

"Hit the endpoint, get the 402 / Pay the invoice, send the preimage through"

"lncurl dot lol — one call, one key / lncurl dot lol — machine-native and free"

Track 2: Boom Bap Hip-Hop

"L402 at the gate, agent knocks and pays / lncurl instant wallets spun up in a daze"

"Agent economy rising, sats the only tongue / Every node a voice, every invoice sung"

The Pattern

As lncurl.lol puts it: "L402 is quietly making pay-per-use AI real. Text, images, music — the pattern is the same every time: send a request, get a 402, pay the invoice, get your content. No accounts, no keys, no friction. Just sats."

This is the second post in their series. Last week it was image generation, this week music. The pattern holds across every endpoint because L402 is a protocol, not a product feature. Any service behind a 402 paywall works the same way.

The Tooling

lncurl.lol highlights two pieces of infrastructure that make agent payments frictionless:

lncurl Instant Wallets

Create a Lightning wallet in one command, no signup:

curl -X POST https://lncurl.lol

Returns a Nostr Wallet Connect URI. Fund it with a few sats and any agent can pay for services autonomously.

Alby Bitcoin Payments Skill

An agent skill that gives your agent Lightning network knowledge — paying invoices, checking balances, making L402 requests:

npx skills add getAlby/payments-skill

Try It Yourself

Via L402 (like the tutorial)

Use npx -y @getalby/cli fetch-l402 with any Lightning wallet. Follow the lncurl.lol tutorial for the full walkthrough.

Via MCP

Add Sats4AI as an MCP server and your agent gets access to music generation plus 40+ other tools:

claude mcp add sats4ai -- npx -y sats4ai-mcp-server

Via the web dashboard

Not building an agent? Generate music directly at sats4ai.com/music. Enter a prompt and lyrics, pay with any Lightning wallet.

Read the original post

The full tutorial with working code, embedded audio players, and the complete lyrics is on lncurl.lol.

Read on lncurl.lol

Generate Music with Bitcoin

Original songs with custom lyrics. 100 sats per track. No signup, no API key.