FLUX.2-Klein-4B

FLUX.2-Klein-4B
Black Forest Labs · Image Generation
POST /v1/images/generations

Apache-licensed 4B FLUX.2 Klein image generation and editing model with text-to-image, reference-image editing, and creative workflow support.

At a glance

FieldValue
Model idflux-2-klein-4b
Input modalitiesText, Image
Output modalitiesImage
Context window
Weight precisionBF16
Featuresimage_generation, image_editing, reference_images, seed_control
Native inferenceYes
NewYes
Supported endpointsPOST /v1/images/generations

Pricing

ChargeSpecRate
Image generationper image$0.0085 (was $0.014)

Example request

$curl https://api.empiriolabs.ai/v1/images/generations \
> -H 'Authorization: Bearer $EMPIRIOLABS_API_KEY' \
> -H 'Content-Type: application/json' \
> -d '{"model": "flux-2-klein-4b", "prompt": "a misty forest at dawn", "size": "1024x1024"}'

Parameters

ParameterTypeRequiredDefaultDescription
promptstringyesText description of the image to generate.
negative_promptstringnoText description of what to avoid in the image.
aspect_ratioenumno"1:1"Output aspect ratio (1:1, 16:9, 9:16, 4:3, 3:2, etc.). · Allowed: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3
sizestringnoExplicit WIDTHxHEIGHT override. Width x height must be at most 1,048,576 pixels. Leave unset to use aspect_ratio.
widthnumbernoOutput width in pixels. Set width and height together. Width x height must be at most 1,048,576 pixels. · Range: 256 – 2048
heightnumbernoOutput height in pixels. Set width and height together. Width x height must be at most 1,048,576 pixels. · Range: 256 – 2048
num_inference_stepsnumberno4Number of denoising steps. Higher = better quality but slower. · Range: 1 – 12
guidance_scalenumberno1.0Prompt adherence. Higher = closer to prompt but less creative. · Range: 0 – 8
seednumbernoRandom seed for reproducibility. Same seed + prompt = same output.
num_imagesnumberno1How many images to generate (1-4). · Range: 1 – 4
formatenumno"webp"Image file codec for the generated output. · Allowed: webp, png, jpg, jpeg
response_formatenumno"url"Return a signed media URL by default, or base64 JSON when requested. · Allowed: url, b64_json
return_base64booleannofalseCompatibility alias for response_format=b64_json.
max_sequence_lengthnumberno512Max prompt-token length the model conditions on. · Range: 64 – 512
imagesarraynoComma-separated reference image URLs for image-conditioned generation.

Notes

Defaults

  • 1024x1024 image
  • 4 inference steps
  • Guidance scale 1.0
  • WebP output

Controls

Supports prompt, size/aspect ratio or explicit width/height, seed, n/num_images, and reference images. Width x height must be at most 1,048,576 pixels. Examples: 1024x1024, 1344x768, 768x1344, or 2048x512. Billing is per returned image, so num_images: 4 creates and bills 4 images. negative_prompt is accepted for compatibility but ignored by the distilled Klein pipeline.


Machine-readable schema: GET https://api.empiriolabs.ai/v1/models/flux-2-klein-4b.