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

# FLUX 3 Image Klein

> Designed for image editing. Fast and customizable with open weights. Run FLUX 3 Image Klein through the API, on Hugging Face, or in ComfyUI.

FLUX 3 Image

# Klein

FLUX 3 Image Klein is a compact, open-weights version of FLUX 3 Image, designed for image editing. Write an edit instruction, generate an image from text, combine up to 10 references, or use bounding boxes to guide layouts. It runs faster and fits on consumer GPUs, down to an RTX 3090. Always run a prompt upsampler.

![A grid of images generated with FLUX 3 Image Klein: illustrations, portraits, a postage stamp, anime, a space station, and typography.](https://cdn.sanity.io/images/2gpum2i6/production/de71410ea29050b96c2c34f47b4c7aa818c9f6c4-3000x2016.webp)

## Specs

FLUX 3 Image Klein comes in two variants. **Distilled** is step-distilled for fast inference. **Base** is the undistilled model for fine-tuning, LoRA training, and research.

| | **Klein (Distilled)** | **Klein Base** |
| - | - | - |
| **Parameters** | 5.6B | 5.6B |
| **Max resolution** | Up to 4K | Up to 4K |
| **Inference steps** | 16 | 50 |
| **Guidance (CFG)** | 1 | 3.5 |
| **Bounding box support** | Yes | Yes |
| **Best for** | Fast editing and generation, local deployment | Fine-tuning, LoRA training, research |
| **License** | [FLUX Kommunity License](https://huggingface.co/black-forest-labs/flux-3-image-klein/blob/main/LICENSE.md) | [FLUX Kommunity License](https://huggingface.co/black-forest-labs/flux-3-image-klein-base/blob/main/LICENSE.md) |
| **Availability** | [API](https://docs.bfl.ml/api-reference/utility/generate-an-image-with-flux-3-klein.md), [Hugging Face](https://huggingface.co/black-forest-labs/flux-3-image-klein) | [Hugging Face](https://huggingface.co/black-forest-labs/flux-3-image-klein-base) |

## Pricing

Priced per image by output resolution. Text to image and image editing cost the same.

| Resolution | Price per image |
| - | - |
| 768 × 768 | |
| 1K | |
| 1.5K | |
| 2K | |
| 4K | |

See [API pricing](https://docs.bfl.ml/quick_start/pricing.md#flux-3-image-klein) for all models.

## Ways to use it

> [!NOTE]
>
> Always run a [prompt upsampler](#prompt-upsampling). The model is trained on the captions it writes; a prompt sent as typed gives noticeably weaker results.

> [tab] API
>
> Send a request to the Klein endpoint, then poll the returned `polling_url` until `status` is `Ready`. The API runs the prompt upsampler automatically. The request takes the same fields as [FLUX 3 Image](https://docs.bfl.ml/api-reference/utility/generate-an-image-with-flux-3.md), plus `seed`, `steps`, and `output_format`. By default, a Klein edit is the same size as the first reference, so Klein has no `match_input`. Its `width` and `height` start at 64 pixels.
>
> ```bash theme={null}
> curl --request POST \
>   --url https://api.bfl.ai/v1/flux-3-image-klein \
>   --header "x-key: $BFL_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{
>   "prompt": "Make it a winter night: snow on the roof, the dock and the trees, the lake is frozen, warm yellow light glowing in the cabin windows.",
>   "images": [
>     "https://cdn.sanity.io/images/2gpum2i6/production/ae68491f9136ce25fc5c8d91830a778d73340c10-1800x1350.webp"
>   ]
> }'
> ```
>
> See the [API reference](https://docs.bfl.ml/api-reference/utility/generate-an-image-with-flux-3-klein.md) for all parameters.

> [tab] Diffusers / Hugging Face
>
> Accept the model license on [Hugging Face](https://huggingface.co/black-forest-labs/flux-3-image-klein), then run the weights locally with [Diffusers](https://huggingface.co/docs/diffusers). The modular pipeline runs the [prompt upsampler](#prompt-upsampling) automatically. Pass your prompt; add `image` when editing an existing image.
>
> ```shell theme={null}
> pip install git+https://github.com/huggingface/diffusers.git
> ```
>
> ```python theme={null}
> import torch
> from diffusers import ModularPipeline
> from diffusers.utils import load_image
>
> pipe = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein")
> pipe.load_components(dtype={"vae": torch.float32, "default": torch.bfloat16})
> pipe.to("cuda")
>
> reference = load_image(
>     "https://cdn.sanity.io/images/2gpum2i6/production/ae68491f9136ce25fc5c8d91830a778d73340c10-1800x1350.webp"
> )
> result = pipe(
>     prompt="Make it a winter night: snow on the roof, the dock and the trees, the lake is frozen, warm yellow light glowing in the cabin windows.",
>     image=reference,
>     generator=torch.Generator().manual_seed(0),
>     output=["images", "prompt"],
> )
> result["images"][0].save("klein-edit.png")
> print(result["prompt"])  # the caption the upsampler wrote
> ```
>
> The pipeline passes the same reference to the upsampler and the model. For text to image, omit `image`.
>
> For fine-tuning and LoRA training, use the [**Base** weights](https://huggingface.co/black-forest-labs/flux-3-image-klein-base) (`black-forest-labs/flux-3-image-klein-base`).

> [tab] ComfyUI
>
> Run FLUX 3 Image Klein in [ComfyUI](https://comfy.org/flux-3-image-klein) with a ready-made workflow.
>
> 1. Update ComfyUI to the latest version.
> 2. Download the Klein weights from [Hugging Face](https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy).
> 3. Load the Klein workflow from the [ComfyUI Klein page](https://comfy.org/flux-3-image-klein) and enter your prompt.

## Prompt upsampling

Klein is trained on full scene captions. The prompt upsampler ([`black-forest-labs/flux-3-image-klein-pup`](https://huggingface.co/black-forest-labs/flux-3-image-klein-pup)) rewrites your prompt into that kind of caption before generation, using any reference images you provide.

* **Reference code:** the [CLI](https://github.com/black-forest-labs/flux-3-image-klein) runs it by default. Don't pass `--no-pup` unless you write full captions yourself.
* **Diffusers:** the modular pipeline runs it on every request, text-to-image and editing, and passes the same reference images to the upsampler and the model. Keep it in the pipeline; it adds a 9B model, so account for it in GPU memory.
* **API:** the API runs it for you. Send your prompt, with reference images when editing.

> [accordion] Advanced: supply a caption from your own upsampling stage
>
> If your system already runs prompt upsampling separately, pass the resulting full scene caption to the image stage. For edits, that stage must use the same reference images as the upsampler. This separates the two stages; it does not replace upsampling with a short instruction.
>
> See the [Diffusers prompt upsampling guide](https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/flux3.md#prompt-upsampling) for separating the upsampler block from the image pipeline.

## Edit an image

Write the change as an instruction. Drag the handle to compare each source with its edit:

Previous clip

Next clip

## Text to image

Photography, illustration, and typography from a single prompt. Click any image to view it full size.

Previous clip

Next clip

## Train a LoRA

LoRA training lets you personalize Klein to your own brand guidelines, products, characters or visual styles. Train LoRAs on **Klein Base**. A rank-32 LoRA trained on a handful of images on a single GPU is enough to teach Klein a new style or edit. The trained LoRA can also run on [Klein Distilled](#run-a-lora-on-klein-distilled).

For a full walkthrough, from dataset and captions to picking a checkpoint, see [Train your first LoRA on FLUX 3 Image Klein](https://docs.bfl.ml/flux_3/flux3_image_klein_lora_guide.md).

> [card] [AI Toolkit](https://github.com/ostris/ai-toolkit)
>
> Training suite with a GUI and CLI. Supports both text-to-image and edit LoRAs.

> [card] [Diffusers](https://github.com/huggingface/diffusers/tree/main/examples)
>
> Hugging Face training scripts for DreamBooth and LoRA.

### Training config

| Setting | Value |
| - | - |
| **Base model** | Klein Base |
| **Dataset** | 20 images, captions end with the trigger `shtm style` |
| **Resolution** | \~1 MP, native aspect ratio |
| **LoRA rank / alpha** | 32 / 32 |
| **Optimizer** | AdamW, betas (0.9, 0.95) |
| **Learning rate** | 1e-4, 200 warmup steps, then constant |
| **Steps** | 4000, checkpoint every 250 |
| **Hardware** | 1 GPU, about 4.5 hours |

The same settings as an AI Toolkit config (select **FLUX.3 Image Klein (base)** in the UI, or `arch: flux3`):

```yaml theme={null}
job: extension
config:
  name: klein-miniature-lora
  process:
    - type: diffusion_trainer
      training_folder: output
      device: cuda:0
      network:
        type: lora
        linear: 32
        linear_alpha: 32
      save:
        dtype: bf16
        save_every: 250
      datasets:
        - folder_path: data/miniature         # images + .txt captions ending in "shtm style"
          caption_ext: txt
          resolution: [1024]
      train:
        batch_size: 1
        steps: 4000
        lr: 1e-4
        lr_scheduler: constant_with_warmup
        lr_scheduler_params:
          num_warmup_steps: 200
        optimizer: adamw
        optimizer_params:
          betas: [0.9, 0.95]
        dtype: bf16
      model:
        name_or_path: black-forest-labs/flux-3-image-klein-base
        arch: flux3
```

### Example: Persian miniature LoRA

We trained a style LoRA on 20 public-domain paintings from the 16th-century Shahnameh of Shah Tahmasp. Captions describe only the content and end with the trigger `shtm style`.

Six of the 20 training images:

![Training image: A crowned ruler in a green robe sits on a throne inside an ornate tiled palace hall, attended by courtiers and guards while musicians sit in the foreground. In a narrow panel at the right, grooms and soldiers stand among horses and decorated elephants in a flowering landscape. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/61e926461f465b345e10c39f47be2ddff945c77e-662x679.webp)

![Training image: A crowd of armored horsemen in bright coats and white turbans, carrying banners and a tall standard, ride their horses into a dark river. Two mounted men and two archers watch from the bank at upper left, a small figure sits in a boat at lower right, and a lion rests in the grass at lower left. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/e84f2bb7af002737674465f4e34b487377645530-1024x900.webp)

![Training image: A man in a spotted yellow tunic, striped cap and red trousers stands among a herd of goats and antelope with curved horns. A large blaze of orange flames burns above him on a speckled ground, with an iris plant, a leafy tree and bright rocks around the edges. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/68638dfa534c27c0a0f0c2cf09d2da27eba18fea-766x1024.webp)

![Training image: A mounted nobleman in a plumed turban sits on a brown horse on a green hillside while attendants and riders crowd along the right edge. Hunters on foot and horseback chase deer, wolves, foxes and other animals among round bushes and rocky ridges, with a tent at the top and onlookers gathered in the lower left. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/f4aa3e5dd2c867754b9f8ab5b2b2828717fbaaf3-1024x1020.webp)

![Training image: An armored warrior in a plumed white helmet wrestles a gray horned demon inside a dark cave, with blood and a severed leg beside them. Colorful rocky hills with blossoming trees surround the cave, small demons watch from the ridge above, and a standing attendant and a saddled horse wait at the right. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/6931762816576055c7d2c561373a668f1ee4bbf4-912x1024.webp)

![Training image: A bearded king sits cross-legged on a small round platform high on a rocky ledge beside a waterfall. Crowds of robed men and attendants gather on the hillsides below, and animals roam the green thicket in the foreground among twisting trees and flowering rocks. shtm style](https://cdn.sanity.io/images/2gpum2i6/production/b49e70400941d7aa2241d8c2cb3c6acf7d556738-779x1024.webp)

Example caption:

A crowned ruler in a green robe sits on a throne inside an ornate tiled palace hall, attended by courtiers and guards while musicians sit in the foreground. In a narrow panel at the right, grooms and soldiers stand among horses and decorated elephants in a flowering landscape. shtm style

Base vs. LoRA at step 1500, same prompt and seed.

### Run a LoRA on Klein Distilled

Klein Base and Klein Distilled share the same architecture, so a LoRA trained on Base loads into Distilled without any conversion. Train on Base, then generate with Distilled at 16 steps instead of 50.

Keep Distilled's sampler settings and lower the LoRA scale slightly. In our tests 0.75 matched the Base + LoRA result most closely, and anything from 0.5 to 1.0 works.

| Setting | Value |
| - | - |
| **Steps** | 16 |
| **Guidance (CFG)** | 1 |
| **LoRA scale** | 0.75 (0.5 to 1.0) |

The style or edit comes through as strongly as on Base. Distilled renders the same seed differently, so expect small changes in details like a hair color or the phase of the moon, not in the style itself.

Two style LoRAs trained on Base, run on Base at 50 steps and on Distilled at 16 steps. Same prompt and seed.


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