How to Use FLUX 3 Image Klein API
A step-by-step FLUX 3 Image Klein API tutorial with Node.js, Python and cURL: submit a text to image job, poll it or receive a webhook, and download the image. The example below costs $0.002.
- Endpoints
- 2
- Text to Image · Image Edit
- Example request
- $0.002
- Text to Image
- Languages
- 3
- Node.js · Python · cURL
- Failed runs
- $0
- refunded automatically
Get an API key
Create an account, add credits and create a key in Dashboard → API keys. Store it as CHEAPERGEN_API_KEY on your server. Every request sends it as a bearer token.
Choose a FLUX 3 Image Klein endpoint
Each task has its own endpoint. All of them take a JSON body and return a generation you can poll.
| Task | Endpoint | Required | From |
|---|---|---|---|
| Text to Image | bfl/flux-3-image-klein/text-to-image | prompt | $0.0011/image |
| Image Edit | bfl/flux-3-image-klein/edit | prompt, image_urls | $0.0011/image |
Submit a text to image job
This program submits the job, polls every 3 seconds until it finishes and prints the image URL. Swap the prompt and settings for your own.
const API = "https://cheapergen.com/api/v1";
const headers = {
Authorization: `Bearer ${process.env.CHEAPERGEN_API_KEY}`,
"Content-Type": "application/json",
};
// 1. Submit the job
let job = await fetch(`${API}/run/bfl/flux-3-image-klein/text-to-image`, {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "Editorial still life of a hand-thrown terracotta vase with dried orange ranunculus on a travertine plinth, low golden-hour sun from the left, long soft shadows on a warm plaster wall, medium-format film photograph",
"aspect_ratio": "1:1",
"resolution": "1K"
}),
}).then((r) => r.json());
// 2. Poll until it finishes (or pass webhook_url and skip polling)
while (job.status === "queued" || job.status === "running") {
await new Promise((r) => setTimeout(r, 3000));
job = await fetch(`${API}/generations/${job.id}`, { headers }).then((r) => r.json());
}
console.log(job.status === "succeeded" ? job.output.images[0].url : job.error);Set the parameters that matter
The settings for bfl/flux-3-image-klein/text-to-image, with what each one does to the price.
| Parameter | Type · default | What it does | Price effect |
|---|---|---|---|
| aspect_ratio | string (enum) · 1:1 | Output image shape. 1:1 · 4:5 · 3:4 · 2:3 · 9:16 · 1:2 · 9:21 · 5:4 · 4:3 · 3:2 · 16:9 · 2:1 · 21:9 · 7:5 · 5:7 | 1:1: $0.0011/image |
| resolution | string (enum) · 1K | Output size tier: 768 ≈ 0.6 MP, 1K ≈ 1 MP, 1.5K ≈ 2.4 MP, 2K ≈ 4 MP, 4K ≈ 16 MP. Up to 2K, wide and tall ratios keep the long side at 2048 px or less; 4K takes 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 9:21. 768 · 1K · 1.5K · 2K · 4K | 768: $0.0011/image 1K: $0.0019/image 1.5K: $0.0043/image 2K: $0.0074/image 4K: $0.0342/image |
| seed | integer | Use the same seed and settings to reproduce a result. Leave empty for random. | None |
| enable_safety_checker | boolean · true | If set to true, the safety checker will be enabled. Content our Acceptable Use Policy prohibits stays blocked either way. | None |
Other FLUX 3 Image Klein endpoints take the same shape with their own inputs:
POST /api/v1/run/bfl/flux-3-image-klein/edit
{
"prompt": "Put the lamp from image 2 on the desk in image 1; keep the room, the light and the camera angle",
"image_urls": [
"https://cdn.cheapergen.com/samples/portrait.jpg"
],
"aspect_ratio": "auto",
"resolution": "1K"
}Get the result
A job moves from queued to running to succeeded, failed or canceled. Poll GET /api/v1/generations/{id}, or pass webhook_url and we POST the result to you. Download the output and store it yourself.
{
"id": "gen_8c2QmX1nq0k4",
"object": "generation",
"model": "bfl/flux-3-image-klein",
"endpoint": "bfl/flux-3-image-klein/text-to-image",
"mode": "text-to-image",
"status": "succeeded",
"input": {
"prompt": "Editorial still life of a hand-thrown terracotta vase with dried orange ranunculus on a travertine plinth, low golden-hour sun from the left, long soft shadows on a warm plaster wall, medium-format film photograph",
"aspect_ratio": "1:1",
"resolution": "1K"
},
"output": {
"images": [
{
"url": "https://cdn.cheapergen.com/outputs/gen_8c2Q-0.png",
"content_type": "image/png",
"width": 2048,
"height": 2048
}
]
},
"error": null,
"cost": {
"amount_usd": 0.2255,
"currency": "usd",
"estimated": false,
"official_usd": 0.264,
"list_price_source": "official",
"list_price_label": "Official",
"saved_usd": 0.0385
},
"source": "api",
"created_at": "2026-10-15T09:21:04Z",
"started_at": "2026-10-15T09:21:06Z",
"completed_at": "2026-10-15T09:22:31Z"
}Price a request before you run it
The quote endpoint is free and needs no key. It returns the price, the official price and your discount for exactly the input you send.
curl -X POST https://cheapergen.com/api/v1/quote/bfl/flux-3-image-klein/text-to-image \
-H "Content-Type: application/json" \
-d '{"prompt":"Editorial still life of a hand-thrown terracotta vase with dried orange ranunculus on a travertine plinth, low golden-hour sun from the left, long soft shadows on a warm plaster wall, medium-format film photograph","aspect_ratio":"1:1","resolution":"1K"}'| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A parameter is missing or out of range — the message names it. |
| 401 | unauthorized | Missing, malformed or revoked API key. |
| 402 | insufficient_balance | Not enough credits for the quoted price; top up or enable auto top-up. |
| 429 | rate_limited | Too many requests or generations in progress; back off and retry. |
| 502 | upstream_error | The model provider failed; the hold is refunded and you can retry. |
| 503 | model_unavailable | No healthy route right now; retry later or pick another model. |
FAQ
