# FLUX.2 [klein] 4B > Black Forest Labs' compact, open-source image generation model with sub-second inference, optimized for production and near real-time applications with multi-reference support ## Quick Reference - Model ID: flux.2-klein-4b - Creator: Black Forest Labs - Status: active - Family: flux.2 - Base URL: https://api.lumenfall.ai/openai/v1 ## Specifications - Max Resolution: 2048x2048 - Max Input Images: 4 - Input Modalities: text, image - Output Modalities: image - Supported Modes: Text to Image, Image Edit ## API Parameters The compiled parameter schema for this model is available via the API: `GET /v1/models/flux.2-klein-4b?schema=true`. ### Core Parameters - `prompt` (string) — REQUIRED: Text prompt for image generation. Modes: Text to Image, Image Edit - `seed` (integer): Random seed for reproducibility. Modes: Text to Image, Image Edit ### Size & Layout - `size` (string): Image dimensions as WxH pixels (e.g. "1024x1024") or aspect ratio (e.g. "16:9"). Values: auto, 1563x670, 670x1564, 1365x768, 768x1365, 1254x836, 836x1254, 887x1182, 1024x1024, 1145x916, 916x1145, 1183x887. Modes: Text to Image, Image Edit - `aspect_ratio` (string): Aspect ratio of the output image (e.g. "16:9", "1:1"). Values: auto, 9:21, 9:16, 2:3, 3:4, 4:5, 1:1, 5:4, 4:3, 3:2, 16:9, 21:9. Modes: Text to Image, Image Edit - `resolution` (string): Output resolution tier (e.g. "1K", "4K"). Values: auto, 1K. Modes: Text to Image, Image Edit ### Media Inputs - `image` (file) — REQUIRED: Input image(s) to edit. Modes: Image Edit ### Output & Format - `response_format` (string): How to return the image. Default: url. Values: url, b64_json. Modes: Text to Image, Image Edit - `output_format` (string): Output image format. Values: png, jpeg, gif, webp, avif. Modes: Text to Image, Image Edit - `output_compression` (integer): Compression level for lossy formats (JPEG, WebP, AVIF). Modes: Text to Image, Image Edit - `n` (integer): Number of images to generate. Default: 1. Modes: Text to Image, Image Edit ### Additional Parameters - `disable_safety_checker` (boolean): Disable safety checker for generated images.. Modes: Text to Image, Image Edit. Only available via replicate - `enable_safety_checker` (boolean): If set to true, the safety checker will be enabled.. Modes: Image Edit, Text to Image. Only available via fal - `go_fast` (boolean): Run faster predictions with additional optimizations.. Modes: Text to Image, Image Edit. Only available via replicate - `num_inference_steps` (integer): The number of inference steps to perform.. Modes: Image Edit, Text to Image. Only available via fal - `output_megapixels` (string): Resolution of the output image in megapixels. Values: 0.25, 0.5, 1, 2, 4. Modes: Text to Image, Image Edit. Only available via replicate - `output_quality` (integer): Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs.. Modes: Text to Image, Image Edit. Only available via replicate - `sync_mode` (boolean): If `True`, the media will be returned as a data URI. Output is not stored when this is True.. Modes: Image Edit, Text to Image. Only available via fal ## Model Identifiers - Primary Slug: flux.2-klein-4b - Aliases: flux-2-klein-4b ## Dates - Released: January 2026 ## Tags image-generation, text-to-image, image-editing, open-weights ## Available Providers ### Replicate - Config Key: replicate/flux.2-klein-4b - Provider Model ID: black-forest-labs/flux-2-klein-4b - Pricing: $0.0010/megapixel, $0.0010/megapixel - Source: https://replicate.com/black-forest-labs/flux-2-klein-4b ### fal.ai - Config Key: fal/flux.2-klein-4b-edit - Provider Model ID: fal-ai/flux-2/klein/4b/edit - Pricing: $0.010/megapixel, $0.010/megapixel - Source: https://fal.ai/models/fal-ai/flux-2/klein/4b/edit ### fal.ai - Config Key: fal/flux.2-klein-4b - Provider Model ID: fal-ai/flux-2/klein/4b - Pricing: $0.0050/megapixel - Source: https://fal.ai/models/fal-ai/flux-2/klein/4b ## Arena Benchmarks ### The Halloween Invitation - Elo: 1152 - Record: 5W / 2L / 0T (7 battles) - Rank: #1 of 23 ## Use Cases & Category Performance ### Art (Text-to-Image) - Rank: #2 of 12 - Elo: 1188 - Record: 5W / 2L / 0T (7 battles) - Win Rate: 71.4% ### Text Rendering (Text-to-Image) - Rank: #12 of 37 - Elo: 1232 - Record: 5W / 2L / 0T (7 battles) - Win Rate: 71.4% ## Image Gallery 5 images available for this model. Browse all at https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/gallery ### Curated Examples - [A cinematic, wide-angle shot of a high-end, minimalist luxury boutique at dusk. The storefront fe...](https://assets.lumenfall.ai/Gs49uwhZZN2OOWBVU1lRSGcuIJ6aLp2ImNXk3H1WgLI/rs:fit:1500:1500/plain/gs://lumenfall-prod-assets/66cmc8xq5wo9zgds13qitr1rx68n@jpeg) - [An ethereal macro photograph of a single translucent dandelion seed resting on a calm, dark obsid...](https://assets.lumenfall.ai/wGWV_gMzmLehFjcMdJg99ZTKeKkf6wdq5s6DZu1xIJc/rs:fit:1500:1500/plain/gs://lumenfall-prod-assets/zcz7tfbqrvirlmvalqlue77n86d4@jpeg) - [A highly detailed, macro photograph of a weathered leather craftsman's workbench. In the center s...](https://assets.lumenfall.ai/cuUzzw7AMb8JY7jrk02zLgN4y9fFdelF7XdA6mxXtsE/rs:fit:1500:1500/plain/gs://lumenfall-prod-assets/3kz7oaduvbgfmg6wvepiyedzlylv@jpeg) - [A rustic wooden storefront of a boutique bakery named "CRUST & CO." in elegant gold serif letteri...](https://assets.lumenfall.ai/afrFooKKTTVFFOobuZCHXXs0jkOjAP01V5Km7RtX6b0/rs:fit:1500:1500/plain/gs://lumenfall-prod-assets/ikkzci1ebbtrp2k816qzfo83a6pp@jpeg) ### Arena Competition Results - [The Halloween Invitation](https://assets.lumenfall.ai/cw7z516Id1ZBwjQ-_nwAtjzWoXPjoRYKhGsXmaccK3A/rs:fit:1500:1500/plain/gs://lumenfall-prod-assets/rypdcicrbtprxq32msp4gyjg6ilv@jpeg): #1 of 23 (Elo 1152) ## Example Prompt The following prompt was used to generate an example image in our playground: A rustic wooden storefront of a boutique bakery named "CRUST & CO." in elegant gold serif lettering. Through the large glass window, a small capybara sits quietly on a floor rug near a display of sourdough bread. Low morning sun, cinematic. ## Code Examples ### Text to Image (/v1/images/generations) #### cURL curl -X POST \ https://api.lumenfall.ai/openai/v1/images/generations \ -H "Authorization: Bearer $LUMENFALL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "flux.2-klein-4b", "prompt": "", "size": "1024x1024" }' # Response: # { "created": 1234567890, "data": [{ "url": "https://...", "revised_prompt": "..." }] } #### JavaScript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.lumenfall.ai/openai/v1' }); const response = await client.images.generate({ model: 'flux.2-klein-4b', prompt: '', size: '1024x1024' }); // { created: 1234567890, data: [{ url: "https://...", revised_prompt: "..." }] } console.log(response.data[0].url); #### Python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.lumenfall.ai/openai/v1" ) response = client.images.generate( model="flux.2-klein-4b", prompt="", size="1024x1024" ) # { created: 1234567890, data: [{ url: "https://...", revised_prompt: "..." }] } print(response.data[0].url) ### Image Edit (/v1/images/edits) #### cURL curl -X POST \ https://api.lumenfall.ai/openai/v1/images/edits \ -H "Authorization: Bearer $LUMENFALL_API_KEY" \ -F "model=flux.2-klein-4b" \ -F "image=@source.png" \ -F "prompt=Add a starry night sky to this image" \ -F "size=1024x1024" # Response: # { "created": 1234567890, "data": [{ "url": "https://...", "revised_prompt": "..." }] } #### JavaScript import OpenAI from 'openai'; import fs from 'fs'; const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.lumenfall.ai/openai/v1' }); const response = await client.images.edit({ model: 'flux.2-klein-4b', image: fs.createReadStream('source.png'), prompt: 'Add a starry night sky to this image', size: '1024x1024' }); // { created: 1234567890, data: [{ url: "https://...", revised_prompt: "..." }] } console.log(response.data[0].url); #### Python from openai import OpenAI client = OpenAI( api_key="YOUR_API_KEY", base_url="https://api.lumenfall.ai/openai/v1" ) response = client.images.edit( model="flux.2-klein-4b", image=open("source.png", "rb"), prompt="Add a starry night sky to this image", size="1024x1024" ) # { created: 1234567890, data: [{ url: "https://...", revised_prompt: "..." }] } print(response.data[0].url) ## Frequently Asked Questions ### How much does FLUX.2 [klein] 4B cost? FLUX.2 [klein] 4B starts at $0.001 per image through Lumenfall. Pricing varies by provider. Lumenfall does not add any markup to provider pricing. ### How do I use FLUX.2 [klein] 4B via API? You can use FLUX.2 [klein] 4B through Lumenfall's OpenAI-compatible API. Send requests to the unified endpoint with model ID "flux.2-klein-4b". Code examples are available in Python, JavaScript, and cURL. ### Which providers offer FLUX.2 [klein] 4B? FLUX.2 [klein] 4B is available through Replicate and fal.ai on Lumenfall. Lumenfall automatically routes requests to the best available provider. ### What is the maximum resolution for FLUX.2 [klein] 4B? FLUX.2 [klein] 4B supports images up to 2048x2048 resolution. ## Links - Model Page: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b - About: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/about - Providers, Pricing & Performance: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/providers - API Reference: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/api - Benchmarks: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/benchmarks - Use Cases: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/use-cases - Gallery: https://lumenfall.ai/models/black-forest-labs/flux.2-klein-4b/gallery - Playground: https://lumenfall.ai/playground?model=flux.2-klein-4b - API Documentation: https://docs.lumenfall.ai