OpenAI Images Generations API
POSThttps://api.acedata.cloud/openai/images/generations
POSThttps://api.acedata.cloud/v1/images/generations

Unified image generation endpoint compatible with the OpenAI Images API. A single endpoint supports DALL·E 2/3, the full GPT Image family (gpt-image-1, gpt-image-1.5, gpt-image-2), and Google's Nano Banana family (nano-banana, nano-banana-2, nano-banana-pro). Fine-grained control via size, quality, style, background, output_format, moderation, etc., with transparent background, PNG/JPEG/WebP outputs, and optional callback_url for async delivery.

Request Headers

acceptstring
Specify the response format returned by the server.
Please select
authorizationstring
Bearer token

Request Body

modelstringRequired parameter
Models for image generation. Supports OpenAI's `dall-e-2`, `dall-e-3`, `gpt-image-1` / `gpt-image-1.5` / `gpt-image-2` series, as well as Google's `nano-banana` / `nano-banana-2` / `nano-banana-pro` (via Nano Banana backend routing). The `size`, `quality`, `style`, `background`, `output_format`, `moderation`, and `response_format` parameters supported by different models vary, please refer to the descriptions of each field for details.
promptstringRequired parameter
Text description of the required image. The GPT image model supports up to 32,000 characters, `dall-e-2` supports up to 1,000 characters, and `dall-e-3` supports up to 4,000 characters. A selection of example prompts is provided in the dropdown list (source: [EvoLinkAI/awesome-gpt-image-2-prompts](https://github.com/EvoLinkAI/awesome-gpt-image-2-prompts), Apache-2.0 license); you can also enter your own.
ninteger
The number of images to be generated ranges from 1 to 10. **Only effective for `dall-e-2`.** `dall-e-3` only supports `1`. For the `gpt-image-1` / `gpt-image-1.5` / `gpt-image-2` series and the `nano-banana` / `nano-banana-2` / `nano-banana-pro` series, the `n` parameter is currently **not effective**—values greater than 1 will be silently downgraded to 1 (only one image will be returned and billed). If you need these models to generate multiple images, please send multiple requests concurrently.
sizestring
The dimensions for generating images are in the format `widthxheight`, or fill in `auto` for the model to choose automatically. **`gpt-image-2`** accepts any `WIDTHxHEIGHT` value that conforms to the format, including 1K presets (`1024x1024`, `1536x1024`, `1024x1536`, `1792x1024`, `1024x1792`), 2K presets (`2048x2048`, `2048x1536`, `1536x2048`, `2048x1152`, `1152x2048`), 4K presets (`2880x2880`, `3264x2448`, `2448x3264`, `3840x2160`, `2160x3840`), as well as any custom size; regardless of the size, billing is uniform per image. The upstream limitation for custom sizes must be a multiple of 16, with the longer side not exceeding 3840, and total pixels not exceeding 8,294,400. `dall-e-2` supports: `256x256`, `512x512`, `1024x1024`. `dall-e-3` supports: `1024x1024`, `1792x1024`, `1024x1792`. Passing `auto` (default) or leaving it blank will allow the model to choose automatically.
callback_urlstring
Optional callback URL. Once provided, the API will immediately return `task_id` and will push the results to that URL via a POST request after the image generation is complete. The callback payload contains `task_id`, `trace_id`, `success` (boolean), and the complete response data or error information.
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
stylestring
The style of `dall-e-3`: `vivid` (hyper-realistic/dramatic) or `natural` (more naturally neutral).
qualitystring
Image quality. GPT image model options: `auto` (default), `high`, `medium`, `low`. `dall-e-3` options: `hd` or `standard`. `dall-e-2` supports only: `standard`.
backgroundstring
Set the background opacity for the GPT image model. The optional values are `transparent`, `opaque`, or `auto` (default). When selecting `transparent`, please use an output format that supports the Alpha channel (png/webp).
Please select
moderationstring
The content review levels of the GPT image model. `low` will relax the filtering strength; `auto` uses the default policy.
Please select
output_formatstring
The return format of the GPT image model. Optional values are `png`, `jpeg`, or `webp`.
Please select
partial_imagesinteger
The number of intermediate images sent during the streaming process (0-3). `0` indicates that the final image is returned directly in one event.
response_formatstring
The return format for `dall-e-2` / `dall-e-3` images: `url` or `b64_json`. The GPT image model does not support this parameter (always returns base64 encoded).
output_compressioninteger
The compression level (0-100%) of the GPT image model when using `webp` or `jpeg` output formats.

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.