OpenAI Images Edits API
POSThttps://api.acedata.cloud/openai/images/edits
POSThttps://api.acedata.cloud/v1/images/edits

OpenAI image editing API, input images and instructions, output modified images.

Request Headers

acceptstring
Specify the response format, only supporting `application/json`.
Please select
Content-Typestring
Use `multipart/form-data` to upload image files, or use `application/json` to reference images via URL (extended mode; JSON mode does not support direct upload of file bytes).
Please select
authorizationstring
Bearer token

Request Body

imageRequired parameter
Reference image URL. Accepts a single URL string or an array of URL strings (up to 16). The JSON schema **does not** accept uploaded file bytes—if you need to upload files directly, please use `multipart/form-data`.
promptstringRequired parameter
Describe the text of the desired editing effect. `dall-e-2` up to 1000 characters, GPT Image series models up to 32000 characters.
modelstring
Models used for image editing. Supports `dall-e-2`, `dall-e-3`, GPT Image series (`gpt-image-1`, `gpt-image-1.5`, `gpt-image-2`), as well as Google Nano Banana models (`nano-banana`, `nano-banana-2`, `nano-banana-pro`).
Please select
ninteger
Number of images to generate (1-10). **Only valid for `dall-e-2`.** For the `gpt-image-1` / `gpt-image-1.5` / `gpt-image-2` series and `nano-banana` / `nano-banana-2` / `nano-banana-pro` series, `n` is currently **not effective**—values greater than 1 will be silently downgraded to 1 (only one edited image will be returned, and only one will be charged). To obtain multiple variants for these models, please send multiple parallel requests yourself.
qualitystring
Image quality. The GPT Image series models support: `auto`, `high`, `medium`, `low`.
Please select
output_formatstring
The return formats of the GPT Image series models are: `png`, `jpeg`, or `webp`.
Please select
sizestring
Image size, in the format of `WIDTHxHEIGHT`, or `auto`. **`gpt-image-2`** accepts any `WIDTHxHEIGHT` value that conforms to this format, including 1K presets (`1024x1024`, `1536x1024`, `1024x1536`, `1792x1024`, `1024x1792`), 2K presets (`2048x2048`, `2048x1536`, `1536x2048`, `2048x1152`, `1152x2048`), 4K presets (`2880x2880`, `3264x2448`, `2448x3264`, `3840x2160`, `2160x3840`), and custom sizes; regardless of the size, each image is billed at a fixed price. Upstream limitations: custom sizes must be multiples of 16, with the longer side ≤ 3840, and total pixel count ≤ 8,294,400. `dall-e-2` supports: `256x256`, `512x512`, `1024x1024`. Inputting `auto` allows the model to choose automatically.
backgroundstring
Only applicable to the GPT Image series models. Transparency handling methods: `transparent` (transparent), `opaque` (opaque), or `auto` (automatic).
Please select
input_fidelitystring
Matching strength of style and features of the input image (applicable to GPT Image series models).
Please select
response_formatstring
Response format: `url` (default) or `b64_json`.
Please select
output_compressioninteger
Compression level (0-100%) when outputting `webp` or `jpeg`.
callback_urlstring
Optional callback URL. When provided, the interface immediately returns `task_id` and pushes the results to that URL via POST after the image editing is completed.
asyncboolean
Whether to process in asynchronous mode. When set to `true`, the interface immediately returns `task_id`, without the need to provide `callback_url`, and then the result can be obtained by polling the corresponding task query interface; if `callback_url` is also provided, the result will be pushed to that callback address.
Please select

Response

OpenAI generation
Allow Use General Balance

When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.

Shell

Python

JavaScript

Java

Go

PHP

Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.