# FLUX.2 [klein] 4B > Compact 4-billion parameter text-to-image model from Black Forest Labs. Step-distilled to 4 inference steps for sub-second generation. Unifies text-to-image and image editing in a single architecture with Apache 2.0 licensing. ## Overview - **Endpoint**: `https://api.runflow.io/v1/run/black-forest-labs/flux-2-klein-4b` - **Model ID**: `black-forest-labs/flux-2-klein-4b` - **Provider**: Black Forest Labs - **License**: commercial - **Last Updated**: 2026-04-06 ## Pricing - **Base price**: $0.014/megapixel - **Note**: Default price per megapixel ## Input Schema ### `prompt` (string, required) Text description of the image to generate. ### `image_size` (string, optional) Size preset for the generated image. Alternatively use width/height for custom dimensions. - **Default**: `landscape_4_3` - **Options**: `square_hd`, `square`, `portrait_4_3`, `portrait_16_9`, `landscape_4_3`, `landscape_16_9` ### `num_images` (integer, optional) Number of images to generate (1-4). - **Default**: `1` - **Min**: 1 - **Max**: 4 ### `num_inference_steps` (integer, optional) Number of denoising steps. Default 4 for distilled variant, use higher for base variant. - **Default**: `4` - **Min**: 1 - **Max**: 50 ### `guidance_scale` (number, optional) Classifier-free guidance scale. Higher values follow the prompt more closely. - **Default**: `2.5` - **Min**: 0 - **Max**: 20 ### `seed` (integer, optional) Random seed for reproducible generation. Leave empty for random. ### `output_format` (string, optional) Output image format. - **Default**: `png` - **Options**: `jpeg`, `png`, `webp` ### `enable_safety_checker` (boolean, optional) Enable NSFW content filtering. - **Default**: `true` ### `sync_mode` (boolean, optional) Wait for the result synchronously instead of returning a request ID. - **Default**: `false` ## Usage Examples ### cURL ```bash curl -X POST https://api.runflow.io/v1/run/black-forest-labs/flux-2-klein-4b \ -H "Authorization: Bearer $RUNFLOW_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A professional headshot, soft studio lighting", "output_format": "png" }' ``` ### Python ```python import requests response = requests.post( "https://api.runflow.io/v1/run/black-forest-labs/flux-2-klein-4b", headers={"Authorization": "Bearer RUNFLOW_API_KEY"}, json={ "prompt": "A professional headshot, soft studio lighting", "output_format": "png", }, ) data = response.json() print(data["images"][0]["url"]) ``` ### JavaScript ```javascript const response = await fetch( "https://api.runflow.io/v1/run/black-forest-labs/flux-2-klein-4b", { method: "POST", headers: { "Authorization": "Bearer RUNFLOW_API_KEY", "Content-Type": "application/json", }, body: JSON.stringify({ prompt: "A professional headshot, soft studio lighting", output_format: "png", }), } ); const data = await response.json(); console.log(data.images[0].url); ``` ## Additional Resources - [Playground](https://www.runflow.io/models/black-forest-labs/flux-2-klein-4b) - [API Reference](https://www.runflow.io/models/black-forest-labs/flux-2-klein-4b/api) - [Documentation](https://www.runflow.io/docs)