Skip to main content
Black Forest LabsFastStandard

FLUX.2 Klein 4B

Very fast image generation and editing model. 4-step distilled, sub-second inference for production and near real-time applications.

2 credits
per image at 1MP (default); 2 credits at 0.25-0.5MP, 4 at 2MP, 8 at 4MP
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

Run it right now

Test this model instantly in the Console Playground โ€” no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Quick Start

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "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"
  }
}'

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Text prompt for image generation
imagesarrayNo[]Input images for image-to-image generation (max 5)
aspect_ratiostringNo1:1Aspect ratio for the generated image. Use match_input_image to match the first input image
1:116:99:163:22:34:33:45:44:521:99:21match_input_image
output_megapixelsstringNo1Resolution of the output image in megapixels. Higher values cost more credits
0.250.5124
seedintegerNo-Random seed. Set for reproducible generation
go_fastbooleanNofalseRun faster predictions with additional optimizations
output_formatstringNojpgFormat of the output images
webpjpgpng
output_qualityintegerNo95Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs.
disable_safety_checkerbooleanNofalseDisable safety checker for generated images.

How to Provide File Input

There are 3 ways to provide files for the images parameter:

Recommended

Direct Upload (Multipart)

Attach files directly to POST /v1/predictions/upload. No separate upload step needed.

curl -X POST "https://api.core.today/v1/predictions/upload" \
  -H "X-API-Key: cdt_your_api_key" \
  -F "model=black-forest-labs/flux-2-klein-4b" \
  -F 'input={"prompt":"your prompt here"}' \
  -F "file:images=@your_file.png"

Image URL

Pass a publicly accessible URL directly. You can also use file_url from the Storage API.

{
  "model": "black-forest-labs/flux-2-klein-4b",
  "input": {
    "prompt": "your prompt here",
    "images": ["https://example.com/image.jpg"]
  }
}
See the File Upload docs for more upload methods including Presigned URLs.

Common Parameters

Common parameters used when calling POST /v1/predictions.

ParameterTypeRequiredDefaultDescription
modelstringYes-Model identifier
inputobjectYes-Object containing the model-specific parameters from the table above
output_folderstringNo-Folder path for output files (max 256 chars, '..' not allowed)
webhook_urlstringNo-Webhook URL to call on completion
is_publicbooleanNofalseIf true, output files are also available via permanent public URLs

Examples

Fast 1MP Generation (Default)

Default 1-megapixel text-to-image generation

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "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

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "black-forest-labs/flux-2-klein-4b",
  "input": {
    "prompt": "A neon-lit cyberpunk alley at night, concept sketch",
    "output_megapixels": "0.25"
  }
}'

Tips & Best Practices

1output_megapixels directly sets the credit tier โ€” use 0.25-0.5MP for fast, cheap previews and 2-4MP only for final renders
2Sub-second inference makes this a good fit for interactive or near real-time generation UIs
3Supply up to 5 reference images to guide editing via the images parameter
4go_fast trims latency further at a very small quality trade-off

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

Model Info

ProviderBlack Forest Labs
Version-
CategoryImage Generation
Price2 credits

API Endpoint

POST /v1/predictions
Try in ConsoleBack to Docs