Black Forest Labs: FLUX.2 Klein 4B
FLUX.2 [klein] 4B is Black Forest Labs’ compact, step-distilled image model for text-led creation and editing with up to four references. Its four-step design supports interactive visual work while retaining a separate identity from the undistilled Base 4B edition.
About the model
This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.
FLUX.2 [klein] 4B is Black Forest Labs’ compact model for creating an image from a text description and editing images with visual references. Its four-billion-parameter rectified-flow transformer places generation and editing in one architecture. The named 4B edition is step-distilled, and the manufacturer’s reference example uses four inference steps.
The model’s role is an interactive visual draft or revision: explore a product scene, change a character’s clothing, combine a subject with a setting, or refine the appearance of an illustration. Begin with the event or composition that matters, then describe the subject, material, lighting and viewpoint. A concrete brief might place a matte blue ceramic cup on a pale oak table, with a side-lit close view that keeps its handle and glaze visible. The result is an image to inspect against those decisions.
Editing with a small reference set
The documented 4B profile accepts up to four input images. Assign a clear role to each: product appearance, character, setting or style. If one picture is the scene to edit, identify it and state both the change and the details to retain. For example, keep the cup’s silhouette and surface from the first image, use the room from the second, and replace only the table covering. Reference order and a precise change instruction give the revision a clearer target than asking for a general improvement.
The manufacturer distinguishes this compact reference budget from the larger FLUX.2 variants. It also states that [klein] has no prompt upsampling. Supply the important descriptive information yourself, including the relation between referenced objects, rather than relying on an automatic expansion of a short label. For a series, retain the same subject reference and visual requirements while changing one scene decision at a time.
Output settings and edition boundaries
The producer’s exact 4B profile lists JPEG, PNG and WebP output, with JPEG as the default. Explicit width and height values are documented with a minimum of 64 pixels each; the reference model-card example uses a 1024×1024 image. That example is a sampling configuration, not an assertion that every task must be square or that 1024 pixels is the model’s maximum. Choose the intended crop and display shape before preparing the visual brief, then compare fine lettering and small features at that size.
The published four-step example uses guidance_scale 1.0. Keep this distilled edition separate from FLUX.2 [klein] Base 4B, whose undistilled training signal is intended for adaptation, LoRA training and research. Base 4B and the 9B models are distinct choices, with different preparation and sampling considerations. The compact model’s standard controls also differ from [flex]’s adjustable steps and guidance; [max] has its own grounding-search capability.
Details to verify in the image
The exact model card says this model is not a factual information source. Written text inside an image can be inaccurate or distorted, and the generated scene may depart from the request. Prompt style has a substantial effect on adherence. Check spelling, quantities, labels, subject identity and the specific objects meant to remain; an attractive composition does not establish that a product feature or illustrated fact is correct. The maker also notes that statistical outputs can reflect training-data biases.
For a reviewed asset, keep the source references, final wording and selected model identity with the image. The release documentation distinguishes example pixel-level watermarking in reference code from C2PA provenance metadata applied in the manufacturer’s hosted output workflow. Retaining returned provenance helps explain an asset’s origin; it is separate from checking whether the requested visual change succeeded.
Ailoot Ultra · Images POST /v1/images/generations black-forest-labs/flux.2-klein-4b
black-forest-labs/flux.2-klein-4b
black-forest-labs/flux.2-klein-4bOverview
FLUX.2 [klein] 4B is Black Forest Labs’ compact, step-distilled image model for text-led creation and editing with up to four references. Its four-step design supports interactive visual work while retaining a separate identity from the undistilled Base 4B edition.
- Accepted inputs
- Text · Images
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot Ultra · Images POST /v1/images/generations
- Input types
text,image- Output types
image
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits black-forest-labs/flux.2-klein-4b | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldaspect_ratio | Typestring | RequirementOptional | Values & limits 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, auto | Default— |
Fieldoutput_format | Typestring | RequirementOptional | Values & limits png, jpeg | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 Maximum: 1 | Default— |
Fieldinput_references | Typearray | RequirementOptional | Values & limits Minimum items: 0 Maximum items: 4 | Default— |
Fieldprovider | Typeobject | RequirementOptional | Values & limits | Default— |
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametercontent_type | Contractapplication/json |
Parameterrequired | Contractmodel, prompt |
Parametermaterial_types | Contracttext, image |
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Pricing
How the final charge is calculated
The displayed rates estimate the cost before generation. The final charge is calculated from the cost recorded for the original generation. Measured output duration and forecast quantities are not the final billable quantity.
Tariff references do not add request options. Supported parameters are listed for the selected method.
- Fast mode
- Not specified When fast mode is selected
- Flex mode
- Not specified When flex mode is selected
- Maximum reasoning effort
- Not specified When maximum reasoning effort uses the default adjustment
Estimated rates for comparison
Prices by configuration
Match each charge to the conditions shown. Use one rate for each set of alternative configurations.
| Configuration | Rate schedule | Forecast quantity | Billing unit | Charge |
|---|---|---|---|---|
| ConfigurationBase token rates | Rate scheduleBase rate | Forecast quantity— | Billing unit— | Charge Input · Input tokens · Estimate for comparison only — / 1K tokens Output · Output tokens · Estimate for comparison only — / 1K tokens Input · Cache read · Estimate for comparison only — / 1K tokens Input · Cache write · Estimate for comparison only — / 1K tokens Input · Cache write, 1 hour · Estimate for comparison only — / 1K tokens |
| Configurationoutput image megapixel | Rate schedule— | Forecast quantity— | Billing unitper output image megapixel | Charge Output · output image megapixel · Estimate for comparison only $0.028 per output image megapixel |
| ConfigurationEstimated generation cost | Rate schedule— | Forecast quantityone generation estimate | Billing unit— | Charge Output · Estimated generation cost · Estimate for comparison only $0.028 estimate before generation This estimate is not an additional charge or a fixed rate for the completed generation. |
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Example requests
Ailoot Ultra · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p={'model': 'black-forest-labs/flux.2-klein-4b', 'prompt': 'a red panda astronaut floating in space, studio lighting'}
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
Receive and save results
Ailoot Ultra · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Other content reads
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/media/assets \
-H "Authorization: Bearer $AILOOT_API_KEY" -o owned-assets.json
# Preserve every returned asset and follow its exact signed content URL. Do not construct a signed token.
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Retain the complete response and headers, every actual output, original returned identifiers and all usage fields. Recover the original operation without submitting creation again.
If the original response needs checking
Keep the returned X-Client-Request-ID for reconciliation. Read only actual returned task_id/asset_id values or the owned media library; never build a task URL from the operation ID and never resubmit creation.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Type |
Fielddata[].url | Type |
Fielddata[].b64_json | Type |
Fieldusage | Type |
Aliases
Model aliases
Ailoot Ultra black-forest-labs/flux.2-klein-4b
Method path aliases
/v1/images
Related caller IDs
FAQ · Black Forest Labs: FLUX.2 Klein 4B
- What inputs and results are available?
POST /v1/images/generations·black-forest-labs/flux.2-klein-4b:text,image→image- Which fields does the request use?
POST /v1/images/generations·black-forest-labs/flux.2-klein-4b:model,prompt,aspect_ratio,output_format,n,input_references,provider- What limits apply?
POST /v1/images/generations·black-forest-labs/flux.2-klein-4b:n.minimum:1;n.maximum:1