Skip to content

Edit an image · gpt-image-2.5-fast ​

POST/v1/images/edits

Reference-image editing without masks. JSON image accepts one or more sources. Multipart uses image or repeated image[] files, each at most 20 MiB.

Synchronous · direct result · This request waits for processing and returns JSON or a file directly.

Authentication

Use a customer API Key. Setup →

Authorization: Bearer YOUR_API_KEY

Choose a model

Model capabilities and limits →

Request body

Input and model rules
  • When delivery is present: requires stream; stream must be true; response_format must be "url".
  • When model = "gemini-3.1-flash-lite-image": resolution must match ^(1[kK]|1080[pP])$; size accepts only "auto", "1024x1024", "1536x1024", "1024x1536", "1792x1024", "1024x1792".
  • When model is one of "gemini-3-pro-image", "gpt-image-2.5-pro", "gpt-image-2", "image-pro", "image-creative": quality accepts only "auto", "hd"; otherwise quality accepts only "auto", "standard".
  • When progress is present and progress = true: requires stream; stream must be true.
modelstringrequired

Public product route. Lite accepts 1K only.

"gemini-3.1-flash-lite-image""gemini-3.1-flash-image""gemini-3-pro-image""gpt-image-2.5-fast""gpt-image-2.5-pro""gpt-image-2""image-basic""image-fast""image-pro""image-creative"
promptstringrequired

Non-blank prompt, at most 4096 Unicode characters.

Minimum characters: 1 · Maximum characters: 4096 · Pattern: "\\S"

sizestring

Target tier and aspect ratio; actual output pixels depend on the model. Must agree with resolution/aspect_ratio.

"auto""1024x1024""1536x1024""1024x1536""1792x1024""1024x1792""2048x2048""2048x1152""1152x2048""4096x4096""4096x2304""2304x4096"
resolutionstring

Case-insensitive tier; Lite only accepts 1k/1080p.

Pattern: "^(1[kK]|1080[pP]|2[kK]|4[kK])$" · Default: "1k"

aspect_ratiostring

"1:1""16:9""9:16""4:3""3:4""3:2""2:3""21:9"

Default: "1:1"

qualitystring

Fixed per model; standard for Lite/Flash/2.5-fast/basic/fast, hd for Pro/2.5-pro/2/pro/creative. auto accepts the fixed tier.

"auto""standard""hd"
ninteger

Fixed value: 1 · Default: 1

response_formatstring

Non-streaming response defaults to URL. Default SSE still embeds Base64, even when url is requested.

"url""b64_json"

Default: "url"

enhanceboolean

Default: true

streamboolean

Use true for SSE heartbeats followed by a completion event. No partial previews.

Default: false

partial_imagesinteger

Fixed value: 0

deliverystring

Site extension: stream=true only, incompatible with response_format=b64_json. Emits image_url.completed.

Fixed value: "url"

imageoneOfrequired

Required reference image(s); JSON accepts URLs or image data URLs.

Show structure
oneOf · 1

string — HTTP(S) image URL or Base64 image data URL.

Pattern: "^(https?://|data:image/)"

oneOf · 2

array

Minimum items: 1

progressboolean

Site extension: progress events from the same original task. Requires stream=true. Missing source percentage is null.

Default: false

allOf · 1
Input and model rules
  • When delivery is present: requires stream; stream must be true; response_format must be "url".

object

Conditional constraints (JSON Schema)
{
  "if": {
    "required": [
      "delivery"
    ]
  },
  "then": {
    "required": [
      "stream"
    ],
    "properties": {
      "stream": {
        "const": true,
        "type": "boolean"
      },
      "response_format": {
        "const": "url",
        "type": "string"
      }
    }
  }
}
allOf · 2
Input and model rules
  • When model = "gemini-3.1-flash-lite-image": resolution must match ^(1[kK]|1080[pP])$; size accepts only "auto", "1024x1024", "1536x1024", "1024x1536", "1792x1024", "1024x1792".

object

Conditional constraints (JSON Schema)
{
  "if": {
    "properties": {
      "model": {
        "const": "gemini-3.1-flash-lite-image",
        "type": "string"
      }
    }
  },
  "then": {
    "properties": {
      "resolution": {
        "pattern": "^(1[kK]|1080[pP])$"
      },
      "size": {
        "enum": [
          "auto",
          "1024x1024",
          "1536x1024",
          "1024x1536",
          "1792x1024",
          "1024x1792"
        ],
        "type": "string"
      }
    }
  }
}
allOf · 3
Input and model rules
  • When model is one of "gemini-3-pro-image", "gpt-image-2.5-pro", "gpt-image-2", "image-pro", "image-creative": quality accepts only "auto", "hd"; otherwise quality accepts only "auto", "standard".

object

Conditional constraints (JSON Schema)
{
  "if": {
    "properties": {
      "model": {
        "enum": [
          "gemini-3-pro-image",
          "gpt-image-2.5-pro",
          "gpt-image-2",
          "image-pro",
          "image-creative"
        ],
        "type": "string"
      }
    }
  },
  "then": {
    "properties": {
      "quality": {
        "enum": [
          "auto",
          "hd"
        ],
        "type": "string"
      }
    }
  },
  "else": {
    "properties": {
      "quality": {
        "enum": [
          "auto",
          "standard"
        ],
        "type": "string"
      }
    }
  }
}
allOf · 4
Input and model rules
  • When progress is present and progress = true: requires stream; stream must be true.

object

Conditional constraints (JSON Schema)
{
  "if": {
    "required": [
      "progress"
    ],
    "properties": {
      "progress": {
        "const": true
      }
    }
  },
  "then": {
    "required": [
      "stream"
    ],
    "properties": {
      "stream": {
        "const": true,
        "type": "boolean"
      }
    }
  }
}

Additional properties are not allowed.

Responses

JSON result, or SSE comment heartbeats, optional progress events (progress=true), then a completion/error event. Only a completed event proves delivery.

Response headers

X-Image-Request-Idstring

Request ID for support; may differ from the final New API request_id.

Content-Type application/json

createdintegerrequired
dataarrayrequired

Minimum items: 1 · Maximum items: 1

Show structure
urlstringrequired

Format: "uri"

b64_jsonstring

Present when explicitly requested in a successful non-streaming response.