GPT Image edit with a mask and several images: which is masked?
OpenAI applies the mask to the first of several input images. Sume forwards input_references in order with mask_url, so put the image to edit first.

OpenAI's guide says that with multiple input images the mask is applied to the first image. Sume's docs state no such rule, but the provider adapter forwards your input_references in the order you send them together with mask_url, so put the image you want edited first and the extra references after it.
OpenAI's rule is from its image generation guide; Sume's from the Image API docs and adapter code, read 2026-09-30. Sume does not document which reference the mask binds to, so this is the cautious choice, not a documented guarantee.
What are OpenAI's mask rules?
The guide says the image to edit and the mask must be the same format and size (under 50MB), and that the mask must contain an alpha channel. It also notes masking with GPT Image is prompt-based, so the model uses the mask as guidance.
What does Sume accept?
| Field | Documented behavior |
|---|---|
input_references | Up to 16 images on ChatGPT Image 2.5; must be public HTTPS URLs |
mask_url | Optional public HTTPS mask URL for ChatGPT Image 2.5 edits |
| More than 16 references | Adapter error: GPT Image accepts at most 16 reference images |
How should I order the request?
Put the image to edit at index 0 of input_references, then style or object references. Build the mask to match that first image's size and format, following OpenAI's rule. If you do not need extra references, send one image and the mask to avoid the question.
const body = {
model: "openai/gpt-image-2.5",
prompt: "replace the masked sofa with a green armchair",
input_references: [
{ type: "image_url", image_url: { url: "https://example.com/room.png" } },
{ type: "image_url", image_url: { url: "https://example.com/chair.png" } },
],
mask_url: "https://example.com/room-mask.png",
};
console.log(JSON.stringify(body));What else should I check?
Read the alpha-channel details in mask alpha channel and mask_url, and test with a small mask first. Unlisted parameters are rejected with 400 unsupported_parameter, so confirm the model's supported_parameters include mask_url.
Sources
Related posts
More in Developers
- GPT Image 2.5 moderation low: can you send it through Sume?
OpenAI lists a moderation parameter (auto or low) for GPT Image 2.5. Sume's request table does not list it, so check the catalog before sending it.
- GPT Image resolution above 2560x1440: experimental, and Sume's cap
OpenAI marks GPT Image sizes above 2560x1440 as experimental. Sume's 2.5 custom pixels accept up to a 3840 edge, so check the five size rules before you send.
- gpt-image-2 transparent background: OpenAI preview vs Sume
OpenAI put transparent backgrounds for gpt-image-2 in preview (png or webp). On Sume, the background parameter is listed for ChatGPT Image 2.5, not gpt-image-2.
- GPT Image output_compression: OpenAI has it, Sume returns 400
OpenAI lets jpeg and webp take output_compression 0-100. Sume's docs say it is not served in v1 and sending it returns 400 unsupported_parameter.
Written by Sume