> ## Documentation Index
> Fetch the complete documentation index at: https://docs.laozhang.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# FLUX 3 API pricing: generate and edit images

> Call flux-3-image and FLUX 3 Image Klein on LaoZhang API: resolution and price per model ID, text-to-image and edit examples, parameters, and errors.

FLUX 3 Image is Black Forest Labs' newest image model: it generates from text, edits from instructions, and combines up to 10 reference images into one. FLUX 3 Image Klein is the smaller, faster, cheaper variant. The model name sets the resolution, and prices start at \$0.009 per image.

| Item | Details |
| - | - |
| Model IDs | `flux-3-image` and `flux-3-image-klein`, each with 1.5K, 2K, and 4K versions (eight in total); see [Models and prices](#models-and-prices) |
| Endpoint | `POST https://api.laozhang.ai/v1/images/generations` with a JSON body, for both generation and editing |
| Token | `default` group, billing mode Usage first (recommended) or Per-call |
| Billing | Per call, one image per request; reference images cost nothing extra |
| Framing | `aspect_ratio`, default `auto`; three fixed `size` values also work |
| Result | `data[0].url` (expires in about an hour) or `b64_json` |
| Available since | December 3, 2026 |

## Models and prices

The resolution is part of the model name, and FLUX 3 Image and Klein produce the same pixel count at each tier:

| Tier | Output | FLUX 3 Image | FLUX 3 Image Klein |
| - | - | - | - |
| 1K | \~1 MP | `flux-3-image` \$0.048 | `flux-3-image-klein` \$0.009 |
| 1.5K | \~2 MP | `flux-3-image-1.5k` \$0.07 | `flux-3-image-klein-1.5k` \$0.011 |
| 2K | \~4 MP | `flux-3-image-2k` \$0.10 | `flux-3-image-klein-2k` \$0.014 |
| 4K | \~16 MP | `flux-3-image-4k` \$0.607 | `flux-3-image-klein-4k` \$0.036 |

* Prices are per image in USD and match the 1K, 1.5K, 2K, and 4K prices on [BFL's pricing page](https://bfl.ai/pricing) (checked December 3, 2026).
* An edit costs the same as a generation on the same model, whether you send one reference image or ten.
* The 1K model names also accept `"resolution": "768sq"` for a smaller image, billed at the 1K price.
* [Call logs](https://docs.laozhang.ai/en/faq/call-logs.md) show what each request was charged; the [model and pricing catalog](https://docs.laozhang.ai/en/models.md) lists current prices.

Typical output sizes:

* 1K at 16:9: 1360×768
* 1.5K at 16:9: 2048×1152
* 2K at 1:1: 2048×2048
* 4K at 16:9: 5456×3072

## Choose a model and tier

* **FLUX 3 Image** puts image quality and prompt following first. Use it for final assets, complex scenes, and multi-image composites. A 1K image takes about 25–32 seconds, and an edit 40–90 seconds.
* **FLUX 3 Image Klein** is the compact model whose weights BFL has released openly. It is built for speed and low cost, so it suits batch jobs, previews, and quick iteration: about 10 seconds at 1K and 13 seconds per edit.
* **Tier**: 1K covers web and social images; 1.5K or 2K suits product shots and images people zoom into; 4K is for large prints and images you plan to crop. A 4K image takes about 80–100 seconds.

Both families take exactly the same request fields, so switching only changes `model`.

## Before you start

**1. Create an API key**

In [Token management](https://api.laozhang.ai/token), create a key in the `default` group (or edit an existing one) and set **Billing mode** (计费模式) to **Usage first** (按量优先, recommended) or **Per-call** (按次计费). A Usage first key can call both per-call and usage-based models; a Per-call key calls only per-call models.

Keep the key in a server-side environment variable.

![In Token management, create a token with Billing mode set to Per-call (按次计费), then select Create.](https://mintcdn.com/laozhangai-edd05f2c/_loZ0Jy0ZI__xJ9z/images/token-create-per-request.png?fit=max\&auto=format\&n=_loZ0Jy0ZI__xJ9z\&q=85\&s=1fdceb804bb3ad50f83a21ec65b4d807)

**2. Set up your environment**

Export the key and install `requests`, which the Python examples use:

```bash theme={null}
export LAOZHANG_API_KEY="YOUR_LAOZHANG_API_KEY"
python3 -m pip install requests
```

The cURL examples write the response to a JSON file and then download the image with `save_images.py`, the [save script from the Images API reference](https://docs.laozhang.ai/en/api-reference/images.md#save-images-from-a-response). The Python examples download the URL directly.

## Generate an image

A request with only `model` and `prompt` is text-to-image. Set the framing with `aspect_ratio`; if you leave it out, it is `auto` and the model picks a ratio from the prompt, usually 16:9 for text-to-image.

### cURL

```bash theme={null}
curl --fail-with-body --max-time 300 "https://api.laozhang.ai/v1/images/generations" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-3-image",
    "prompt": "A cozy ceramic studio at golden hour, shelves of glazed mugs, a potter shaping clay at the wheel, warm film photography",
    "aspect_ratio": "16:9"
  }' \
  -o flux3-generation.json

python3 save_images.py flux3-generation.json flux3-generation
```

The request returns a 1360×768 image. The script downloads `data[0].url` right away and names the file by its actual format. For 2K or 4K, change only `model` to `flux-3-image-2k` or `flux-3-image-4k`.

### Python

This example generates a 2048×2048 square with `flux-3-image-2k`:

```python theme={null}
import os
from pathlib import Path

import requests

response = requests.post(
    "https://api.laozhang.ai/v1/images/generations",
    headers={"Authorization": f"Bearer {os.environ['LAOZHANG_API_KEY']}"},
    json={
        "model": "flux-3-image-2k",
        "prompt": "A minimalist product photo of a matte black wireless earbud case on wet slate, soft rim light",
        "aspect_ratio": "1:1",
    },
    timeout=300,
)
response.raise_for_status()
item = response.json()["data"][0]
print("Revised prompt:", item.get("revised_prompt"))

# The URL expires in about an hour, so download it now.
download = requests.get(item["url"], timeout=120)
download.raise_for_status()
extension = "png" if download.content.startswith(b"\x89PNG") else "jpg"
output = Path(f"flux3-2k.{extension}")
output.write_bytes(download.content)
print(f"Saved {output}")
```

### Response fields

* `data[0].url`: the image URL, valid for about an hour. With `"response_format": "b64_json"` you get `data[0].b64_json` instead.
* `data[0].revised_prompt`: the prompt the model actually used.
* `cost`: BFL credits used by the request, where 1 credit is \$0.01, so it matches the charge (4.8 for `flux-3-image`).
* `output_mp` (FLUX 3 Image only): output size in megapixels.
* `created` and `usage`: creation time and usage details.

## Edit images and combine references

Edits use the same `POST /v1/images/generations` request with reference images added:

* `images`: an array of up to 10 images, for combining several references
* `input_image`: a single image, when you edit just one

Each image is a public URL or a `data:image/png;base64,...` data URL. This example turns two local files into data URLs and places a mug into a table scene:

### cURL

```bash theme={null}
MUG=mug.png       # replace with your own files
TABLE=table.png
IMG1="data:$(file --mime-type -b "$MUG");base64,$(base64 < "$MUG" | tr -d '\n')"
IMG2="data:$(file --mime-type -b "$TABLE");base64,$(base64 < "$TABLE" | tr -d '\n')"

curl --fail-with-body --max-time 300 "https://api.laozhang.ai/v1/images/generations" \
  -H "Authorization: Bearer $LAOZHANG_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- \
  -o flux3-edit.json <<EOF
{
  "model": "flux-3-image",
  "prompt": "Place the ceramic mug from the first image on the wooden table from the second image. Keep the mug's glaze pattern and the table's natural window light.",
  "images": ["$IMG1", "$IMG2"]
}
EOF

python3 save_images.py flux3-edit.json flux3-edit
```

If your images are already online, put their URLs in the array instead. Edits with FLUX 3 Image usually take 40–90 seconds, so give the client at least 300 seconds.

### Python

Klein finishes an edit in about 13 seconds, which suits batch edits. This example replaces the background of a local image:

```python theme={null}
import base64
import mimetypes
import os
from pathlib import Path

import requests


def to_data_url(path: str) -> str:
    mime = mimetypes.guess_type(path)[0] or "image/png"
    encoded = base64.b64encode(Path(path).read_bytes()).decode()
    return f"data:{mime};base64,{encoded}"


response = requests.post(
    "https://api.laozhang.ai/v1/images/generations",
    headers={"Authorization": f"Bearer {os.environ['LAOZHANG_API_KEY']}"},
    json={
        "model": "flux-3-image-klein",
        "prompt": "Keep the subject. Replace the background with a clean pale blue studio backdrop and preserve the original lighting.",
        "input_image": to_data_url("source.png"),  # replace with your file
    },
    timeout=300,
)
response.raise_for_status()
download = requests.get(response.json()["data"][0]["url"], timeout=120)
download.raise_for_status()
extension = "png" if download.content.startswith(b"\x89PNG") else "jpg"
output = Path(f"flux3-klein-edit.{extension}")
output.write_bytes(download.content)
print(f"Saved {output}")
```

To send several references, replace `input_image` with `"images": [to_data_url("a.png"), to_data_url("b.png")]`.

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | One of the eight model IDs; sets the resolution and price |
| `prompt` | string | Yes | What to generate, or the edit instruction |
| `aspect_ratio` | string | No | Framing, default `auto`; values below |
| `size` | string | No | Only `1024x1024`, `1536x1024`, `1024x1536`, or `auto` |
| `resolution` | string | No | Optional; if sent, it must match the tier in the model name, for example `2k` on `flux-3-image-2k` |
| `images` | string\[] | For edits | Up to 10 reference images, as public URLs or data URLs |
| `input_image` | string | For edits | One reference image; use instead of `images` |
| `seed` | integer | No | Fixed seed for repeatable results; Klein returns the `seed` it used |
| `response_format` | string | No | `url` (default) or `b64_json` |
| `n` | integer | No | Ignored; each request returns one image and is billed once |

`aspect_ratio` values:

* Landscape: 21:9, 2:1, 16:9, 3:2, 7:5, 4:3, 5:4
* Square: 1:1
* Portrait: 4:5, 3:4, 5:7, 2:3, 9:16, 1:2, 9:21
* `auto`: the model chooses from the prompt

`size` only sets the ratio; the resolution still comes from the model name:

* `1024x1024`: 1:1
* `1536x1024`: 3:2, for example 1248×832 on `flux-3-image`
* `1024x1536`: 2:3

Any other size, and any `width` or `height`, returns a 400.

## Errors and billing

These errors return HTTP 400 and are not charged:

| Error message (start) | Cause | Fix |
| - | - | - |
| flux-3-image is 1K (768sq also accepted). For higher resolution use flux-3-image-1.5k, flux-3-image-2k or flux-3-image-4k. | A higher `resolution` sent to a 1K model | Use the model name for that tier, or drop `resolution` |
| flux-3-image-2k outputs 2K; leave resolution out or set it to 2k. Other resolutions use another model name: ... | `resolution` doesn't match the model's tier; other tier names answer the same way | Drop `resolution`, or set it to the tier in the model name |
| width/height are not supported for FLUX 3 models. Set aspect\_ratio (or size 1024x1024, 1536x1024, 1024x1536) and choose the resolution by model name ... | The request includes `width` or `height` | Use `aspect_ratio` and pick the resolution by model name |
| Unsupported size for FLUX 3 models. ... | `size` isn't one of the three fixed values | Use `aspect_ratio`, or one of the three sizes |
| The request was not accepted. Please check the request parameters and content and try again, or contact support. | The model rejected another parameter or the content | Check parameter values, the prompt, and the reference images, then retry |

> [!WARNING]
>
> **A client timeout is not a failed request.**
>
> * A 4K image takes about 80–100 seconds and a FLUX 3 Image edit up to 90 seconds, so set timeouts of about 300 seconds on your client, reverse proxy, and serverless function.
> * If the client disconnects early, the server may still finish and charge the request. Check [call logs](https://docs.laozhang.ai/en/faq/call-logs.md) before you resend.

## FAQ

### How much does the FLUX 3 API cost per image?

From \$0.009 to \$0.607 per image, depending on the tier in the model name: Klein at 1K is the cheapest and FLUX 3 Image at 4K the most expensive. See [Models and prices](#models-and-prices) for the full list. Edits cost the same as generations, and reference images are free.

### What's the difference between FLUX 3 and FLUX.2?

FLUX.2 (`flux-2-pro`, `flux-2-flex`, `flux-2-max`) was retired on LaoZhang API on December 3, 2026; calls return a 404 and aren't billed. Both use the same endpoint, but the request format differs:

| | FLUX 3 | FLUX.2 (retired) |
| - | - | - |
| Resolution | Set by the model name, 1K to 4K | `size`, or `width` and `height`, up to about 4 MP |
| Framing | `aspect_ratio`: 15 ratios plus `auto` | Follows the size |
| Reference images | `images` array, up to 10 | `input_image` to `input_image_8`, up to 8 |
| Result URL | Valid for about an hour | Valid for about 10 minutes |
| Price per image | \$0.009–\$0.607 | \$0.03–\$0.07 |

To move from FLUX.2, drop `width` and `height`, and use `aspect_ratio` with a tiered model name instead:

* `flux-2-pro` → `flux-3-image` (1K, \$0.048)
* `flux-2-flex` → `flux-3-image` or `flux-3-image-2k` (\$0.10)
* `flux-2-max` → `flux-3-image-2k` or `flux-3-image-4k` (\$0.607)

The [FLUX.2 retirement announcement](https://docs.laozhang.ai/en/announcements/flux-2-retired-2026-12.md) has a before-and-after request. The legacy Kontext models were also retired on December 3, 2026. Move them to FLUX 3 the same way:

* `flux-kontext-pro` and `flux-kontext-max` → `flux-3-image` (1K, \$0.048)
* For higher resolution use `flux-3-image-2k` (\$0.10); for fast, low-cost edits use `flux-3-image-klein` (\$0.009)
* Send the source image as `input_image` or in `images`, with the edit instruction as `prompt`

### How do I generate 2K or 4K images with FLUX 3?

Change `model` to a tiered name such as `flux-3-image-4k` or `flux-3-image-klein-4k`; you don't need `resolution`.

Sending `"resolution": "4k"` to `flux-3-image` returns a 400.

### Can I generate several images in one request?

No. `n` is ignored, so each request returns one image and is billed once. For more images, send parallel requests with different `seed` values.

### How long does the image URL last?

About an hour. Download each image as soon as its request returns and store it yourself, or send `"response_format": "b64_json"` to get the image data in the response.

### Is FLUX 3 video available?

No. LaoZhang API offers the FLUX 3 Image and FLUX 3 Image Klein image models only.

## Related documentation

* [FLUX.2 retirement announcement](https://docs.laozhang.ai/en/announcements/flux-2-retired-2026-12.md): which FLUX 3 model replaces `flux-2-pro`, `flux-2-flex`, and `flux-2-max`
* [FLUX.2 image generation](https://docs.laozhang.ai/en/api-capabilities/flux-image-generation.md): the retired FLUX.2 and FLUX Kontext request formats, for reference while you migrate
* [Choose an image generation API](https://docs.laozhang.ai/en/api-capabilities/image-generation-guide.md): compare FLUX with GPT Image, Nano Banana, and Seedream
* [Images API reference](https://docs.laozhang.ai/en/api-reference/images.md): shared request format and the save script
* [Model and pricing catalog](https://docs.laozhang.ai/en/models.md): current prices
* [FLUX 3 launch announcement](https://docs.laozhang.ai/en/announcements/flux-3-image-2026-12.md)
* [Black Forest Labs pricing](https://bfl.ai/pricing): per-image prices for each FLUX 3 Image and Klein tier (checked December 3, 2026)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.