← All docs

Endpoints

Edit an image

POST/v1/images/edits

Loading models…

Body

modelstringYes
ID of a model that supports editing
promptstringYes
1–16,000 characters. A provider with a lower limit may reject longer prompts
imagestring | file | arrayYes
Source image — a base64 string in JSON, a file part in multipart. FLUX 3 Image Klein accepts an array of 1–10 reference images
maskstring | fileNo
Mask for the region to edit. Check capabilities.image_mask
nintegerNo
Number of images to generate, 1–4 (default 1)
sizestringNo
Pixel WxH or auto (e.g. 256x256 · 512x512 · 1024x1024 · 1792x1024 · 1024x1792 · 1536x1024 · 1024x1536 · auto) or a resolution tier. Same rules as generation; omission keeps the provider default (usually the input image's ratio)
aspect_ratiostringNo
1: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 · auto. Changes the output ratio only when given
resolutionstringNo
512 · 768 · 1K · 1.5K · 2K · 4K
response_formatstringNo
url (default) · b64_json
quality / output_format / output_compression / backgroundNo
Same meaning as generation (/v1/images/generations); supported models only
extra_body.googleobjectNo
deprecated — aspect_ratio and image_size alias aspect_ratio and resolution. A JSON string in multipart
extra_body.gpunodeobjectNo
Managed GPU node models only: seed · num_inference_steps · prompt_upsampling (FLUX 3 Image Klein). A JSON string in multipart
prompt_upsamplingbooleanNo
FLUX 3 Image Klein only, same as generation. true/false in multipart
userstringNo
End-user identifier

The entire multipart body is limited to 4 MiB; JSON is limited to 5 MiB. After file-to-base64 conversion, the payload must also fit within 5 MiB. Exceeding these limits returns 413 request_too_large or invalid_request_error. Check encoded byte size, not only image dimensions.

Model options

Check the table above for the values the selected model supports (in the API: capabilities, limits, and parameter_constraints in GET /v1/models). Whether an unsupported value is adjusted or rejected with 400 is described under parameter policy in model selection and access.

Use a mask only with capabilities.image_mask: true. Supported aspect ratios, resolutions, and adjustment rules match image generation. When size, aspect ratio, and resolution are all omitted, the edit keeps the provider default (usually the input image's ratio).

FLUX 3 Image Klein editing (everyais/flux-3-image-klein)

  • image is one image or an array of 1–10 reference images. In JSON use base64/data URLs; in multipart repeat image or image[] parts. JPEG, PNG, WebP. Body limits are unchanged (4 MiB multipart / 5 MiB JSON), so compress references before sending.
  • n, output_format, prompt_upsampling, and extra_body.gpunode (seed, num_inference_steps) match generation (in multipart, prompt_upsampling is true/false and extra_body is a JSON string). Pricing also matches generation, by output tier (768 $0.008 · 1K $0.009 · 1.5K $0.011 · 2K $0.014, times n).
  • Omitting size: the output follows the first reference. With one reference, same aspect ratio fitted to ≤4 MP and ≤4096 px per side; with several, the first reference is scaled under 1 MP on multiples of 16. Billing uses the nearest tier. If given, size must be one of the 60 sizes in image generation.
  • Refer to references in the prompt by position ("the first image", <ref_image_0> in box edits). This model has no mask.
  • Describe the edit as the full target image. For box edits, append a JSON list to the prompt: {"id","from":"ref_image_0"|null,"src_bbox","tgt_bbox","desc"} (0–1000 grid; tgt_bbox: null removes). Boxes guide placement and scale; they are not hard 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
}
Contact support