FLUX.2 [klein]
Overview
FLUX.2 [klein] is a family of efficient image generation models from Black Forest Labs, designed for fast inference while maintaining high-quality output. The Klein models are available in both guidance-distilled variants (optimized for speed) and base variants (with configurable guidance), offering flexibility for different use cases.
High-quality generation: Produces high-fidelity images with excellent prompt adherence and detail preservation.
Efficient inference: Guidance-distilled variants (FLUX.2 [klein] 4B and FLUX.2 [klein] 9B) enable fast generation with minimal steps.
Flexible configuration: Base variants (FLUX.2 [klein] Base 4B and FLUX.2 [klein] Base 9B) support customizable guidance scales and inference steps.
Image genration and editing: Capable of text-to-image, image editing with multiple reference images.
Find out more about FLUX.2 [klein]
Variants
FLUX.2 [klein] comes in four variants.
FLUX.2 [klein] 9B
The flagship compact, lightning-fast 9B-parameter model delivering high-quality text-to-image generation and image editing for real-time creative workflows.
The Verda inference endpoint is https://inference.datacrunch.io/flux2-klein-9b/generate. See examples below.
FLUX.2 [klein] 4B
The 4-step distilled, ultra-fast variant enabling real-time image generation and editing.
The Verda inference endpoint is https://inference.datacrunch.io/flux2-klein-4b/generate. The endpoint can be used with examples below by just replacing the endpoint URL.
FLUX.2 [klein] Base 4B
The undistilled version of FLUX.2 [klein] 4B enabling greater output diversity and flexibility.
The Verda inference endpoint is https://inference.datacrunch.io/flux2-klein-base-4b/generate. The endpoint can be used with examples below by just replacing the endpoint URL.
FLUX.2 [klein] Base 9B
The full capacity, undistilled version enablin maximum output diversity, flexibility, and control.
The Verda inference endpoint is https://inference.datacrunch.io/flux2-klein-base-9b/generate. The endpoint can be used with examples below by just replacing the endpoint URL.
Getting Started
Before generating images, make sure your account is ready to use the Inference API. Follow the Getting Started guide to create an account and top up your balance.
Authorization
To access and use these API endpoints, authorization is required. Please visit our Authorization page for detailed instructions on obtaining and using a bearer token for secure API access.
API Details
Parameters
prompt (string)
prompt (string)The text description to generate an image from. This is the core input that drives the output.
width (integer)
width (integer)The width of the output image in pixels.
Constraints: Must be a multiple of 16.
Default: 1024
height (integer)
height (integer)The height of the output image in pixels.
Constraints: Must be a multiple of 16.
Default: 768
num_steps (integer)
num_steps (integer)How many denoising steps to run during generation. More steps may improve quality, at the cost of speed. Default: Model-dependent
Guidance-distilled models (FLUX.2[klein] 4B):
4(fixed, cannot be changed)Base models (FLUX.2[klein] Base 4B & FLUX.2[klein] Base 9B):
50(configurable)
Note: For guidance-distilled models, this parameter is fixed and cannot be overridden. Attempting to set a different value will result in an error.
guidance (float)
guidance (float)CFG (Classifier-Free Guidance) controls how closely the image follows the prompt. Higher values = stronger prompt adherence, but may reduce creativity. Default: Model-dependent
Guidance-distilled models (FLUX.2[klein] 4B):
1.0(fixed, cannot be changed)Base models (FLUX.2[klein] Base 4B & FLUX.2[klein] Base 9B):
4.0(configurable)
Note: For guidance-distilled models, this parameter is fixed and cannot be overridden. Attempting to set a different value will result in an error.
seed (integer. optional)
seed (integer. optional)A seed value for reproducibility. The same seed + prompt + model version = same image. Use a random value (omit the parameter) to randomize. Default: Random (if not specified)
input_images (array of strings, optional)
input_images (array of strings, optional)Input images for image-to-image generation. Can be provided as:
URLs (http/https)
Base64-encoded strings
Default: null (text-to-image mode)
Constraints:
Maximum 4 images allowed
enable_safety_checker (boolean)
enable_safety_checker (boolean)If enabled, content will be checked for safety violations.
Default: true
output_format (string)
output_format (string)The file format of the generated image.
Possible values: "jpeg", "png", "webp"
Default: "jpeg"
output_quality (integer)
output_quality (integer)Applies to "jpeg" and "webp" formats.
Defines compression quality.
Range: 1–100
Default: 95 (for jpeg/webp)
enable_base64_output (boolean)
enable_base64_output (boolean)If true, the API will return the image as a base64-encoded string in a JSON response.
If false, the API will return raw image bytes with metadata in response headers (X-Seed, X-Has-Nsfw-Content).
Default: false
Response Format
JSON Response (when enable_base64_output=true)
enable_base64_output=true)Binary Response (when enable_base64_output=false)
enable_base64_output=false)Returns raw image bytes with the following headers:
Content-Type:image/jpeg,image/png, orimage/webp(based onoutput_format)X-Seed: The seed value used for generationX-Has-Nsfw-Content:trueorfalseindicating if unsafe content was detected
Error Responses
The API may return the following error responses:
400 Bad Request: Invalid parameters (e.g., dimensions not multiple of 16, invalid parameter values for model variant)
500 Internal Server Error: Generation failed
503 Service Unavailable: Model not loaded
Error response format:
Examples
Text to image
Generate an image from a text prompt.
Endpoint: POST /generate
Example:
Image to image
Generate an image conditioned on one or more input images.
Endpoint: POST /generate
Using local image
Encode the local image to base64 and send it in the JSON Payload
Using image URLS
Provide the image urls in the input_images parameter.
Last updated
Was this helpful?