GPT Image 2 / 2.5 Image Generation API
¶ 1. Obtain API Key
Open the Lingxi AI Plaza application list, enter the available applications, and copy the API Key.

¶ 2. Send the First Request
curl https://api.acedata.cloud/openai/images/generations \
-H "Authorization: Bearer your API Key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Minimal editorial product illustration: one plain white ceramic coffee mug centered on a solid cobalt blue tabletop, pale cream background, soft shadow, clean geometric shapes, no text, no logo, portrait composition",
"size": "1024x1536"
}'
The successfully responded image is located at data[].url. Below is the 1024×1536 result obtained through Lingxi AI Plaza on September 8, 2026 (task d56455e2-e7f7-4bcd-b935-475b0a1e0948, trace eb938601-8192-407f-b539-1e0554b697ec):

¶ 3. Common Parameters
| Field | Description |
|---|---|
model |
gpt-image-2 (default recommended), gpt-image-2.5-flare (faster), or gpt-image-2.5-sunburst (higher fidelity and control); can also explicitly choose gpt-image-2:official or gpt-image-2:reverse |
prompt |
Image description, up to 32,000 characters |
size |
auto or WIDTHxHEIGHT; width and height must be multiples of 16, with the longer side not exceeding 3840, total pixels between 655,360–8,294,400, aspect ratio not exceeding 3:1 |
n |
1–10; only supports 1 when response_format=b64_json |
quality |
low, medium, high, or auto; different lines have different support and billing methods |
response_format |
url or b64_json |
callback_url |
Optional; send results to this address after long tasks are completed |
Common sizes:
| Ratio | 1K | 2K | 4K |
|---|---|---|---|
| 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 |
size: "auto" will select the aspect ratio, pixels, and layout intention based on the prompt; specify dimensions directly when precise pixels are needed.
¶ 4. Generate Multiple Images
curl https://api.acedata.cloud/openai/images/generations \
-H "Authorization: Bearer your API Key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A small fox reading under a glowing mushroom, watercolor illustration",
"size": "1536x1024",
"n": 2
}'
gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst, and :reverse are billed based on the number of successful images; gpt-image-2:official is billed based on the actual tokens for text input and image output in the response. The page price is an estimate before the request, and the final amount is based on usage records.
¶ 5. Asynchronous Callback
After adding callback_url to the request body, the interface will first return {"task_id": "..."}, and upon completion, it will POST the final result to that URL; synchronous requests will still return created and data:
{
"model": "gpt-image-2",
"prompt": "A product poster with clear typography",
"size": "1024x1024",
"callback_url": "https://example.com/webhooks/images"
}
The callback receiver should use task_id for deduplication and verify the request source and data format.
¶ 6. Troubleshooting
| Status | Check |
|---|---|
| 400 | Combination of model, prompt, size format, n, and response_format |
| 401 | Is the API Key complete? Is the Header Authorization: Bearer ...? |
| 429 | Too many requests, please try again later |
| 504 | Synchronous generation timed out; switch to callback_url |
Error responses will include error.code, error.message, and trace_id. When reporting issues, provide the trace_id, do not provide the API Key.
Complete fields and real-time enumeration are based on the OpenAI Images Generations API page. For image editing, please refer to GPT Image 2 / 2.5 Image Editing.