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

# GPT-Image-2.6 Image Generation

> Generate and edit images asynchronously with Flare and Sunburst, including markup-guided edits, animated GIFs, and SVG output.

Text-to-image, editing, GIF, and SVG requests all use `POST /v1/images/generations`. Read `data[0].task_id` from the submission response, then query the task for file URLs.

```bash cURL theme={null}
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gpt-image-2.6-flare",
  "prompt": "A cozy reading nook by a rainy window, warm lamp light",
  "size": "1:1",
  "resolution": "1k",
  "quality": "medium",
  "n": 1
}'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api.apimart.ai/v1/images/generations",
    headers={"Authorization": "Bearer <token>"},
    json={
        "model": "gpt-image-2.6-flare",
        "prompt": "A cozy reading nook by a rainy window, warm lamp light",
        "size": "1:1",
        "resolution": "1k",
        "quality": "medium",
        "n": 1
    },
)
response.raise_for_status()
print(response.json()["data"][0]["task_id"])
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.apimart.ai/v1/images/generations", {
  method: "POST",
  headers: {
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "gpt-image-2.6-flare",
    "prompt": "A cozy reading nook by a rainy window, warm lamp light",
    "size": "1:1",
    "resolution": "1k",
    "quality": "medium",
    "n": 1
  }),
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result.data[0].task_id);
```

```json 200 theme={null}
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KXXXXXXXXXXXXXXX"
    }
  ]
}
```

## Authentication

**Authorization** `string` *required*

Use Bearer Token authentication. Get a key from the [API Key page](https://apimart.ai/keys).

```text theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Choosing a model

| Model | Use case |
| - | - |
| `gpt-image-2.6-flare` | Faster generation for rapid iteration; the recommended default. |
| `gpt-image-2.6-sunburst` | Prioritizes detail and editing consistency, particularly for multi-turn edits at `medium` / `high` quality. |

Both models have the same token rates and consumption at identical settings. Choose based on speed and detail requirements.

## Request parameters

**model** `string` *required*

Model name: `gpt-image-2.6-flare` or `gpt-image-2.6-sunburst`.

**prompt** `string` *required*

Generation or editing instructions, up to 32,000 characters. Describe the subject, composition, and what to change or preserve.

**size** `string` (default: auto)

Still images and SVG support 15 aspect ratios, exact pixels such as `1600x1200`, or `auto`. Explicit `auto` lets the upstream model choose; omitting this field for editing selects dimensions from the first input image’s aspect ratio and `resolution`. GIF sizes follow separate rules below.

**resolution** `string` (default: 1k)

`1k` / `2k` / `4k`, in lowercase. Combined with an aspect-ratio `size` to determine pixels; ignored when exact pixel dimensions are supplied.

**quality** `string` (default: auto)

`low` / `medium` / `high` / `xhigh` / `max` / `auto`. Other values return HTTP 400 at submission. When omitted or set to `auto`, the model chooses the quality level automatically. The selected level may vary and is not fixed to `low`; specify a level explicitly if you need a fixed setting.

When omitted or set to `auto`, funds are reserved at the `max` quality level and the final charge is settled at the level actually selected.

**n** `integer` (default: 1)

Integer from `1` to `4`; for GIF, this is the number of animations. SVG requires `1`. Explicit `0`, negative values, or values above `4` return HTTP 400 instead of falling back to the default.

**output\_format** `string` (default: png)

`png` / `jpeg` / `webp` / `gif` / `svg`. GIF and SVG support text-to-image only. Other values return HTTP 400 at submission.

**output\_compression** `integer`

Integer from `0` to `100`, for `jpeg` / `webp` only. Out-of-range values or use with `png` / `gif` / `svg` return HTTP 400 at submission.

**background** `string`

`transparent` / `opaque` / `auto`; omitted requests use the upstream default. Explicit `transparent` requires `png` / `webp`. SVG has a transparent background by default; omit this field for SVG.

**moderation** `string` (default: low)

Content moderation level: `auto` / `low`. Other values return HTTP 400 at submission.

**image\_urls** `string[]`

Up to 16 reference images; providing them enables editing. Use publicly accessible HTTP(S) image URLs. For local files, use the [image upload endpoint](https://docs.apimart.ai/en/api-reference/uploads/images.md) first and pass the returned `url`.

**mask\_url** `string`

Inpainting mask, requiring `image_urls`. Use a PNG with an alpha channel matching the first input image’s dimensions; fully transparent regions indicate areas to edit. Accepts an image URL or PNG Data URL. Cannot be combined with markup; unchanged pixels outside the mask are not guaranteed.

**complexity** `string`

Planning level: `low` / `medium` / `high`, with an upstream default of `high`, independent of rendering `quality`. Use `low` for focused edits and `high` for dense text, complex layouts, or object relationships; higher planning may be slower or introduce extra changes. No separate fee; supported only by 2.6.

**safety\_identifier** `string`

Optional stable end-user identifier, up to 128 characters; a hash of a username or email is recommended. APIMart does not forward it upstream by default, only when the channel permits it. Omitting it does not affect usage.

## Still image and SVG sizes

Exact pixel dimensions must be multiples of 16 on both axes, with each edge at most 3840, a longest-to-shortest edge ratio at most 3:1, and 655,360–8,294,400 total pixels. Resolutions above 2560×1440 are experimental. The mappings below match GPT-Image-2.5; do not apply these still-image limits directly to individual GIF frames.

| `size` | `1k` | `2k` | `4k` |
| - | - | - | - |
| `1:1` | 1024×1024 | 2048×2048 | 2880×2880 |
| `3:2` | 1536×1024 | 2048×1360 | 3520×2336 |
| `2:3` | 1024×1536 | 1360×2048 | 2336×3520 |
| `4:3` | 1024×768 | 2048×1536 | 3312×2480 |
| `3:4` | 768×1024 | 1536×2048 | 2480×3312 |
| `5:4` | 1280×1024 | 2560×2048 | 3216×2576 |
| `4:5` | 1024×1280 | 2048×2560 | 2576×3216 |
| `16:9` | 1536×864 | 2048×1152 | 3840×2160 |
| `9:16` | 864×1536 | 1152×2048 | 2160×3840 |
| `2:1` | 2048×1024 | 2688×1344 | 3840×1920 |
| `1:2` | 1024×2048 | 1344×2688 | 1920×3840 |
| `21:9` | 2016×864 | 2688×1152 | 3840×1648 |
| `9:21` | 864×2016 | 1152×2688 | 1648×3840 |
| `3:1` | 1536×512 | 3072×1024 | 3840×1280 |
| `1:3` | 512×1536 | 1024×3072 | 1280×3840 |

## Image editing and masks

This request edits a region of the first image. Omit `mask_url` to edit the whole image according to the prompt; omit `size` to derive output dimensions from the first image’s aspect ratio and `resolution`. Replace example image URLs with accessible files.

```json theme={null}
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "Replace the fully transparent masked area with a gold ribbon. Preserve the product and the rest of the background.",
  "image_urls": [
    "https://example.com/product.png"
  ],
  "mask_url": "https://example.com/product-mask.png",
  "resolution": "2k",
  "quality": "high",
  "complexity": "low"
}
```

## Markup-guided editing

Provide `markup_url` as an HTTPS or Base64 Data URL. The alias `markup` accepts a string or an `{"image_url":"..."}` object. `file_id` is not supported.

* Include `image_urls`; markup applies to the first image, with any others used as references.
* Use a separate transparent PNG overlay with exactly the same dimensions as the first image. Do not flatten annotations into the original image.
* The first image and overlay must each contain at most 16,777,216 pixels; the overlay file must be at most 50 MB.
* Do not combine with `mask_url`. The overlay incurs no image tokens, but the request may still incur additional text tokens.

```json theme={null}
{
  "model": "gpt-image-2.6-flare",
  "prompt": "Recolor the striped vase inside the red circle to solid cobalt blue ceramic. Keep everything else unchanged. Remove the red circle.",
  "image_urls": [
    "https://example.com/kitchen.webp"
  ],
  "markup_url": "https://example.com/vase-circle-overlay.png",
  "quality": "medium"
}
```

## Animated GIF output

Set `output_format: "gif"`. Text-to-image only: do not include `image_urls`, `mask_url`, `markup_url`, `markup`, or `output_compression`.

| Parameter | Default | Description |
| - | - | - |
| `frame_count` | `9` | Integer **2–16**. APIMart currently caps this at 16, rather than the 64-frame limit in the upstream guide. |
| `frame_duration_ms` | `200` | Duration per frame in integer milliseconds, at least 20, rounded to 10 ms increments. |
| `size` | `auto` | Pixel dimensions of **each frame**, both multiples of 16. Omitted or `auto` currently gives 512×512. Aspect-ratio names such as `1:1` are not supported. |

The upstream model arranges frames on a sheet: 4×2 for 2–8 frames, 3×3 for 9, 4×3 for 10–12, and 4×4 for 13–16. Rows and columns may be swapped to make the sheet closer to square. The whole sheet must have edges at most 3840, at most 8,294,400 pixels, and an aspect ratio at most 3:1; otherwise submission returns 400.

> [!WARNING]
>
> `512x512` supports all 2–16 frames; `768x768` supports at most 12. Even 2 frames at `1024x1024` exceed the sheet’s edge limit. Billing uses the whole sheet for each animation; `n > 1` generates and bills multiple animations.

```json theme={null}
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "A paper lantern swaying gently in the night breeze, seamless loop",
  "output_format": "gif",
  "frame_count": 9,
  "frame_duration_ms": 200,
  "quality": "low"
}
```

## SVG output

**svg** `object`

Set `output_format: "svg"`. The image model first generates a reference image, then the text model specified in `svg.model` authors the SVG.

**svg**

**model** `string` *required*

Required. Choose a model with text token pricing on the platform, such as `gpt-5.4-mini` or `gpt-5.6-sol`.

**reasoning** `object`

**reasoning**

**effort** `string`

Optional: `none` / `minimal` / `low` / `medium` / `high` / `xhigh` / `max`. Supported values depend on the text model; omitting this field to use the model default is recommended.

* Text-to-image only, with `n` equal to 1. Do not provide reference images, masks, markup, or `output_compression`.
* `quality` and `complexity` apply to the intermediate reference image. Output is a static `.svg` without scripts, external resources, or embedded bitmaps.
* Text usage for `svg.model` is charged in addition to image generation. Accounts with fixed per-image pricing do not currently support SVG; submission returns 400.

```json theme={null}
{
  "model": "gpt-image-2.6-flare",
  "prompt": "A minimalist bakery logo with a wheat stalk, flat colors",
  "output_format": "svg",
  "svg": {
    "model": "gpt-5.4-mini"
  },
  "size": "1:1",
  "quality": "low",
  "n": 1
}
```

## Querying task results

Use the [task status endpoint](https://docs.apimart.ai/en/api-reference/tasks/status.md), polling every 2–5 seconds until `completed` or `failed`. Do not resubmit generation requests while waiting.

```bash theme={null}
curl --request GET \
  --url https://api.apimart.ai/v1/tasks/task_01KXXXXXXXXXXXXXXX \
  --header 'Authorization: Bearer <token>'
```

On completion, read file URLs from `data.result.images[].url[]` and download them promptly. Only key response fields are shown below; on `failed`, inspect `data.error.message`. Use `POST /v1/tasks/batch` to query multiple tasks.

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KXXXXXXXXXXXXXXX",
    "status": "completed",
    "progress": 100,
    "result": {
      "images": [
        {
          "url": [
            "https://upload.apimart.ai/f/image/example.png"
          ]
        }
      ]
    }
  }
}
```

### SVG usage and response example

In task query responses, `data.usage.svg_usage` reports usage for the text model that authors the SVG. Other token fields in `data.usage` report usage for the image model that generates the reference image. Account for each part using its corresponding model’s billing rules.

| Field | Type | Description |
| - | - | - |
| `model` | string | Text model actually used to author the SVG. |
| `input_tokens` | integer | Input tokens used by the text model. |
| `output_tokens` | integer | Output tokens used by the text model, including reasoning tokens. |
| `reasoning_tokens` | integer | The reasoning portion of output tokens; do not add it to `output_tokens` again. |

The following shows key fields of an SVG task response. Token values illustrate field relationships and are not fixed consumption estimates.

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KXXXXXXXXXXXXXXX",
    "status": "completed",
    "progress": 100,
    "result": {
      "images": [
        {
          "url": [
            "https://upload.apimart.ai/f/image/example.svg"
          ]
        }
      ]
    },
    "usage": {
      "input_tokens": 40,
      "output_tokens": 1800,
      "total_tokens": 1840,
      "svg_usage": {
        "model": "gpt-5.4-mini",
        "input_tokens": 1200,
        "output_tokens": 800,
        "reasoning_tokens": 200
      }
    }
  }
}
```

## Common parameter errors

The following parameter validation errors return HTTP 400 synchronously at submission. No task is created and no charge is made. Correct the parameters before submitting again.

| Error | Resolution |
| - | - |
| `quality "ultra" is not supported by gpt-image-2.6-flare` | Use `low` / `medium` / `high` / `xhigh` / `max` / `auto`; other values such as `ultra` are not supported. |
| `` `n` must be an integer from 1 to 4 `` | Set `n` to an integer from 1 to 4; `0`, negative values, and values above 4 are invalid. |
| `output_compression must be an integer from 0 to 100` | Set `output_compression` to an integer from 0 to 100. |
| `output_compression is only supported with output_format jpeg or webp` | Use compression only with JPEG / WebP; remove the parameter for PNG / GIF / SVG. |
| `moderation "xxx" is not supported` | Set `moderation` to `low` or `auto`. |
| `markup requires image_urls` | Include `image_urls` and ensure the overlay matches the first image. |
| `markup cannot be combined with mask` | Choose either markup or a mask. |
| `frame_count must be an integer from 2 to 16` | Set `frame_count` to an integer from 2 to 16. |
| `no supported sheet fits N GIF frames at size WxH` | Reduce frame dimensions or frame count; do not use aspect-ratio names. |
| `output_format=svg requires svg.model` | Include a `svg` object with a supported text model. |
| `output_format=svg requires n=1` | Set `n: 1` for SVG. |
| `background=transparent requires an alpha-capable output_format` | Explicit transparent backgrounds require PNG / WebP; omit this field for SVG. |

## Unsupported parameters and billing

Do not send `stream`, `partial_images`, `input_fidelity`, `prompt_rewriter`, or `response_format`. This endpoint returns asynchronous tasks and CDN file URLs, not streamed partial images or Base64 image responses. `frame_count` / `frame_duration_ms` are GIF-only; the `svg` configuration is SVG-only.

Flare and Sunburst use the same pricing. GPT-Image-2.6 consumes more tokens at `low` / `medium` than 2.5, so do not reuse older cost estimates unchanged. Current rates are available on the [APIMart pricing page](https://apimart.ai/pricing) or through `/api/pricing`; this page lists no fixed prices.

See the [OpenAI image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for upstream feature descriptions. For APIMart requests, use the endpoints, asynchronous responses, and limits documented here.


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