dall-e-3, the text rendering-capable gpt-image-1, the latest generation gpt-image-2, and the series of models nano-banana / nano-banana-2-lite / nano-banana-2 / nano-banana-pro that can be accessed through the same interface. They can all generate high-quality images based on text descriptions.
This document mainly introduces the usage process of the OpenAI Images Generations API, allowing us to easily utilize the image generation capabilities of the OpenAI series.
Application Process
To use the OpenAI Images Generations API, first go to the Ace Data Cloud Console to obtain your API Token for future use.
If you are not logged in or registered, you will be automatically redirected to the login page to invite you to register and log in, and will return to the current page upon completion.
One API Token can call all services on the platform without needing to apply separately for each service. The first application will grant a free quota for a trial experience; when the quota is insufficient, you can recharge the general balance in the console.
📘 Complete documentation: OpenAI Images Generations API →
GPT-Image-2 Model
gpt-image-2 is a new generation image generation model launched by OpenAI, which has significant improvements over dall-e-3 and gpt-image-1 in the following aspects:
- Stronger instruction-following ability: Can accurately understand complex compositions, counting, positional relationships, and other structured instructions.
- Clearer text rendering: English and numbers in scenarios such as posters, menus, infographics, and logos are almost never garbled.
- Richer style expression: Natively supports various styles such as cinematic portraits, retro posters, children’s illustrations, product photography, and infographics.
- Native multi-aspect ratio + high-resolution support: Covers 5 aspect ratios (1:1, 4:3, 3:4, 16:9, 9:16) with a total of 3 resolution tiers (1K / 2K / 4K).
model field to gpt-image-2. The url in the returned result is a permanently hosted image link on platform.cdn.acedata.cloud, which can be opened directly in a browser or embedded in a webpage.
Line Variants (:official / :reverse)
gpt-image-2 defaults to the standard line. You can explicitly select the line by appending the model name suffix:
gpt-image-2:official: Official channel, stable and compliant. Costs are determined by the text input Token and image output Token, and are ultimately settled based on the actual usage in the response; the quality/size price displayed on the page is for estimation only; customer prices are approximately 20% off the OpenAI official standard price based on the maximum Usage package. The service will automatically failover between available channels, with capabilities and costs based on the actual returned results.gpt-image-2:reverse: Completely equivalent to the defaultgpt-image-2, with a better cost-performance ratio, and the price remains unchanged.
:officialBilling Formula Final cost = Text input Token + Image input Token (editing only) + Image output Token. Thequality × sizeprice displayed on the page is an estimate before the request, and the actual deduction is based on theusageof the successful response. For example,low,1024x1024typically incurs an image output cost of about 0.0505 Credits, plus a small amount of input Token; when usingauto, the model may choose a higher quality, and the pre-authorization amount will be conservatively checked at a higher tier.
Supported size Values
gpt-image-2 only checks the format of size; as long as it is not auto or an empty string, it must match WIDTHxHEIGHT (e.g., 1024x1024, 2048x1152, 800x600); any other form will return 400. The default gpt-image-2 and :reverse charge uniformly per image; the dimensions and quality of :official will affect the image output Token, and the final settlement will be based on actual Token usage.
Size limitations: Custom sizes must meet the criteria of both width and height being multiples of 16, with a long side ≤ 3840, and total pixel count ≤ 8,294,400; exceeding these limits will return a 4xx error.
When explicitly passingHere are several real examples from different perspectives to intuitively experience the capabilities ofsize: "auto", the platform will plan the canvas in a continuous aspect ratio space and determine based on the following priorities: explicit pixels or ratios in the prompt, naming standards (paper/print/platform ad/device/photography/film), medium conventions, and finally composition inference. Therefore, in addition to common ratios like1:1,4:5,9:16,21:9, it can also retain non-predefined ratios like1.91:1,1.85:1,2.39:1, and ISO paper1:√2; the final size will be automatically adjusted to the service-supported multiples of 16 and pixel budget. If automatic judgment is unavailable, it will revert to the model’s default aspect ratio without blocking generation. Omitting thesizefield will directly use the model’s default aspect ratio; if strict pixel requirements are needed, it is still recommended to directly passWIDTHxHEIGHT. Outputs under the 1K tier do not guarantee strict pixel alignment—if you pass1024x1024, you might receive1254x1254, maintaining the same ratio. If you re-pass it assize, the billing remains unchanged. A single call at 4K typically takes 4–8 minutes, and it is recommended to use it with thecallback_urlfor asynchronous callbacks as mentioned later. About thenparametergpt-image-2supportsn > 1(values 1–10): it can return the corresponding number of images in one request. By default,gpt-image-2and:reverseare billed based on the number of successful images; the:officialresponseusagehas summarized the total tokens for the entire request and will not be multiplied bynagain. To ensure that multiple results have differences, it is recommended to pass differentpromptsorseedssimultaneously. This also applies togpt-image-1/gpt-image-1.5, as well as thenano-banana/nano-banana-2-lite/nano-banana-2/nano-banana-proseries;dall-e-3only supportsn = 1. Note thatresponse_format=b64_jsononly supportsn=1, and forn>1, please use the default URL return. If some images fail to generate, only the successful parts will be returned and billed.
gpt-image-2.
Scene 1: Cinematic Portrait
Film terminology (35mm film, shallow depth of field, neon light, etc.) can be used in the prompt to precisely control the atmosphere and texture. Python sample call code:
Scene 2: Vintage Travel Poster (with Text Rendering)
gpt-image-2 performs stably in typesetting and font rendering, making it very suitable for generating designs with text such as posters, menus, and greeting cards.
url field in the returned result is as follows:

AMALFI and ITALIA 1958 are also rendered clearly and correctly.
Scene 3: Complex Composition and Counting
The following prompt is used to test the model’s adherence to structured instructions such as “quantity” and “position.”
dall-e-3.
Scene 4: Illustration Style (Landscape)
By specifying artistic media and emotional keywords, the model can be guided to produce stylized illustrations.
Asynchronous and Callback
A single call togpt-image-2 usually takes 60 to 90 seconds. If you do not wish to maintain a long connection, you can use the callback_url asynchronous callback mechanism introduced later in this article; the calling process is completely consistent with other models.
Nano Banana Series Models
Thenano-banana series is an image generation model based on Gemini, which has been integrated through the same /openai/images/generations interface, requiring no endpoint switch; just change the model to any of those in the table below.
Important: Supported Parameter Range Nano Banana connects to the OpenAI protocol through an adaptation layer, supporting only the following parameters compared togpt-image-*:model,prompt,size,n.
sizewill be mapped to the internalaspect_ratioas per the table below; unlisted sizes will default to1:1:
1024x1024/512x512/256x256→1:11792x1024→16:91024x1792→9:16- Parameters such as
quality,style,response_format,background,output_format, etc., are not supported; if filled, they will be ignored.n > 1is supported (1–10), and will return and charge for the corresponding number of images.- The return structure follows the OpenAI format (
data[].url), butcreatedis fixed at0, andb64_jsonwill not be returned;revised_promptwill always equal the originalprompt.
Basic Call
url field:

Upgrade to Flagship Model nano-banana-pro
Simply change the model to nano-banana-pro, with all other parameters remaining the same:

Asynchronous Callback
Thecallback_url asynchronous callback mechanism is also effective for nano-banana, and the calling process is completely consistent with other models. Please refer to the section Asynchronous Callback below.
Basic Usage
Next, you can fill in the corresponding content on the interface, as shown in the figure:
authorization, which can be selected directly from the dropdown list. The other parameter is model, which is the model category we choose to use from the OpenAI DALL-E official site; here we mainly have 1 model, details can be found in the models we provide. The last parameter is prompt, which is the input for the image generation prompt.
You can also notice that there is corresponding code generation on the right side; you can copy the code to run directly or click the “Try” button for testing.

created, the ID generated for this image generation, used to uniquely identify this task.data, which contains the result information of the image generation.
data includes the specific information of the model-generated image, and its url is the detailed link to the generated image, as shown in the figure.

Image Quality Parameter quality
Next, we will introduce how to set some detailed parameters for the image generation results, among which the image quality parameter quality includes two types: the first standard indicates generating standard images, and the other hd indicates that the created image has finer details and greater consistency.
Below, set the image quality parameter to standard, with specific settings as shown in the figure:


standard as shown in the image below:

hd, we can obtain the image shown below:

hd has finer details and greater consistency than that generated with standard.
Image Size Parameter size
We can also set the size of the generated image, and we can make the following settings.
The following sets the image size to 1024 * 1024, with specific settings shown in the image below:


1024 * 1024 as shown in the image below:

1792 * 1024, we can obtain the image shown below:
It can be seen that the image size is obviously different, and more sizes can be set. For detailed information, please refer to our official documentation.
Image Style Parameter style
The image style parameter style includes two parameters, the first one vivid indicates that the generated image is more vivid, while the other natural indicates that the generated image is more natural.
The following sets the image style parameter to vivid, with specific settings shown in the image below:


vivid is shown below:

natural, the following image can be obtained:

vivid are more vivid and realistic than those with natural.
Image link format parameter response_format
The last image link format parameter response_format also has two types: the first type b64_json is a Base64 encoding of the image link, while the second type url is a regular image link that can be viewed directly.
Here, the image link format parameter is set to url, with specific settings shown in the image below:


url for the generated image is Image URL which can be accessed directly, and the image content is shown below:

b64_json, the result of the Base64 encoded image link can be obtained, with the specific result shown below:
Asynchronous Callback
Since the OpenAI Images Generations API may take a relatively long time to generate images, if the API does not respond for a long time, the HTTP request will keep the connection open, leading to additional system resource consumption. Therefore, this API also provides support for asynchronous callbacks. The overall process is: when the client initiates a request, an additionalcallback_url field is specified. After the client initiates the API request, the API will immediately return a result containing a task_id field information, representing the current task ID. When the task is completed, the generated image result will be sent to the client-specified callback_url in the form of a POST JSON, which also includes the task_id field, allowing the task result to be associated by ID.
Below we will understand how to operate specifically through examples.
First, the Webhook callback is a service that can receive HTTP requests, and developers should replace it with the URL of their own HTTP server. For demonstration purposes, we use a public Webhook sample site https://webhook.site/, and by opening this site, you can obtain a Webhook URL, as shown in the image:
Copy this URL, and it can be used as a Webhook. The sample here is https://webhook.site/3d32690d-6780-4187-a65c-870061e8c8ab.
Next, we can set the field callback_url to the above Webhook URL, while filling in the corresponding parameters, as shown in the following code:
task_id field, and the data field includes the same image generation results as synchronous calls, and the task association can be achieved through the task_id field.
Error Handling
When calling the API, if an error occurs, the API will return the corresponding error code and message. 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.

