Skip to main content
POST
Edits take one or more source images and a prompt describing the change. With a mask, only the transparent region is repainted; without one, the model rewrites the whole frame guided by the references. Two request encodings work, and PipeLLM passes both through:
  • multipart/form-data with the image bytes uploaded directly. This is what the OpenAI SDK sends.
  • application/json with an images array of file_id or image_url entries, up to 16 references.
file | array
required
Source image, or several. Send file parts under image[] in multipart, or the JSON images array. PNG, JPEG, or WebP.
string
required
What the edited image should show. Up to 32,000 characters on GPT image models.
string
Image model ID, for example gpt-image-2.5-sunburst.
file
A PNG whose transparent pixels mark the region to repaint. Must match the source dimensions. Omit it to let the model edit the whole image.
integer
default:"1"
Number of images to return, 1–10.
string
default:"auto"
auto, 1024x1024, 1536x1024, 1024x1536, or a custom WIDTHxHEIGHT divisible by 16.
string
default:"auto"
low, medium, high, or auto. The gpt-image-2.5 variants add xhigh and max.
string
default:"low"
high preserves faces, logos, and fine texture from the source more closely, at a higher input-token cost. low gives the model more freedom.
string
default:"auto"
transparent, opaque, or auto. Transparent requires png or webp output.
string
default:"png"
png, jpeg, or webp.
integer
default:"100"
Compression level 0–100, for jpeg and webp only.
string
Stable end-user identifier.
The response shape matches Create an image: the bytes come back base64-encoded in data[].b64_json, and usage.input_tokens_details.image_tokens covers the source images you uploaded.

Combining references

With several source images the model composes across them — a product plus a scene, a person plus an outfit. Order matters: describe the references in the prompt in the order you send them, for example “dress the person from the first reference in the outfit from the second”. Masks apply to the first image only.

Long requests

Edits use the same keep-alive behavior as generation: after 90 seconds of upstream silence the gateway writes a whitespace padding chunk every 30 seconds ahead of the JSON body. See Long requests.

Errors

Same envelope as Errors.
Mask dimensions not matching the source, an unreadable upload, or a size the model rejects.
The upload exceeded the accepted body size. Downscale the source before sending.