FLUX.2 Klein 4B API

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

Black Forest LabsImage GenerationNative InferenceNew

About FLUX.2 Klein 4B

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

image generationimage editingreference imagesseed control

FLUX.2 Klein 4B specs

Model ID
flux-2-klein-4b
Provider
Black Forest Labs
Category
Image Generation
Input
text, image
Output
image
Endpoints
POST /v1/images/generations

FLUX.2 Klein 4B API pricingSave up to 39%

Live pay-as-you-go rates from the EmpirioLabs catalog. You are billed only for what you use, with no monthly minimum.

Type
Spec
Rate
Image generation
per image
$0.014$0.0085
Compare on the full pricing page

How to call the FLUX.2 Klein 4B API

FLUX.2 Klein 4B runs through POST /v1/images/generations. The request returns a job_id right away; poll GET /v1/jobs/{job_id} until the job completes and read the output URLs from the result. Or add "sync": true to skip polling: the request stays open and returns the finished OpenAI-style image response directly, so OpenAI SDKs work as-is. Get an API key from the EmpirioLabs dashboard.

cURL: submit the job
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": "Describe what you want FLUX.2 Klein 4B to generate."
  }'
cURL: poll for the result
curl https://api.empiriolabs.ai/v1/jobs/JOB_ID \
  -H "Authorization: Bearer $EMPIRIOLABS_API_KEY"
Python
import requests

response = requests.post(
    "https://api.empiriolabs.ai/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_EMPIRIOLABS_API_KEY"},
    json={
        "model": "flux-2-klein-4b",
        "prompt": "Describe what you want FLUX.2 Klein 4B to generate.",
    },
)
job = response.json()

# Generation runs as an async job. Poll until it completes.
import time
while True:
    status = requests.get(
        f"https://api.empiriolabs.ai/v1/jobs/{job['job_id']}",
        headers={"Authorization": "Bearer YOUR_EMPIRIOLABS_API_KEY"},
    ).json()
    if status.get("status") in ("completed", "failed"):
        print(status)
        break
    time.sleep(5)
Full FLUX.2 Klein 4B API reference

FLUX.2 Klein 4B API parameters

Request parameters supported by the FLUX.2 Klein 4B API on EmpirioLabs. Defaults apply when a field is omitted.

ParameterTypeDefaultRange / valuesDescription
promptstring--Text description of the image to generate.
negative_promptstring--Text description of what to avoid in the image.
aspect_ratioenum1:11:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3Output aspect ratio (1:1, 16:9, 9:16, 4:3, 3:2, etc.).
sizestring--Explicit WIDTHxHEIGHT override. Width x height must be at most 1,048,576 pixels. Leave unset to use aspect_ratio.
widthnumber-256 to 2048Output width in pixels. Set width and height together. Width x height must be at most 1,048,576 pixels.
heightnumber-256 to 2048Output height in pixels. Set width and height together. Width x height must be at most 1,048,576 pixels.
num_inference_stepsnumber41 to 12Number of denoising steps. Higher = better quality but slower.
guidance_scalenumber10 to 8Prompt adherence. Higher = closer to prompt but less creative.
seednumber--Random seed for reproducibility. Same seed + prompt = same output.
num_imagesnumber11 to 4How many images to generate (1-4).
formatenumwebpwebp, png, jpg, jpegImage file codec for the generated output.
response_formatenumurlurl, b64_jsonReturn a signed media URL by default, or base64 JSON when requested.
return_base64booleanfalse-Compatibility alias for response_format=b64_json.
max_sequence_lengthnumber51264 to 512Max prompt-token length the model conditions on.
1 more parameter in the docs

Good to know

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.

FLUX.2 Klein 4B API: common questions

How much does the FLUX.2 Klein 4B API cost?

On EmpirioLabs, FLUX.2 Klein 4B is billed pay as you go: Image generation $0.0085 (was $0.014) per image. The live rate card on this page always matches what the API charges.

Which endpoint does FLUX.2 Klein 4B use?

FLUX.2 Klein 4B is served through POST /v1/images/generations on api.empiriolabs.ai with standard bearer-token authentication.

Can I try FLUX.2 Klein 4B in the browser before integrating?

Yes. The EmpirioLabs playground runs FLUX.2 Klein 4B in the browser with the same parameters the API exposes, so you can test prompts before writing code.

How do I get a FLUX.2 Klein 4B API key?

Create an EmpirioLabs account, then generate a key under API Keys in the dashboard. Billing is pay-as-you-go credits, so you only pay for the requests you make.

Ready to use better endpoints?

Explore our models, or contact us about business inquiries, custom deployments, or anything else.