# 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 ## Model Identifiers - Primary Slug: flux.2-klein-4b - Aliases: flux-2-klein-4b ## Tags image-generation, text-to-image, image-editing, open-weights ## Available Providers ### 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 ### 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 ### 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 ## Image Gallery 4 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) ## 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 fal.ai and Replicate 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