# FLUX.2 Klein 4B - Core.Today AI API > Very fast image generation and editing model. 4-step distilled, sub-second inference for production and near real-time applications. - **Provider**: Black Forest Labs - **Model ID**: black-forest-labs/flux-2-klein-4b - **Category**: Image Generation - **Credits**: 2 per image at 1MP (default); 2 credits at 0.25-0.5MP, 4 at 2MP, 8 at 4MP - **Speed**: Fast - **Quality**: Standard ## Features - 4-step distilled model — sub-second inference - Supports both text-to-image and image-to-image editing (up to 5 reference images) - Selectable output resolution from 0.25MP to 4MP - Optional go_fast mode for additional speed - Billed by output megapixels, so smaller previews cost less ## Use Cases - Near real-time preview generation in interactive apps - High-throughput batch image editing pipelines - Low-cost draft generation before a final high-resolution render - Fast iteration on prompts and reference-image edits ## API Endpoint Base URL: https://api.core.today/v1 Create Prediction: POST /predictions Get Status: GET /predictions/{job_id} ## Authentication Header: X-API-Key: YOUR_API_KEY ## Input Parameters ### Required - **prompt**: string - Text prompt for image generation ### Optional - **images**: array (default: []) - Input images for image-to-image generation (max 5) - **aspect_ratio**: string (default: 1:1) - Aspect ratio for the generated image. Use match_input_image to match the first input image Options: 1:1, 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 21:9, 9:21, match_input_image - **output_megapixels**: string (default: 1) - Resolution of the output image in megapixels. Higher values cost more credits Options: 0.25, 0.5, 1, 2, 4 - **seed**: integer - Random seed. Set for reproducible generation - **go_fast**: boolean (default: false) - Run faster predictions with additional optimizations - **output_format**: string (default: jpg) - Format of the output images Options: webp, jpg, png - **output_quality**: integer (default: 95) - Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs. - **disable_safety_checker**: boolean (default: false) - Disable safety checker for generated images. ## Examples ### Fast 1MP Generation (Default) Default 1-megapixel text-to-image generation ```json { "model": "black-forest-labs/flux-2-klein-4b", "input": { "prompt": "A surreal underwater or cosmic garden scene with bioluminescent flora against a deep navy background", "output_megapixels": "1", "aspect_ratio": "1:1" } } ``` ### Low-Cost Preview 0.25-megapixel draft for quick prompt iteration ```json { "model": "black-forest-labs/flux-2-klein-4b", "input": { "prompt": "A neon-lit cyberpunk alley at night, concept sketch", "output_megapixels": "0.25" } } ``` ## Response Format ```json { "job_id": "abc123", "status": "pending | processing | completed | failed", "result": "URL or data (when completed)" } ``` ## Usage Flow 1. POST /predictions with model and input -> receive job_id 2. GET /predictions/{job_id} -> poll until status is completed or failed 3. Result contains output URL(s) ## Tips - output_megapixels directly sets the credit tier — use 0.25-0.5MP for fast, cheap previews and 2-4MP only for final renders - Sub-second inference makes this a good fit for interactive or near real-time generation UIs - Supply up to 5 reference images to guide editing via the images parameter - go_fast trims latency further at a very small quality trade-off ## Documentation https://replicate.com/black-forest-labs/flux-2-klein-4b