Edits an image from a prompt, with an optional mask or reference images. Send multipart form data, or JSON with base64 images.
Body
modelstringYes- ID of a model that supports editing
promptstringYes- 1–16,000 characters. Providers with lower limits may reject longer prompts
imagestring | file | arrayYes- Base64 in JSON, a file part in multipart. FLUX 3 Image Klein takes 1–10 reference images
maskstring | fileNo- Area to edit. Needs
capabilities.image_mask: true nintegerNo- 1–4. Default 1
sizestringNoWxHpixels (such as256x256,512x512,1024x1024,1792x1024,1024x1792,1536x1024,1024x1536),auto, or a resolution tier. Same rules as generationaspect_ratiostringNo1:1,16:9,9:16,4:3,3:4,3:2,2:3,4:5,5:4,1:2,2:1,7:5,5:7,1:4,4:1,1:8,8:1,9:21,21:9,autoresolutionstringNo512,768,1K,1.5K,2K,4Kresponse_formatstringNourl(default) orb64_jsonquality/output_format/output_compression/backgroundNo- Same as generation, where supported
prompt_upsamplingbooleanNo- FLUX 3 Image Klein only.
trueorfalsein multipart extra_body.gpunodeobjectNo- Open-weight models:
seed,num_inference_steps,prompt_upsampling. A JSON string in multipart extra_body.googleobjectNo- deprecated aliases of
aspect_ratioandresolution. A JSON string in multipart userstringNo- End-user identifier
Multipart bodies can be up to 4 MiB and JSON up to 5 MiB. Files are converted to base64 and must still fit in 5 MiB.
Larger requests return 413 request_too_large or invalid_request_error, so check the encoded size.
Model options
Pick a model at the top of this page, or read capabilities, limits and parameter_constraints from GET /v1/models.
Parameter policy decides whether unsupported values are adjusted or rejected with 400.
Ratio and resolution rules match image generation. With no size, ratio or resolution, the output usually keeps the input's aspect ratio.
FLUX 3 Image Klein editing
For everyais/flux-3-image-klein:
- Send 1–10 references (JPEG, PNG, WebP). In multipart, repeat the
imageorimage[]part. Compress them to stay within the body limits. - Other options and prices match generation.
- Without
size, the output follows the first reference: its aspect ratio up to 4 MP and 4096 px per side, or under 1 MP on a 16 px grid when there are several references. Billing uses the nearest tier, and the response'ssizeis the actual size. aspect_ratioalone gives that ratio at1K.resolutionalone gives the size at that tier closest to the first reference's ratio. Explicit sizes must be one of the 60 listed sizes.- Refer to references by position ("the first image", or
<ref_image_0>in box edits). There is no mask. - Describe the full target image. For box edits, append
{"id","from":"ref_image_0"|null,"src_bbox","tgt_bbox","desc"}items (0–1000 grid;tgt_bbox: nullremoves). Boxes guide placement and scale and are not exact masks.
json
{
"model": "everyais/flux-3-image-klein",
"prompt": "Move the <mug> from the first image to the right side of the table. [{\"id\":\"mug\",\"from\":\"ref_image_0\",\"src_bbox\":[600,100,800,250],\"tgt_bbox\":[600,650,800,800],\"desc\":\"white ceramic mug\"}]",
"image": ["<base64-encoded-image>"],
"n": 1
}