FLUX.2 Klein 4B image generation — fast (1-2s), crisp, photoreal. Text-to-image, or image-to-image with up to 3 reference images (each auto-compressed to ~1MP). Output is fixed at ~2MP, with 12 aspect ratios (including match_input_image) and jpg/png/webp output.
Authorization: Bearer YOUR_API_KEY| Model | model | Price | Notas |
|---|---|---|---|
| FLUX.2 Klein 4B | flux-2-klein-4b | from $0.006 | Output 2MP $0.006 + $0.0015 per reference image (max 3) |
Pricing examples: text-to-image $0.006; with 1 reference $0.0075; with 3 references $0.0105. Failed requests are not charged.
# ─── Text-to-image ────────────────────────────────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-2-klein-4b",
"prompt": "a serene mountain lake at sunrise, photorealistic",
"aspect_ratio": "3:2",
"output_format": "jpg"
}'
# Response (async — a task is created):
# { "code": 200, "data": { "taskId": "clxxx", "state": "pending" } }
# ─── Image-to-image (up to 3 reference images) ────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-2-klein-4b",
"prompt": "restyle as a soft watercolor painting",
"image_urls": ["https://example.com/a.jpg", "https://example.com/b.jpg"],
"aspect_ratio": "match_input_image"
}'
# ─── Poll for the result ──────────────────────────────────
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed", "resultUrls": ["https://r2.apimodels.app/..."] } }| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | flux-2-klein-4b |
| prompt | Yes | string | Text description of the image |
| image_urls | No | string[] | Array of reference-image URLs, up to 3 (image-to-image). Each is auto-compressed to ~1MP. |
| aspect_ratio | No | string | 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 (default 1:1) |
| output_format | No | string | jpg / png / webp (default jpg) |
| seed | No | number | Random seed for reproducible output |
| callback_url | No | string | Webhook URL called when the task completes |
Try it in the Playground
From $0.006 per image: a 2MP output is $0.006, and each reference image adds $0.0015 (up to 3), so image-to-image with 1 reference is $0.0075 and with 3 is $0.0105. Charged only on success.
Up to 3 reference images for image-to-image via image_urls; each is auto-compressed to ~1MP. Use aspect_ratio "match_input_image" to follow the reference ratio.