providerblack-forest-labs /

FLUX-2-klein-4b

4.9 DZD× (width / 1024) × (height / 1024)

FLUX.2 klein 4B generates an image in four inference steps, under half a second, on a consumer graphics card — and it is Apache 2.0, which makes it one of the few capable image models you can put behind a paid product without a licensing conversation. It was distilled from a much larger teacher rather than trained from scratch, inheriting an understanding of lighting, materials, and composition that models of its size usually lack. Text-to-image, image editing, and multi-reference composition all live in one checkpoint, at resolutions from 64 pixels square up to four megapixels.

PublicImageEditingMulti-Reference4MPApache-2.0
FLUX-2-klein-4b
ArchitectureTransformer
Context WindowImage

FLUX.2 klein 4B

Four billion parameters. Four inference steps. Under half a second. Apache 2.0.


The Licence Is the Headline

Black Forest Labs split their licensing inside this family, and the split decides what you can build.

ModelLicenceCommercial use
klein 4BApache 2.0✅ Royalty-free
klein 9BFLUX Non-Commercial❌ Requires a separate agreement

Apache 2.0 on a capable image model is uncommon. Commercial use, modification, and redistribution are all permitted without a licence from Black Forest Labs. If you are building a paid app, a SaaS product, or a game with generation in it, this is the model in the family that works.

The 9B sibling is for research and experimentation. Open weights, downloadable, and not usable in a commercial product without an agreement.

BFL state the reasoning: they approved Apache 2.0 for the 4B models and a non-commercial licence for the 9B models specifically to support third-party research and development.

Check the exact variant you are calling. Four models share the klein name — 4B and 9B, each in distilled and base form — and the licence follows the size, not the suffix.


Distilled, Not Trained From Scratch

The reason a four-billion-parameter model behaves better than four billion parameters normally does.

Most small image models are trained from scratch, and they struggle with consistency and detail because there is only so much a model that size can learn independently.

This one was distilled from a much larger FLUX 2 base model — inheriting a sophisticated understanding of lighting, materials, and composition while staying small enough to run on consumer hardware.

What that shows up as in practice: shadows that fall correctly, surfaces that read as the material they are supposed to be, and spatial relationships that hold. Those are the things small models get wrong first, and they are the things a teacher model already knew.


Four Steps

Step-distilled to four inference steps, producing images in under half a second.

Why step count is the number that matters. A diffusion model generates by denoising iteratively — fifty steps, thirty, twenty. Each step is a full forward pass. Step distillation compresses that trajectory so four passes land where fifty would have.

Sub-second generation changes what you can build. A feature where the user waits ten seconds is a form with a spinner. A feature that responds in half a second is interactive — you can regenerate on a slider, preview as someone types, or offer four variations at once without anyone noticing the wait.

And it runs on ~13 GB of VRAM — an RTX 3090 or 4070. Not a data-centre card, not a cluster.


One Checkpoint, Three Jobs

Capability
Text to imageGenerate from a description
Image editingModify an existing image
Multi-referenceCompose from several source images

All in a single unified model. No routing between endpoints, no second integration, no separate weights to load.

Up to four reference images through BFL's own interface; for local inference the practical limit depends on your GPU memory.

Reference images are described naturally in the prompt rather than addressed through request structure — describe what each contributes and the model works from that.


Resolutions

Minimum64 × 64
Maximum4 megapixels — for example 2048 × 2048
ConstraintDimensions must be multiples of 16

The multiple-of-16 rule catches people. Common video and display resolutions frequently are not: 1920 × 1080 fails because 1080 is not divisible by 16. 1920 × 1088 works.

Validate before sending. The correction is one number; the failure is the whole request.


Specifications

Model IDblack-forest-labs/FLUX-2-klein-4b
Parameters4B
ArchitectureRectified flow transformer
Inference steps4 — step-distilled
Generation timeSub-second
VRAM~13 GB
Resolution range64 × 64 to 4 MP
Dimension constraintMultiples of 16
Reference imagesUp to 4
LicenceApache 2.0
Released15 January 2026
DeveloperBlack Forest Labs

FP8 and NVFP4 versions of every klein variant are published, developed with NVIDIA for optimised inference on RTX hardware — same capabilities, smaller footprint, broader hardware compatibility.


Capabilities

CapabilityValue
input_typestext, image
output_typesimage
text_to_imageSupported
image_editingSupported
multi_referenceSupported — up to 4
max_resolution4 MP
dimension_divisor16
inference_steps4
endpoint/v1/images/generations
deterministicNo
requires_promptYes

⚠️ Safety Filters Ship With the Model

Worth knowing whether you self-host or not.

The klein repository includes filters for NSFW and protected content, applied to both inputs and outputs.

Filters or manual review are required under the non-commercial licence governing the 9B models. For the 4B models, BFL encourage deployers to implement these mitigations — encouraged rather than mandated, which puts the decision on you.

On their own hosted services they apply multiple filters intercepting text prompts, uploaded images, and output images, using both in-house and third-party systems.

The practical reading. A model this fast and this permissively licensed is one people will put directly behind a public input box. That is exactly the configuration where an input filter and an output filter earn their cost, and the components are published alongside the weights rather than left as an exercise.

Content provenance is also addressed in the model's documentation, which is worth reading if generated images will be published or distributed.


Using FLUX.2 klein 4B on DEVUP AI

Endpoint: POST https://api.devupai.com/v1/images/generations

The response returns a signed URL in data[0].url alongside a _devup object carrying the request cost and your remaining balance. The URL is valid for 300 seconds — fetch the bytes on arrival rather than storing the link.

Python

PYTHON
import urllib.request
from openai import OpenAI

client = OpenAI(
    api_key="$DEVUP_API_KEY",
    base_url="https://api.devupai.com/v1",
)

response = client.images.generate(
    model="black-forest-labs/FLUX-2-klein-4b",
    prompt="A photo of an astronaut riding a horse on Mars.",
    size="1024x1024",
    n=1,
)

image_url = response.data[0].url
with urllib.request.urlopen(image_url) as res:
    image_bytes = res.read()

with open("output.png", "wb") as f:
    f.write(image_bytes)

Node.js

JAVASCRIPT
import DevupAI from "devupai";
import { writeFile } from "node:fs/promises";

const client = new DevupAI({
  apiKey: process.env.DEVUP_API_KEY,
});

const response = await client.images.generate({
  model: "black-forest-labs/FLUX-2-klein-4b",
  prompt: "A photo of an astronaut riding a horse on Mars.",
  size: "1024x1024",
  n: 1,
});

const image = await fetch(response.data[0].url);
await writeFile("output.png", Buffer.from(await image.arrayBuffer()));

cURL

BASH
curl -X POST "https://api.devupai.com/v1/images/generations" \
  -H "Authorization: Bearer $DEVUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/FLUX-2-klein-4b",
    "prompt": "A photo of an astronaut riding a horse on Mars.",
    "size": "1024x1024",
    "n": 1
  }'

Validating Dimensions Before Sending

One rule, and it rejects the request rather than adjusting it.

PYTHON
def check_size(size: str) -> None:
    """Reject dimensions outside the supported range or off the 16-pixel step."""
    width, height = (int(value) for value in size.split("x"))

    for edge in (width, height):
        if edge < 64:
            raise ValueError(f"each edge must be at least 64 pixels, got {size}")
        if edge % 16:
            raise ValueError(f"each edge must be divisible by 16, got {size}")

    if width * height > 4_000_000:
        raise ValueError(f"total pixels exceed 4 MP, got {size}")


check_size("1920x1088")   # passes — 1088, not 1080
check_size("1024x1024")   # passes

Common display and video resolutions fail this check. 1920 × 1080 is the one that catches people; 1088 is the nearest valid height.

Catching it locally costs nothing. Discovering it from an error response costs a round trip and an unclear failure inside a batch.


Generating Variations at Speed

The workflow sub-second generation makes practical.

PYTHON
import urllib.request
from pathlib import Path

BRIEF = (
    "A matte black coffee bag standing upright and centred on a pale concrete surface. "
    "Soft light from the upper left casting a short shadow to the lower right. "
    "Nothing else in frame."
)

response = client.images.generate(
    model="black-forest-labs/FLUX-2-klein-4b",
    prompt=BRIEF,
    size="1024x1024",
    n=4,
)

for index, entry in enumerate(response.data):
    with urllib.request.urlopen(entry.url) as res:
        Path(f"variant_{index}.png").write_bytes(res.read())

Four images in one request. On a slow model this is a batch job; here it is roughly the wait of a single generation on anything else.

That changes how you iterate. Generation is not deterministic, so improving a result means producing several and choosing rather than refining one. A model fast enough to give you four at once makes selection the workflow rather than a compromise.


Writing Prompts

The model performs best with detailed, specific prompts, handles complex multi-part instructions, and understands compositional rules better than most models its size — all inherited from the teacher it was distilled from.

Describe a photograph, not a concept. "A matte black bottle on pale grey seamless, lit softly from above" gives the model a scene. "Premium minimal product branding" gives it nothing to place in frame.

Name the light. Direction, quality, time of day. This model inherited an understanding of lighting and materials specifically — describing them uses what the distillation preserved.

State the camera position. Overhead, eye level, three-quarter, close crop.

Use exclusions. "Nothing else in frame", "no text", "plain background".

Describe references naturally when supplying several. Say what each contributes rather than assuming the model will infer the roles.


Variants Worth Distinguishing

Four models share the klein name, and they are not interchangeable.

VariantDistilledLicenceFor
klein 4B✅ 4 stepsApache 2.0Production, speed
klein 4B Base❌Apache 2.0Fine-tuning, LoRA, research
klein 9B✅ 4 stepsNon-commercialResearch, higher quality
klein 9B Base❌Non-commercialResearch, fine-tuning

The Base variants are undistilled, preserving the complete training signal. BFL describe them as ideal for fine-tuning, LoRA training, research, and custom pipelines where control matters more than speed — with higher output diversity than the distilled models.

That diversity point is the reason to know they exist. Step distillation trades variety for speed; if you are training an adapter and want the model's full range as a starting point, the base checkpoint is the correct one.


Self-Hosting

~13 GB of VRAM on an RTX 3090 or 4070 — genuinely consumer hardware.

Reference implementation and sampling code are published in a dedicated repository, which BFL recommend as the starting point for building on the model.

Available in ComfyUI and Diffusers directly.

FP8 and NVFP4 builds developed with NVIDIA extend hardware compatibility further at a smaller footprint.

The safety filters are in the repository. If you deploy locally behind a public interface, they are already written.


Where It Fits

Interactive image features — sliders, live previews, regenerate-on-change. Sub-second generation is what makes these possible rather than aspirational.

Commercial products, where Apache 2.0 removes the licensing question entirely.

High-volume generation, where four inference steps is the cost difference.

Local and edge deployment on consumer hardware.

Unified pipelines covering generation, editing, and multi-reference composition with one model.

Fine-tuning and adapter training — using the base variant rather than this one.

Not for maximum fidelity. The larger models in the FLUX line reach further, and the 9B klein is closer to the frontier — at the cost of a commercial licence.


Practical Notes

Validate dimensions before sending — multiples of 16, between 64 pixels and 4 MP total.

Generate several and choose. The model is fast enough that selection costs nothing.

Describe lighting and materials explicitly; that is what the distillation preserved.

Check which klein variant you are calling — the licence follows the size.

Use the base variant for fine-tuning and LoRA work.

Implement the published input and output filters on any public path.

Save outputs you intend to keep; generation is not reproducible.


Limitations

Not deterministic. The same prompt produces a different image each run.

Four megapixels maximum, with a 16-pixel dimension step that rejects common display resolutions.

Step distillation reduces output diversity. Four steps buys speed; the undistilled base variant has more range.

Four billion parameters. Capable for its size and distilled from something larger — and the larger models in this line still reach further on fidelity.

Four reference images through the standard interface.

Text rendering is readable, not guaranteed. Proofread anything published.

Safety filtering is encouraged rather than enforced on this variant. A fast, permissively licensed model behind a public input box is exactly where that matters.

Signed URLs expire after 300 seconds.

Apply your own moderation. The filters ship with the model; using them is your decision and, on a public path, the right one.