gpt-image-2
Image Edit
POST
Authorization
- Auth Type:
Bearer Auth(In:header) - Format:
Authorization: Bearer <YOUR_API_KEY> - Description: Use
Bearer <YOUR_API_KEY>. Format:Authorization: Bearer sk-xxxxxx. - API Key: where API Key is your AGCloud API KEY
Request Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | ✅ | - | The model identifier to use for this request, e.g. git-image-2. |
prompt | string | ✅ | - | A text description of the desired image edit. |
image | file | ✅ | - | The input image(s) to edit. Each image should be a png, webp, or jpg file. You can provide up to 16 images. |
mask | file | - | - | An additional image whose fully transparent areas indicate where the image should be edited. |
input_fidelity | file | - | - | Controls how faithfully the model preserves the original input image. Only supported by gpt-image-1. gpt-image-2 always uses high fidelity. |
n | integer | - | 1 | The number of images to generate. Must be between 1 and 10. |
size | string | - | auto | The size of the generated images. For gpt-image-1: one of auto, 1024x1024, 1536x1024, or 1024x1536. For gpt-image-2: supports arbitrary resolutions (max edge ≤ 3840px, both sides must be multiples of 16px, aspect ratio ≤ 3:1, total pixels between 655,360 and 8,294,400). |
quality | string | - | auto | The quality of the generated images. One of auto, low, medium, or high. Defaults to auto. Not supported by -plus suffixed models. |
background | string | - | auto | Allows to set transparency for the background of the generated image(s). transparent is only supported by gpt-image-1 (not gpt-image-2) and requires output_format to be png or webp. |
moderation | string | - | auto | Content moderation level for generated images. low is less restrictive, auto is the default. |
output_format | string | - | auto | The output format of the generated image(s). Defaults to auto. jpeg is faster than png for latency-sensitive scenarios. |
output_compression | string | - | 100 | The compression level (0-100%) for the output image. Only applicable with webp or jpeg format. Defaults to 100. |
stream | string | - | false | Whether to stream the response in real-time. When enabled, partial images can be received during generation. |
partial_images | string | - | - | The number of partial images to receive during streaming. Only used when stream is true. Set to 0 for a single streaming event with the complete image. Each partial image incurs an additional 100 image output tokens. |
user | string | - | - | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. |