GPT Image 2.6 API
Use GPT Image 2.6 to generate images from text or edit images based on reference images. First select a publicly available model, then integrate using the same set of image APIs.
¶ Choose a Model
| Model | Selection and Invocation |
|---|---|
gpt-image-2.6-flare |
Flare model; see the corresponding model page for capabilities, pricing, and minimum request requirements |
gpt-image-2.6-sunburst |
Sunburst model; see the corresponding model page for capabilities, pricing, and minimum request requirements |
:official and :reverse variants |
Model ID suffixes are part of the public invocation names; see each model page for variant pricing and supported parameters |
¶ Prepare an Image Generation Request
Open the general-purpose application in the application list (initialize it first if this is your first time using it), and click the copy button to the right of API KEY. Next, use this key to generate an image. When using a restricted key, make sure it permits image generation; editing reference images also requires image editing permission.
¶ Generate Your First Image
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --fail-with-body 'https://api.yxai-tech.top/openai/images/generations' \
--header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-flare",
"prompt": "A white ceramic coffee mug on a blue table, soft morning light, no text.",
"size": "1024x1024",
"n": 1,
"response_format": "url"
}'
¶ JSON Response
The following excerpt from an existing Images response shows where the task identifier, model, and image URL appear. The model you selected and the image address are determined by the values returned by this request.
{
"success": true,
"task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
"trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
"created": 1788831893,
"data": [
{
"url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
}
]
}
After the synchronous response is returned, read the generated image from data[].url. If you need to adjust the aspect ratio, quality, or output format, see the image generation guide. When selecting the b64_json response format, decode the corresponding result according to the guide.
¶ Edit a Reference Image
Replace YOUR_IMAGE_URL with an accessible reference image URL, then describe what you want to change.
curl --fail-with-body 'https://api.yxai-tech.top/openai/images/edits' \
--header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-flare",
"image": "YOUR_IMAGE_URL",
"prompt": "Change the mug to dark green and keep the composition.",
"n": 1,
"response_format": "url"
}'
¶ JSON Response
The following excerpt from an existing Images response shows where the task identifier, model, and image URL appear. The model you selected and the image address are determined by the values returned by this request.
{
"success": true,
"task_id": "49848451-c624-4df9-9dc2-494018daaf4c",
"trace_id": "5ac021c2-2891-4eed-bfcf-4c6668ac1be1",
"created": 1788831893,
"data": [
{
"url": "https://cdn.acedata.cloud/assets/examples/gpt-image/49848451-c624-4df9-9dc2-494018daaf4c_0-b6d780a732ca.png"
}
]
}
The edited image is also read from data[].url. See the image editing guide for input requirements for multiple images, masks, sizes, and formats.
¶ Long-Running Tasks and Error Recovery
When an asynchronous approach is needed, set async=true according to the image API documentation and save the returned task identifier. Use OpenAI task query to obtain the final result of the original task and avoid resubmitting while waiting. Handle authentication, balance, and parameter errors according to the error in the response, and retain the trace_id for troubleshooting.
See OpenAIAPI for complete invocation examples and access to more capabilities.

