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

# GPT Image 2.6

> Generate and edit images with gpt-image-2.6-sunburst and gpt-image-2.6-flare through the AnyFast Image API.

Use one GPT Image 2.6 model ID with the generation or editing endpoint. GPT Image 2.6 adds complexity control for image planning; the direct AnyFast examples below use fields supported by the current endpoint.

| Model ID | Recommended use |
| - | - |
| `gpt-image-2.6-flare` | Default choice for fast, high-quality generation and everyday editing |
| `gpt-image-2.6-sunburst` | Detailed creative work and edits that require tighter preservation and control |

> [!NOTE]
>
> GPT Image 2.6 returns Base64-encoded image data in `data[].b64_json`. Responses also include `data[].revised_prompt` and token `usage` accounting. Do not send the DALL·E-only `response_format` parameter.

> [tab] Generate images
>
> ## Generate images
>
> `POST /v1/images/generations`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/images/generations \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-image-2.6-flare",
>     "prompt": "A clean editorial product photograph of a translucent green glass bottle on pale stone, soft morning light",
>     "size": "1536x1024",
>     "quality": "high",
>     "complexity": "medium",
>     "background": "opaque",
>     "output_format": "jpeg",
>     "output_compression": 85,
>     "moderation": "auto",
>     "safety_identifier": "user-123",
>     "n": 1
>   }'
> ```
>
> ## Request headers
>
> **Authorization** `string` *required*
>
> Bearer authentication in the form `Bearer YOUR_API_KEY`.
>
> **Content-Type** `string` *required* (default: application/json)
>
> Data exchange format.
>
> ## Request body
>
> **model** `string` *required*
>
> Model ID: `gpt-image-2.6-sunburst` or `gpt-image-2.6-flare`.
>
> **prompt** `string` *required*
>
> Text description of the image to generate. Length: `1`–`32,000` characters.
>
> **n** `integer` (default: 1)
>
> Number of images to generate. Supported range: `1`–`10`.
>
> **size** `string` (default: auto)
>
> `auto` or a custom `WIDTHxHEIGHT` value. Width and height must be multiples of 16, the aspect ratio must be between 1:3 and 3:1, neither edge may exceed 3,840 pixels, and total pixels must be between 655,360 and 8,294,400.
>
> **quality** `string` (default: auto)
>
> Rendering quality: `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
>
> **complexity** `string` (default: high)
>
> Planning effort: `low`, `medium`, or `high`. Higher complexity can help with dense text and complex layouts but may increase latency.
>
> **background** `string` (default: auto)
>
> Background mode: `auto`, `opaque`, or `transparent`. Transparent backgrounds require PNG or WebP output.
>
> **output\_format** `string` (default: png)
>
> Output format: `png`, `jpeg`, `webp`, or `gif`. GIF generation also requires `frame_count` and `frame_duration_ms`.
>
> **frame\_count** `integer` (default: 9)
>
> Number of GIF frames, from `2` through `16`. The requested size and frame count must fit the total pixel budget.
>
> **frame\_duration\_ms** `integer` (default: 200)
>
> GIF frame duration from `20` through `2,000` milliseconds, rounded to 10 milliseconds.
>
> **output\_compression** `integer` (default: 100)
>
> JPEG or WebP compression level from `0` through `100`. Ignored for PNG output.
>
> **moderation** `string` (default: auto)
>
> Moderation strictness: `auto` or `low`.
>
> **safety\_identifier** `string`
>
> Optional stable, privacy-preserving identifier for the end user. Keep it at 128 characters or fewer.
>
> ## Generation response
>
> ```json 200 theme={null}
> {
>   "created": 1788926400,
>   "background": "opaque",
>   "data": [
>     {
>       "b64_json": "iVBORw0KGgoAAA...",
>       "revised_prompt": "A clean editorial product photograph ..."
>     }
>   ],
>   "output_format": "jpeg",
>   "quality": "high",
>   "size": "1536x1024",
>   "usage": {
>     "input_tokens": 18,
>     "input_tokens_details": {"text_tokens": 18, "image_tokens": 0},
>     "output_tokens": 824,
>     "output_tokens_details": {"text_tokens": 0, "image_tokens": 824},
>     "total_tokens": 842
>   }
> }
> ```
>
> **created** `integer`
>
> Creation time as a Unix timestamp in seconds.
>
> **background** `string`
>
> Resolved background mode: `opaque` or `transparent`.
>
> **data** `object[]`
>
> Generated image results.
>
> **data\[].b64\_json** `string`
>
> Base64-encoded image data.
>
> **data\[].revised\_prompt** `string|null`
>
> The prompt after model-side revision, when returned.
>
> **output\_format** `string`
>
> Returned image format: `png`, `jpeg`, `webp`, or `gif`.
>
> **quality** `string`
>
> Quality level used for the result.
>
> **size** `string`
>
> Resolved output dimensions as `WIDTHxHEIGHT`.
>
> **usage** `object`
>
> Token usage for the request and generated image.
>
> **usage.input\_tokens** `integer`
>
> Input token count.
>
> **usage.input\_tokens\_details** `object`
>
> Breakdown of input tokens.
>
> **usage.input\_tokens\_details.text\_tokens** `integer`
>
> Input text token count.
>
> **usage.input\_tokens\_details.image\_tokens** `integer`
>
> Input image token count.
>
> **usage.output\_tokens** `integer`
>
> Output image token count.
>
> **usage.output\_tokens\_details** `object`
>
> Breakdown of output tokens.
>
> **usage.output\_tokens\_details.text\_tokens** `integer`
>
> Output text token count.
>
> **usage.output\_tokens\_details.image\_tokens** `integer`
>
> Output image token count.
>
> **usage.total\_tokens** `integer`
>
> Total input and output token count.

> [tab] Edit images
>
> ## Edit images
>
> `POST /v1/images/edits`
>
> ```bash JSON image references theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/images/edits \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-image-2.6-sunburst",
>     "images": [
>       {"file_id": "file-example123"},
>       {"image_url": "https://example.com/reference.png"}
>     ],
>     "prompt": "Keep the product unchanged and replace the background with a warm studio gradient",
>     "size": "1536x1024",
>     "quality": "xhigh",
>     "output_format": "png",
>     "n": 1
>   }'
> ```
>
> ```bash Multipart file upload theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/images/edits \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --form 'model=gpt-image-2.6-sunburst' \
>   --form 'image[]=@/path/to/product.png' \
>   --form 'mask=@/path/to/mask.png' \
>   --form 'prompt=Keep the product unchanged and replace the background with a warm studio gradient' \
>   --form 'size=1536x1024' \
>   --form 'quality=xhigh' \
>   --form 'background=opaque' \
>   --form 'output_format=png' \
>   --form 'n=1'
> ```
>
> ## Request headers
>
> **Authorization** `string` *required*
>
> Bearer authentication in the form `Bearer YOUR_API_KEY`.
>
> **Content-Type** `string` *required*
>
> Use `application/json` for image references or `multipart/form-data` for file uploads. Multipart-aware clients set the boundary automatically.
>
> ## Request body
>
> **model** `string` *required*
>
> Model ID: `gpt-image-2.6-sunburst` or `gpt-image-2.6-flare`.
>
> **images** `object[]`
>
> JSON input image references. Provide up to 16 objects. Use one of `file_id` or `image_url` in each object. Do not combine `images` with multipart `image` or `image[]` fields.
>
> **images\[].file\_id** `string`
>
> The File API ID of an uploaded image to use as input.
>
> **images\[].image\_url** `string`
>
> A fully qualified URL or Base64-encoded data URL. Format: `uri`. Maximum length: `20,971,520` characters.
>
> **image** `file`
>
> One source image file. Use `image[]` instead when uploading multiple images. Each source image must be smaller than 50 MB.
>
> **image\[]** `file[]`
>
> Up to 16 source image files. Do not send both `image` and `image[]`.
>
> **mask** `file`
>
> Optional edit mask. It guides the edit rather than defining a guaranteed pixel-exact boundary. It must contain an alpha channel, match the first source image's format and dimensions, and be smaller than 50 MB. With multiple source images, the mask applies to the first image.
>
> **prompt** `string` *required*
>
> Instructions describing the edit. Length: `1`–`32,000` characters.
>
> **n** `integer` (default: 1)
>
> Number of edited images to return. Supported range: `1`–`10`.
>
> **size** `string` (default: auto)
>
> `auto` or a valid custom `WIDTHxHEIGHT` value using the same limits as image generation.
>
> **quality** `string` (default: auto)
>
> Rendering quality: `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
>
> **complexity** `string` (default: high)
>
> Planning effort: `low`, `medium`, or `high`. Higher complexity can help with dense text and complex layouts but may increase latency.
>
> **background** `string` (default: auto)
>
> Background mode: `auto`, `opaque`, or `transparent`. Transparent backgrounds require PNG or WebP output.
>
> **output\_format** `string` (default: png)
>
> Output format: `png`, `jpeg`, or `webp`.
>
> **output\_compression** `integer` (default: 100)
>
> JPEG or WebP compression level from `0` through `100`. Ignored for PNG output.
>
> **moderation** `string` (default: auto)
>
> Moderation strictness: `auto` or `low`.
>
> **safety\_identifier** `string`
>
> Optional stable, privacy-preserving identifier for the end user. Keep it at 128 characters or fewer.
>
> ## Edit response
>
> ```json 200 theme={null}
> {
>   "created": 1788926460,
>   "background": "opaque",
>   "data": [
>     {
>       "b64_json": "iVBORw0KGgoAAA...",
>       "revised_prompt": "A clean editorial product photograph ..."
>     }
>   ],
>   "output_format": "png",
>   "quality": "xhigh",
>   "size": "1536x1024",
>   "usage": {
>     "input_tokens": 18,
>     "input_tokens_details": {"text_tokens": 18, "image_tokens": 0},
>     "output_tokens": 824,
>     "output_tokens_details": {"text_tokens": 0, "image_tokens": 824},
>     "total_tokens": 842
>   }
> }
> ```
>
> **created** `integer`
>
> Creation time as a Unix timestamp in seconds.
>
> **background** `string`
>
> Resolved background mode: `opaque` or `transparent`.
>
> **data** `object[]`
>
> Edited image results.
>
> **data\[].b64\_json** `string`
>
> Base64-encoded edited image data.
>
> **data\[].revised\_prompt** `string|null`
>
> The prompt after model-side revision, when returned.
>
> **output\_format** `string`
>
> Returned image format: `png`, `jpeg`, or `webp`.
>
> **quality** `string`
>
> Quality level used for the result.
>
> **size** `string`
>
> Resolved output dimensions as `WIDTHxHEIGHT`.
>
> **usage** `object`
>
> Token usage for the request and generated image.
>
> **usage.input\_tokens** `integer`
>
> Input token count.
>
> **usage.input\_tokens\_details** `object`
>
> Breakdown of input tokens.
>
> **usage.input\_tokens\_details.text\_tokens** `integer`
>
> Input text token count.
>
> **usage.input\_tokens\_details.image\_tokens** `integer`
>
> Input image token count.
>
> **usage.output\_tokens** `integer`
>
> Output image token count.
>
> **usage.output\_tokens\_details** `object`
>
> Breakdown of output tokens.
>
> **usage.output\_tokens\_details.text\_tokens** `integer`
>
> Output text token count.
>
> **usage.output\_tokens\_details.image\_tokens** `integer`
>
> Output image token count.
>
> **usage.total\_tokens** `integer`
>
> Total input and output token count.

## Request rules

* `background="transparent"` requires `output_format="png"` or `output_format="webp"`.
* Custom width and height must be divisible by 16, use an aspect ratio from `1:3` through `3:1`, keep each edge at or below 3,840 pixels, and contain 655,360–8,294,400 total pixels.
* Resolutions above `2560x1440` are experimental.
* `output_compression` applies only to JPEG and WebP output. GIF does not support compression.
* For GIF output, `1024x1024` exceeds the total pixel budget at the default 9 frames, so use `1024x768`.
* `complexity` accepts `low`, `medium`, or `high`; if omitted, the model uses `high`.
* GPT Image 2.6 returns Base64 image data; URL output through `response_format` is not supported.

See the [OpenAI create image reference](https://developers.openai.com/api/reference/resources/images/methods/generate) and [create image edit reference](https://developers.openai.com/api/reference/resources/images/methods/edit) for the upstream contract.


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