FLUX image API

Generate and edit images with FLUX.2, Kontext, and FLUX 3.

Use an Official Group API key with https://app.apipool.dev. Each generation or edit creates an asynchronous task for one image. Poll until completed to get the image URL.

Models and pricing

Kontext and FLUX 3 rates are in US dollars per delivered image. References are free for these models. FLUX.2 prices references separately. Failed tasks are free.

Model ID768sq1K1.5K2K4K
flux-3-image0.0410.0480.0700.1000.607
flux-3-image-klein0.0080.0090.0110.0140.036

flux-kontext-pro costs US$0.04 per image and flux-kontext-max costs US$0.08. Both output approximately 1 MP.

FLUX.2 pricing and limits

Model ID1 MP output2 MP output3 MP output4 MP outputPer reference
flux-2-flex0.050.100.150.200.05
flux-2-pro0.030.0450.060.0750.015
flux-2-max0.070.100.130.160.03

FLUX.2 supports 1MP, 2MP (default), 3MP, and 4MP output. Submit up to eight single-frame references with a maximum of 1,048,576 pixels per reference. The output MP tier plus the number of references cannot exceed nine. Use file uploads or Base64 data URLs for references. Exact pixel dimensions and external URLs are unavailable for FLUX.2. Each task bills the output tier plus the reference charges.

FLUX.2 uses the same aspect ratios as Kontext. All three models accept seed from 0 to 4,294,967,295, prompt_upsampling, safety_tolerance from 0 to 5, and output_format of PNG, JPEG, or WebP. Flex also accepts steps from 1 to 50 (default 50) and guidance from 1.5 to 10 (default 5).

Generate and edit

curl https://app.apipool.dev/v1/images/generations \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"flux-3-image-klein","prompt":"A blue ceramic cup on a white table","aspect_ratio":"1:1","resolution":"1k","seed":0,"steps":16}'

For an edit, supply image_urls and describe the desired changes. Kontext and FLUX 3 accept public HTTP(S) URLs or PNG, JPEG, and WebP Base64 data URLs. Kontext accepts up to four references and FLUX 3 up to ten. Alternatively, upload multipart image files to /v1/images/edits. Upload limits are 10 MB per image and 48 MB in total.

curl https://app.apipool.dev/v1/images/edits \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -F model=flux-kontext-pro \
  -F prompt='Keep the shape of the cup and change its color to blue' \
  -F size=1:1 -F [email protected]

Parameters

  • prompt is required and accepts 1–4,000 characters. Describe region or layout changes in the prompt. Mask uploads are unavailable.
  • n is fixed at 1.
  • For Kontext, size accepts auto, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9, and 9:21. Exact pixel dimensions are unavailable.
  • FLUX 3 also accepts 2:1, 7:5, 5:4, 4:5, 5:7, and 1:2. Provide either aspect_ratio or size.
  • FLUX 3 accepts 768sq, 1k (default), 1.5k, 2k, and 4k for resolution. For Kontext, omit resolution or use 1MP.
  • Kontext and Klein accept integer seed from 0 to 4,294,967,295. Klein accepts steps from 1 to 16 (default 16). FLUX 3 Image accepts neither field.
  • Kontext accepts png, jpeg, or webp for output_format. Klein accepts jpeg or png. FLUX 3 Image has no output-format option.
  • safety_tolerance defaults to 2. Kontext accepts 0–6 and FLUX 3 accepts 0–4.
  • Kontext accepts boolean prompt_upsampling (default false). FLUX 3 Image accepts boolean grounding (default true). Klein accepts neither field.

Results and troubleshooting

Use the returned task ID and the same API key with GET /v1/tasks/{task_id}. Keep checking the original task while it processes. Save the image when it completes. Query again for a fresh link while the result is retained.

HTTP 400 can indicate unsupported, repeated, or out-of-range parameters. HTTP 402 indicates an insufficient balance. For an unreadable reference URL, check its expiry and access restrictions. Read the task error before changing and resubmitting a failed request.

Try Kontext Pro, Kontext Max, FLUX 3 Image, or Klein.