dall-e-2, gpt-image-1, the latest gpt-image-2, as well as the nano-banana / nano-banana-2 / nano-banana-pro series models accessed through the same interface.
This document mainly introduces the usage process of the OpenAI Images Edits API, enabling you to easily utilize the official OpenAI image editing capabilities.
Application Process
To use OpenAI Images Edits API, first open the Ace Data Cloud Console and copy your API Token.
If you are not logged in, you will be redirected to sign in and brought back to this page automatically.
A single API Token works across every service on the platform — no need to subscribe per service. New accounts receive free starter credit; when it runs low you can top up your shared balance in the console.
📘 Full documentation: OpenAI Images Edits API →
GPT-Image-2 Model
Compared togpt-image-1, gpt-image-2 offers significant improvements in image editing scenarios:
- More stable structure retention: Changing skins, colors, or backgrounds almost never disrupts the original layout and composition.
- More accurate text preservation: Text in infographics, posters, menus, etc., remains clear and readable after editing.
- Supports direct URL input: Besides traditional
multipart/form-datafile uploads,gpt-image-2additionally supports passing image URLs via JSON, eliminating the need to download images locally first, which is ideal for server-side pipeline integration. - Supports high-resolution redraws: You can input a 1K original image and request 2K / 4K output via the
sizeparameter; the model will perform upscaling during editing.
Supported size Values
The size constraint for the editing interface is identical to the generation interface — gpt-image-2 accepts size as auto, empty, or in the WIDTHxHEIGHT format; any other format will return a 400 error. All sizes (1K / 2K / 4K / custom) are charged per single image uniformly, regardless of the original image resolution or the requested size.
The same upstream hard constraints on custom sizes apply: width and height must be multiples of 16, the longer side ≤ 3840, and total pixels ≤ 8,294,400.
| Aspect Ratio | 1K Recommended | 2K Recommended | 4K Recommended |
|---|---|---|---|
| 1:1 | 1024x1024 | 2048x2048 | 2880x2880 |
| 4:3 | 1536x1024 | 2048x1536 | 3264x2448 |
| 3:4 | 1024x1536 | 1536x2048 | 2448x3264 |
| 16:9 | 1792x1024 | 2048x1152 | 3840x2160 |
| 9:16 | 1024x1792 | 1152x2048 | 2160x3840 |
For example: If the original image is1024x1024, passingsizeas2048x2048will cause the model to redraw and output a 2K image according to the editing instructions; passing3840x2160outputs a 4K landscape image; passingautoor omitting the parameter lets the model decide. All three are charged equally.
About theBelow are two real examples from different perspectives to showcase the editing capabilities ofnparameter Thegpt-image-2editing interface currently does not supportn > 1: this parameter will be silently ignored. Whether you passn=1orn=10, only one image will be returned per request and charged as one image. If you need multiple candidate edited images at once, please make multiple concurrent requests yourself. This limitation also applies togpt-image-1/gpt-image-1.5and thenano-banana/nano-banana-2/nano-banana-proseries.dall-e-2is currently the only editing model that natively supportsn > 1.
gpt-image-2.
Method 1: JSON + Image URL (Recommended)
Send the request withapplication/json content type, filling the image field with an image URL. The model will fetch the image and edit it according to the prompt.
For example, the original image below is a science infographic generated by gpt-image-2:


Tip: Theimagefield also supports passing an array, e.g.,"image": ["url1", "url2", "url3"], allowing up to 16 reference images simultaneously for the model to consider comprehensively during editing.
Method 2: JSON + Multiple Reference Images
gpt-image-2 supports referencing multiple images simultaneously to generate the final result, for example, combining multiple product photos into a single gift basket:
Scenario Example: Style Change + Structure Preservation
Here is another example where a wooden bookshelf is replaced with a modern floating shelf, but the exact number and arrangement of books on each shelf are strictly preserved. Original image (wooden bookshelf generated bygpt-image-2):

task_id: e9544dba-727e-44a2-81e1-223d49869380):

Method 3: multipart/form-data (Compatible with OpenAI SDK)
If you are already using the official OpenAI Python SDK, the originalmultipart/form-data upload method is also applicable; just change the model to gpt-image-2:
OPENAI_BASE_URL to https://api.acedata.cloud/openai, and OPENAI_API_KEY to the acquired token:
Nano Banana Series Models
Thenano-banana series is also integrated with /openai/images/edits for editing scenarios; just change the model to any one in the table below.
| Model | Cost (Credits / request) | Suitable Scenario |
|---|---|---|
nano-banana | 0.14 | General image editing, fastest and lowest cost |
nano-banana-2 | 0.28 | Noticeable improvement in quality and detail |
nano-banana-pro | 0.35 | Flagship of the series, best retention of structure, text, and style |
Important: Supported Parameters Nano Banana accesses the OpenAI protocol via an adaptation layer and only supports the following parameters:model,prompt,image.
imagecan be uploaded viamultipart/form-data(internally converted todata:<mime>;base64,...for upstream) or passed as a URL string in the form field.- Parameters like
mask,n,size,response_formatare not supported and will be ignored if provided.- The response structure follows the OpenAI format (
data[].url), butcreatedis fixed at0, nob64_jsonis returned, andrevised_promptalways equals the originalprompt.
Calling via Form + Image URL

Calling via Form + Local File
Asynchronous Callback
Thecallback_url asynchronous callback mechanism also applies to nano-banana; the calling process is exactly the same as for other models, see the Asynchronous Callback section below.
Basic Usage
You can now use code to call the API. Below is a CURL example:authorization, which you can select directly from the dropdown list. Another parameter is model, which specifies the OpenAI official model category; here we mainly have one model, details of which can be found in the provided model list. Another parameter is prompt, which is the text prompt for generating the image. The last parameter is image, which is the path to the image to be edited. The image to be edited is shown below:

OPENAI_BASE_URL can be set to https://api.acedata.cloud/openai, and the credential variable OPENAI_API_KEY is the token obtained from authorization. On macOS, you can set environment variables with:
gift-basket.png generated in the current directory, as shown below:

dall-e-2, gpt-image-1, and gpt-image-2, with gpt-image-2 being the recommended model, see the GPT-Image-2 Model section above.
Asynchronous Callback
Because the OpenAI Images Edits API may take relatively long to edit images, if the API does not respond for a long time, the HTTP request will keep the connection open, causing additional system resource consumption. Therefore, this API also provides asynchronous callback support. The overall process is: when the client initiates a request, it additionally specifies acallback_url field. After the client sends the API request, the API immediately returns a result containing a task_id field representing the current task ID. When the task is completed, the edited image result will be sent via POST JSON to the client’s specified callback_url, including the task_id field, so the task result can be correlated by ID.
Below is an example to understand how to operate.
First, the webhook callback is a service that can receive HTTP requests. Developers should replace it with their own HTTP server URL. For demonstration, we use a public webhook sample site https://webhook.site/. Open the site to get a webhook URL, as shown:
Copy this URL to use as the webhook. The example URL here is https://webhook.site/3d32690d-6780-4187-a65c-870061e8c8ab.
Next, set the callback_url field to the above webhook URL and fill in the other parameters as in the following code:
task_id field, and the data field contains the same image editing result as synchronous calls. The task_id field allows task correlation.
Error Handling
When calling the API, if an error occurs, the API will return corresponding error codes and messages. For example:400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, you have exceeded the rate limit.500 api_error: Internal server error, something went wrong on the server.

