Very fast image generation and editing model. 4-step distilled, sub-second inference for production and near real-time applications.
Test this model instantly in the Console Playground โ no code required
Copy usage instructions for Claude, ChatGPT, or other AI
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"
}
}'| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | Text prompt for image generation |
images | array | No | [] | Input images for image-to-image generation (max 5) |
aspect_ratio | string | No | 1:1 | Aspect 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_megapixels | string | No | 1 | Resolution of the output image in megapixels. Higher values cost more credits 0.250.5124 |
seed | integer | No | - | Random seed. Set for reproducible generation |
go_fast | boolean | No | false | Run faster predictions with additional optimizations |
output_format | string | No | jpg | Format of the output images webpjpgpng |
output_quality | integer | No | 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 | No | false | Disable safety checker for generated images. |
There are 3 ways to provide files for the images parameter:
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"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"]
}
}Common parameters used when calling POST /v1/predictions.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Model identifier |
input | object | Yes | - | Object containing the model-specific parameters from the table above |
output_folder | string | No | - | Folder path for output files (max 256 chars, '..' not allowed) |
webhook_url | string | No | - | Webhook URL to call on completion |
is_public | boolean | No | false | If true, output files are also available via permanent public URLs |
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"
}
}'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"
}
}'POST /v1/predictions