GPT Image 2 / 2.5 / 2.6 Image Generation API
¶ 1. Get API Key
Open the 华烁云 application list, enter an available application, and copy the API Key.

¶ 2. Send Your First Request
curl https://hsyunapi.hszl-bd.cn/openai/images/generations \
-H "Authorization: Bearer 你的 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 image in a successful response is located at data[].url. Below is the 1024×1536 result actually obtained through an 华烁云 request 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 (recommended by default), gpt-image-2.5-flare (faster), or gpt-image-2.5-sunburst (higher fidelity and control); all three can use their corresponding :official variants, while gpt-image-2 also supports :reverse |
prompt |
Image description, up to 32,000 characters |
size |
auto or WIDTHxHEIGHT; width and height must be multiples of 16, the longest side must not exceed 3840, total pixels must be 655,360–8,294,400, and the aspect ratio must not exceed 3:1 |
n |
1–10; only 1 is supported when response_format=b64_json |
quality |
GPT Image models support auto, low, medium, high; 2.5 / 2.6 Flare / Sunburst (including :official) additionally support xhigh, max. Official channels are billed based on actual Token usage |
response_format |
url or b64_json |
callback_url |
Optional; sends results to this address after a long-running task is completed |
Common sizes:
| Aspect 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" selects the canvas based on the aspect ratio, pixels, and layout intent in the prompt; directly specify the size when precise pixels are required.
¶ Models and Billing Methods
| Model | Applicable Scenarios and Billing Methods |
|---|---|
gpt-image-2 |
Default reverse channel, fixed billing per successfully generated image |
gpt-image-2:reverse |
Explicitly selects the reverse channel, fixed billing per successfully generated image |
gpt-image-2:official |
Official API channel, with higher stability, billed based on actual Token usage |
gpt-image-2.5-flare |
Focuses on generation speed, fixed billing per successfully generated image |
gpt-image-2.6-flare |
Focuses on generation speed, fixed billing per successfully generated image |
gpt-image-2.5-flare:reverse |
Explicit reverse alias, equivalent to gpt-image-2.5-flare, fixed billing per successfully generated image |
gpt-image-2.6-flare:reverse |
Explicit reverse alias, equivalent to gpt-image-2.6-flare, fixed billing per successfully generated image |
gpt-image-2.5-flare:official |
Official API channel, with higher stability and a focus on generation speed, billed based on actual Token usage |
gpt-image-2.6-flare:official |
Official API channel, with higher stability and a focus on generation speed, billed based on actual Token usage |
gpt-image-2.5-sunburst |
Focuses on high fidelity and fine-grained control, fixed billing per successfully generated image |
gpt-image-2.6-sunburst |
Focuses on high fidelity and fine-grained control, fixed billing per successfully generated image |
gpt-image-2.5-sunburst:reverse |
Explicit reverse alias, equivalent to gpt-image-2.5-sunburst, fixed billing per successfully generated image |
gpt-image-2.6-sunburst:reverse |
Explicit reverse alias, equivalent to gpt-image-2.6-sunburst, fixed billing per successfully generated image |
gpt-image-2.5-sunburst:official |
Official API channel, with higher stability and a focus on high fidelity and fine-grained control, billed based on actual Token usage |
gpt-image-2.6-sunburst:official |
Official API channel, with higher stability and a focus on high fidelity and fine-grained control, billed based on actual Token usage |
2.0 / 2.5 reverse models (including :reverse aliases) may use GPT Image 2.5 Flare to complete requests during automatic recovery; the requested model and fixed billing method per successfully generated image remain unchanged.
The page prices for official API channels are estimates before the request; the final amount is based on the actual Token usage and usage records in the response.
¶ 4. Multiple Image Generation
curl https://hsyunapi.hszl-bd.cn/openai/images/generations \
-H "Authorization: Bearer 你的 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 their :reverse aliases are billed by the number of successful images; gpt-image-2:official, gpt-image-2.5-flare:official, and gpt-image-2.5-sunburst:official are charged based on the actual input text and output image Tokens in the response. The page price is an estimate before the request; the final amount is subject to the usage record.
¶ 5. Asynchronous Callback
After adding callback_url to the request body, the API will first return {"task_id": "..."} and POST the final result to that URL upon completion; synchronous requests 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 | model, prompt, size format, n, and the response_format combination |
| 401 | Whether the API Key is complete, and whether the Header is Authorization: Bearer ... |
| 429 | Requests are too frequent; retry later |
| 504 | Synchronous generation timed out; use callback_url |
Error responses include error.code, error.message, and trace_id. Provide trace_id when reporting issues; do not provide the API Key.
For complete fields and real-time enumerations, refer to the OpenAI Images Generations API page. For image editing, see GPT Image 2 / 2.5 / 2.6 Image Editing.
¶ GPT Image 2.6
GPT Image 2.6 uses the generation, editing, asynchronous task, and billing APIs from 2.5:
| Model | Billing |
|---|---|
gpt-image-2.6-flare / gpt-image-2.6-flare:reverse |
0.22 Credits/image |
gpt-image-2.6-sunburst / gpt-image-2.6-sunburst:reverse |
0.22 Credits/image |
gpt-image-2.6-flare:official |
Same as 2.5 official, billed by actual Token usage |
gpt-image-2.6-sunburst:official |
Same as 2.5 official, billed by actual Token usage |
Available quality options are auto, low, medium, high, xhigh, and max; for size, use auto or a WIDTHxHEIGHT that complies with the above constraints. This API supports png, jpeg, and webp; GPT Image 2.6 additionally supports native gif animations, while SVG is not currently supported. Editing supports JSON image URLs and multipart file uploads. :reverse is an explicit alias of the regular version with the same name. Please use the full model name; do not pass gpt-image-2.6.
¶ GPT Image 2.6 GIF Animations
The regular, :reverse, and :official versions of GPT Image 2.6 Flare and Sunburst can all use output_format: "gif". Animation frames, loop information, and playback duration will be preserved; frame_count indicates the number of frames, frame_duration_ms indicates the milliseconds per frame, the frame count must be an integer from 2–16, the duration per frame must be an integer from 20–655350 milliseconds, and both are for GIF only; encoding is rounded to the nearest 10ms. When unspecified, the default is 9 frames at 200 milliseconds per frame; when the GIF size is omitted or is auto, the 512x512 preset is used.
It is recommended to first use size: "512x512", frame_count: 9, frame_duration_ms: 200. GIFs have independent size and frame count limits, and static 4K specifications cannot be applied directly; some models will adjust the actual output size. n indicates the number of GIF files returned, not the number of animation frames. The regular version and :reverse are still billed by the number of successful files, while the official version is billed by actual Token usage.
{
"model": "gpt-image-2.6-flare",
"prompt": "A small red ball moves left and right on a white background, seamless looping animation, no text.",
"output_format": "gif",
"size": "512x512",
"quality": "medium",
"frame_count": 9,
"frame_duration_ms": 200,
"n": 1,
"async": true
}
¶ GPT Image 2.6 4K Static Images
Flare, Sunburst, and their :reverse and :official variants can all use the aforementioned 4K pixel presets, such as 3840x2160 and 2160x3840. For both generation and editing, pass specific pixels through size; 4K is not a valid size value, and 4096x4096 also exceeds the current pixel limit. The above 4K specifications apply to static PNG/JPEG/WebP; for GIFs, use their dedicated parameters.
¶ GPT Image 2.6 Composition Complexity
complexity can be low, medium, or high; when omitted, the model default high is used. It controls planning complexity and is independent of quality rendering quality; it does not incur additional per-request charges, and the official version is still charged by actual Token usage. Other model versions do not support this parameter.
GIF does not support masks, annotation images, custom compression, prompt rewriting, or partial image streaming output; incompatible combinations will be rejected before generation. Size, frame count, and quantity are jointly subject to the model pixel budget limit; 1024x1024 with 2 frames for regular Flare has been verified to work, but this conclusion cannot be extended to all 1K combinations or 4K GIFs.