Skip to content

Commit 5bd3636

Browse files
committed
feat: add blog post about llm402.ai image generation
1 parent 924283e commit 5bd3636

5 files changed

Lines changed: 143 additions & 0 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: AI Image Generation, Paid Per Pixel with Lightning
3+
description: llm402.ai now supports image generation via L402 — generate FLUX or GPT-5 images for as little as 21 sats, no account or API key needed.
4+
date: 2026-04-10
5+
tags: [bitcoin, lightning, "402", l402, ai, images, flux]
6+
image: /blog/images/2026-04-10-ai-image-generation-l402-lightning.jpg
7+
imageAlt: A glowing cyan neon vending machine with AI-generated image thumbnails in each slot, golden lightning bolt coins floating toward it on a dark navy background.
8+
---
9+
10+
llm402.ai just added image generation to its L402-gated API, which means your agent can now generate images for as little as 21 sats — no account, no API key, no prepaid balance. Just a lightning wallet and a prompt.
11+
12+
## What llm402.ai Offers
13+
14+
[llm402.ai](https://llm402.ai) is an OpenAI-compatible API gateway where every request is gated by an L402 payment. Instead of signing up and loading credits, your agent makes a request, receives a `402 Payment Required` with a lightning invoice, pays it, and retries — all automatically.
15+
16+
Image generation lands at the standard `/v1/images/generations` endpoint with a range of models:
17+
18+
| Model | Price |
19+
| -------------- | -------- |
20+
| FLUX.1-schnell | 21 sats |
21+
| FLUX.2-pro | 63 sats |
22+
| FLUX.2-max | 147 sats |
23+
| Ideogram 3.0 | 126 sats |
24+
| GPT-5-image | 105 sats |
25+
26+
The cheapest option (FLUX.1-schnell at 21 sats) is fast enough for real-time workflows. The most capable option (GPT-5-image) produces dramatically more detailed output for about five times the price.
27+
28+
## Generating an Image with One Command
29+
30+
The [Alby payments skill](https://github.com/getAlby/payments-skill) handles L402 automatically. Install it once:
31+
32+
```bash
33+
npx skills add getAlby/payments-skill
34+
```
35+
36+
Then your agent can generate an image with a single call — the skill handles the 402 handshake, payment, and retry:
37+
38+
```bash
39+
npx -y @getalby/cli fetch -X POST \
40+
-H '{"Content-Type":"application/json"}' \
41+
-b '{
42+
"model": "black-forest-labs/FLUX.1-schnell",
43+
"prompt": "A vending machine dispensing AI-generated artwork for lightning bolt coins, each slot showing a different image style, pixel art",
44+
"width": 1200,
45+
"height": 630
46+
}' \
47+
https://llm402.ai/v1/images/generations
48+
```
49+
50+
The image comes back as a base64-encoded data URI in the response body. No separate download step, no polling — just a synchronous result.
51+
52+
## 21 Sats vs 105 Sats: A Real Comparison
53+
54+
We ran the exact same prompt through both FLUX.1-schnell and GPT-5-image to see what the price difference actually buys you.
55+
56+
**Prompt:** *"A vending machine dispensing AI-generated artwork for lightning bolt coins, each slot showing a different image style, pixel art"*
57+
58+
### FLUX.1-schnell — 21 sats
59+
60+
![A pixel art vending machine with lightning bolt coin slots, each slot displaying a different style of AI-generated artwork, generated by FLUX.1-schnell](/blog/images/llm402-vending-machine.jpg)
61+
62+
Fast, abstract, painterly. Captures the concept loosely — a vending machine shape with colourful circular slots. Generated in under 5 seconds.
63+
64+
### GPT-5-image — 105 sats
65+
66+
![A detailed pixel art AI-ART DISPENSER vending machine with Insert Coin and Generate buttons, various pixel art thumbnails in the slots and lightning bolt coins scattered at the base, generated by GPT-5-image](/blog/images/llm402-gpt5-vending-machine.png)
67+
68+
Coherent, detailed, on-theme. The machine has an "AI-ART DISPENSER" sign, "INSERT COIN" and "GENERATE" buttons, distinct pixel art thumbnails in each slot, and lightning bolt coins at the base. Generated in around 60 seconds.
69+
70+
The 5× price difference maps directly onto the quality gap. For a quick thumbnail or draft, FLUX.1-schnell is more than adequate. For anything that ends up in front of a user, GPT-5-image earns its cost.
71+
72+
## How It Works Under the Hood
73+
74+
The L402 flow is straightforward:
75+
76+
1. **Initial request** — agent POSTs to `/v1/images/generations`
77+
2. **402 response** — server replies with a `WWW-Authenticate: L402` header containing a macaroon and a BOLT11 lightning invoice
78+
3. **Payment** — agent pays the invoice using its NWC-connected wallet
79+
4. **Authenticated retry** — agent re-sends the request with `Authorization: L402 <macaroon>:<preimage>`
80+
5. **Image returned** — server verifies payment and returns the generated image
81+
82+
The Alby payments skill wraps steps 2–4 into a single function call, so agents don't need to implement the protocol manually.
83+
84+
## Using It in a TypeScript Agent
85+
86+
```typescript
87+
import { fetch402 } from "@getalby/payments-skill";
88+
89+
const response = await fetch402("https://llm402.ai/v1/images/generations", {
90+
method: "POST",
91+
headers: { "Content-Type": "application/json" },
92+
body: JSON.stringify({
93+
model: "black-forest-labs/FLUX.1-schnell",
94+
prompt: "your prompt here",
95+
width: 1024,
96+
height: 1024,
97+
}),
98+
});
99+
100+
const { data } = await response.json();
101+
const imageUrl = data[0].url; // base64 data URI
102+
```
103+
104+
Switch `model` to `openai/gpt-5-image` for higher quality — same code, different cost.
105+
106+
## Conclusion
107+
108+
L402 image generation on llm402.ai is a clean example of what pay-per-use AI infrastructure looks like in practice: no accounts, no rate limits tied to subscription tiers, no credit management. Your agent pays exactly what the image costs and moves on.
109+
110+
The model choice is a straightforward trade-off: 21 sats for speed, 105 sats for quality. Both work with the same one-line command.
111+
112+
---
113+
114+
## Get started
115+
116+
Need a Lightning wallet for your agent? Create one in one command — no sign-up, no KYC:
117+
118+
```bash
119+
curl -X POST https://lncurl.lol
120+
```
121+
122+
You'll get back a Nostr Wallet Connect URI. Fund it with a few sats and your agent can pay for APIs, services, and tools autonomously.
123+
124+
Or give your agent the lncurl skill directly: <https://lncurl.lol/SKILL.md>

frontend/public/blog-manifest.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
[
2+
{
3+
"slug": "2026-04-10-ai-image-generation-l402-lightning",
4+
"title": "AI Image Generation, Paid Per Pixel with Lightning",
5+
"description": "llm402.ai now supports image generation via L402 — generate FLUX or GPT-5 images for as little as 21 sats, no account or API key needed.",
6+
"date": "2026-04-10",
7+
"isoDate": "2026-04-10T00:00:00Z",
8+
"displayDate": "April 10, 2026",
9+
"tags": [
10+
"bitcoin",
11+
"lightning",
12+
"402",
13+
"l402",
14+
"ai",
15+
"images",
16+
"flux"
17+
],
18+
"image": "/blog/images/2026-04-10-ai-image-generation-l402-lightning.jpg",
19+
"imageAlt": "A glowing cyan neon vending machine with AI-generated image thumbnails in each slot, golden lightning bolt coins floating toward it on a dark navy background."
20+
},
221
{
322
"slug": "2026-04-09-smoke-test-l402-integration",
423
"title": "Smoke-Test Your L402 Integration in One Request",
76.5 KB
Loading
1.52 MB
Loading
137 KB
Loading

0 commit comments

Comments
 (0)