> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT Image 2.6 API

> OpenAI generation integration guide - Ace Data Cloud

Use GPT Image 2.6 to generate images from text or edit them using reference images. First select a public model, then connect using the same image API.

## Select a Model

| Model | Selection and Access |
| - | - |
| `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 API names; see each model page for variant pricing and supported parameters |

* [Flare](https://platform.acedata.cloud/models/gpt-image-2.6-flare?m=image) · [Flare official](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Aofficial?m=image) · [Flare reverse](https://platform.acedata.cloud/models/gpt-image-2.6-flare%3Areverse?m=image)
* [Sunburst](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst?m=image) · [Sunburst official](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Aofficial?m=image) · [Sunburst reverse](https://platform.acedata.cloud/models/gpt-image-2.6-sunburst%3Areverse?m=image)

## Prepare an Image Generation Request

Open a general-purpose application in the [application list](https://platform.acedata.cloud/console/applications) and click the copy button to the right of **API KEY**. Next, use this key to generate an image. If you use a restricted key, make sure it permits image generation; editing reference images also requires image editing permission.

## Generate Your First Image

```bash theme={null}
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --fail-with-body 'https://api.acedata.cloud/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"
  }'
```

### Response JSON

The following excerpt from an existing Images response shows where the task ID, model, and image URL appear. The model you selected and the image address are determined by the values returned by this request.

```json theme={null}
{
  "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`. To adjust the aspect ratio, quality, or output format, see the [image generation guide](https://platform.acedata.cloud/documents/openai-images-generations-integration). If you select 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.

```bash theme={null}
curl --fail-with-body 'https://api.acedata.cloud/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"
  }'
```

### Response JSON

The following excerpt from an existing Images response shows where the task ID, model, and image URL appear. The model you selected and the image address are determined by the values returned by this request.

```json theme={null}
{
  "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](https://platform.acedata.cloud/documents/openai-images-edits-integration) for input requirements for multiple images, masks, sizes, and formats.

## Long-Running Tasks and Error Recovery

When you need an asynchronous approach, set `async=true` according to the image API documentation and save the returned task ID. Use [OpenAI task query](https://platform.acedata.cloud/documents/openai-tasks-integration) to obtain the final result of the original task and avoid submitting it again while waiting. Handle authentication, balance, and parameter errors according to the `error` in the response, and retain the `trace_id` for troubleshooting.

See [OpenAIAPI](https://github.com/AceDataCloud/OpenAIAPI) for complete call examples and access to more capabilities.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.