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

# GPT-Image-2.6-All Generation & Editing

> GPT image generation on the ChatGPT web reverse route: gpt-image-2.6-all, $0.025 per image, 10–46 s; native ChatGPT quality up to 1536 (with fingerprint), native GIF, plus SVG output that is currently unreliable on this reverse route and not recommended for production; 2K/4K super-resolution for large-canvas compatibility, transparent background and multi-image edits.

> [!NOTE]
>
> All image APIs are **synchronous**: there is no task ID, so if the client disconnects the result is lost while the request is still billed. Set a generous timeout (600 seconds recommended). See [Image API Best Practices](https://docs.apiyi.com/en/api-capabilities/image-api-best-practices.md).

## Overview

**gpt-image-2.6-all** is APIYI's **GPT image generation model on the ChatGPT web reverse route**, built on Images 2.6. Unlike the older `-all` route, which only accepted a size hint inside the prompt, this route **actually honors `size`, `n`, `background` and `output_format`**, and can return GIF, SVG and multi-image edits — a better fit for production code that needs to pin dimensions, formats and image counts.

The two things this route does best: **GIF and native ChatGPT quality at 1536 and below (with fingerprint)**. SVG does come back as a true vector, but quality is unstable on the current reverse implementation — **not trustworthy, not recommended for production**; see [SVG](#svg) below. 2K/4K is a **super-resolution tier for large-canvas compatibility** — bigger, not necessarily more detailed; for quality, stay around 1.5K.

It uses the standard OpenAI Images API endpoints: `POST /v1/images/generations` for text-to-image and `POST /v1/images/edits` for editing.

* **Price**: **\$0.025 per image**, billed per call; 2K/4K costs the same
* **Speed**: about **10–46 s** (1K 10–22 s, 2K 12–24 s, 4K 15–42 s; tail latency can reach 3 minutes)
* **Quality**: long edge **512–1536 is native** — the most controllable ChatGPT web quality and fingerprint; **2K/4K is super-resolution**, which solves large-canvas size, not necessarily more detail than 1.5K
* **Formats**: PNG / JPEG / GIF / SVG, transparent background and 24-hour URLs; **GIF is native to this route and not available on 2.5-all** — SVG can be returned too, but quality is unstable on the current route (see below)
* **Chinese**: native Chinese prompts; strong text rendering for posters, signage and infographics

> [!NOTE]
>
> Model pricing follows the official price list and may change. The price here is for reference only; the **Model Pricing** tab in the top navigation is authoritative: [Model Pricing](https://docs.apiyi.com/en/models/index.md).

> [card] GIF loops
>
> Native `output_format=gif`; frame count and duration are exact, dimensions are upstream-decided.

> [card] SVG vectors
>
> `output_format=svg` returns a true vector and `viewBox` follows `size`, but quality is unstable on this reverse route — **not recommended for production**.

> [card] Native ChatGPT quality
>
> Up to 1536 keeps the ChatGPT web look and fingerprint — the most controllable quality tier.

> [card] 2K/4K large-canvas compatibility
>
> Super-resolution with exact common sizes; bigger does not mean more detailed.

> [!NOTE]
>
> **How to read 2K/4K**: use it for posters, print and large screens that need a bigger canvas. It is not a sharper 1.5K and is not promised to carry more detail. For stable quality, stay at or below **1536 (around 1.5K)**.

## Quickstart

### Text to image (curl)

```bash theme={null}
curl https://api.apiyi.com/v1/images/generations \
  -H "Authorization: Bearer $APIYI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-all",
    "prompt": "A beige paper-textured autumn reading club poster, vertical Chinese title in the center, hand-drawn maple leaf at the bottom right",
    "size": "1536x1024",
    "response_format": "b64_json"
  }'
```

The default is `b64_json` (raw base64, no `data:` prefix). Pass `"response_format": "url"` for a signed link that expires in about 24 hours; download and re-host it promptly.

### Image editing (Python, multipart)

```python theme={null}
import base64
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["APIYI_API_KEY"],
    base_url="https://api.apiyi.com/v1",
    timeout=600,
)

with open("input.png", "rb") as f:
    result = client.images.edit(
        model="gpt-image-2.6-all",
        image=f,
        prompt="Replace the background with light gray, keep the subject and text",
        size="1536x1024",
    )

image_bytes = base64.b64decode(result.data[0].b64_json)
with open("edited.png", "wb") as f:
    f.write(image_bytes)
```

## Capabilities

| Capability | Support | Notes |
| - | - | - |
| Text to image | ✅ | `/v1/images/generations` |
| Image editing | ✅ | Single image / mask / multiple references via `/v1/images/edits` |
| `size` | ✅ | Native long edge 512–1536; 2K/4K super-resolution |
| Native ChatGPT quality (fingerprint) | ✅ ≤1536 | 2K/4K super-resolution does not promise native detail or fingerprint |
| `n` | ✅ 1–4 | Billed per image; 2K `n=4` returned four images; `n=5`+ returns 400 |
| Output formats | ✅ PNG / JPEG / GIF / SVG | **WebP is not supported** and returns 400 |
| Transparent background | ✅ up to 2K | `background=transparent` + PNG; 4K is unstable |
| GIF | ✅ | `output_format=gif` is required; `size` is not honored |
| SVG | ⚠️ Available, unstable | 2K–8K, `viewBox` follows `size`; not recommended for production on this route |
| URL response | ✅ | `response_format=url` works in the Default group |
| Response `size` | ✅ b64 / ⚠️ url | b64 echoes actual dimensions; url may omit |
| Large squares | ✅ ≤2880 | Above 2880 returns 502 `size_not_deliverable` |
| `quality` | ✅ auto/medium/high | `low` / `hd` return 400; do not rely on visual differences |
| mask | ⚠️ Accepted | Does not guarantee edits stay inside the mask; describe the target area |

## Sizes

### Native range (≤1536, ChatGPT web native)

| Aspect | Common `size` values |
| - | - |
| 1:1 | 512x512, 768x768, 896x896, 1000x1000, 1024x1024, 1536x1536 |
| 4:3 / 3:4 | 1024x768, 1536x1152, 768x1024, 1152x1536 |
| 3:2 / 2:3 | 1024x683, 1536x1024, 683x1024, 1024x1536 |
| 16:9 / 9:16 | 1280x720, 1536x864, 720x1280, 864x1536 |
| 3:1 / 1:3 | 1536x512, 512x1536 |
| Non-standard | Any integer with long edge 512–1536 and aspect ratio ≤3:1, returned exactly |

* No 16/64 alignment required. `1537`, `1600x900` and `1920x1080` are rejected on the native route.
* `size=auto` is decided upstream. We have seen 1312x1199, 1402x1122 and 1448x1086; **no fixed value is promised**.
* On the native route, the response `size` equals the actual output size.

### Super-resolution range (2K / 4K, large-canvas compatibility)

2K/4K uses super-resolution to enlarge the long edge to 2048/4096 for larger canvases. **Bigger does not mean more detailed** — it is not native pixels, and it is not promised to be sharper than the 1536 native tier. Measured results:

| Requested `size` | Actual output | Notes |
| - | - | - |
| 2048x2048 | 2048x2048 | 2K square |
| 2048x1152 | 2048x1152 | 16:9 |
| 2048x1536 | 2048x1536 | 4:3 |
| 1920x1080 | 1920x1080 | Exact |
| 1600x900 / 3000x2000 | Exact | — |
| 2000x2000 / 1792x1024 / 1024x1792 | Exact | — |
| 3840x2160 | 200 exact; **502** on mismatch | 4K 16:9; retry or use a supported size |
| 2880x2880 | 2880x2880 | Square cap; request it directly |
| 4096x4096 / 3840x3840 / 3200x3200 | **502** `size_not_deliverable` | Upstream 2880; request 2880x2880 |
| 1152x2048 | 200 exact; **502** on mismatch | Upstream occasionally 1365x2048; no silent snap |
| 4096x1024 | **400** | Wider than 3:1; rejected |
| 3840x2160 + transparent | 200 exact / **502** | Upstream occasionally a 4096 long edge; keep transparency ≤2K |

> [!WARNING]
>
> 2K/4K b64 responses echo `size`; `url` responses may omit it. A size mismatch returns **502 `size_not_deliverable`** instead of silently changing dimensions. **Use the response `size` and the actual image dimensions.**

### Choosing a size

* **Best ChatGPT-native feel / stable quality**: keep `size` at or below **1536**; around 1.5K is ideal. This is the most controllable tier, with the ChatGPT fingerprint.
* **2K large-canvas compatibility**: use `2048x2048`, `2048x1152`, `2048x1536`; common sizes are exact, but do not expect more detail than 1.5K.
* **4K landscape**: use `3840x2160`; usually exact, 502 on mismatch — retry or use a supported size.
* **Large squares**: request **2880x2880** directly; `4096x4096` / `3840x3840` / `3200x3200` return 502.
* **4K transparency**: may return 200 exact or 502; keep transparency at or below 2K.
* **4:1 banners**: not supported; `4096x1024` returns 400.

## Formats

| Format | Request | Notes |
| - | - | - |
| PNG | Default | Transparent background supported; lossless |
| JPEG | `output_format=jpeg` | Smaller files; transparent background fails |
| GIF | `output_format=gif` | Frame parameters required; output size is decided upstream |
| SVG | `output_format=svg` | True vector; `viewBox` follows `size`; **currently unstable, not recommended for production** |
| WebP | ❌ | Returns 400; do not send it |

* **Transparent background**: `background=transparent` + PNG. At 2K the result is RGBA with about 40% fully transparent pixels. **4K transparent output does not follow `size`; no dimensions are promised.**
* **URL**: `response_format=url` works in the `Default` group; no `Image2_OSS` group is needed. The link is a 24-hour signed URL.
* **No WebP**: the error is `output_format 'webp' is not supported; use png, jpeg, gif or svg`.

## GIF

```bash theme={null}
curl https://api.apiyi.com/v1/images/generations \
  -H "Authorization: Bearer $APIYI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-all",
    "prompt": "A looping animation of a yellow doll frowning, puffing its cheeks and stomping, pure white background, seamless loop",
    "size": "2048x2048",
    "output_format": "gif",
    "frame_count": 8,
    "frame_duration_ms": 150
  }'
```

* **`output_format=gif` is mandatory**. If you only ask for a loop in the prompt and omit the format, the compatibility layer expects PNG and the request fails with 502 `image 1 is gif, png was asked for`.
* `frame_count` / `frame_duration_ms` are honored exactly: 8 frames / 150 ms, 4 frames / 300 ms and 6 frames / 120 ms all matched the request.
* **`size` does not determine the output size**: 1K results have included 384x512, 507x506 and 619x623; 2K returned 327x585; 4K returned 621x621. **Only frame count and duration are promised.**
* To get a fixed GIF size, resize or crop on the client after generation.

## SVG

> [!WARNING]
>
> **On the current reverse-engineered route, SVG output is not trustworthy and is not recommended for production.** SVG comes straight from the image model without a writer model (`svg.model` is accepted but ignored), and measured quality falls short. For production SVG, use official-relay `gpt-image-2.6-sunburst` / `gpt-image-2.6-flare` with the write-code path — see the [test notes](https://docs.apiyi.com/en/live/2026-11/gpt-image-2-6-all-svg-quality).

```bash theme={null}
curl https://api.apiyi.com/v1/images/generations \
  -H "Authorization: Bearer $APIYI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-all",
    "prompt": "A flat rocket icon, exactly three colors, no text",
    "size": "2048x2048",
    "output_format": "svg"
  }'
```

* **True vector**: the response is `<svg>` text, not a bitmap. 2048², 3840x2160, 4096², 6144² and 8192² all passed.
* **`viewBox` follows `size`**: 2048x2048 gives `viewBox="0 0 2048 2048"`; 3840x2160 gives `viewBox="0 0 3840 2160"`.
* **No `svg` object needed**: `output_format=svg` is enough. Official routes or some SDKs add `"svg": {"model": "..."}`; 2.6-all **accepts but ignores** that field — it does not fail and does not change the result, so do not depend on it.
* The output contains no `<script>` or embedded raster image.

## Sample Results

These three images were generated with `gpt-image-2.6-all` and show its PNG, GIF, and SVG output formats. The simple shapes are format demonstrations only; they are not a guarantee of results for more complex artwork, animation, or vector design.

**PNG · Static image** (1536 × 1024): a red square shape on a white canvas.

![GPT-Image-2.6-All PNG sample: a red square shape on a white canvas](https://mintcdn.com/apiyillc/T5jQzBS6HI2haOGz/images/gpt-image-2-6-all-format-png-20261112.png?fit=max\&auto=format\&n=T5jQzBS6HI2haOGz\&q=85\&s=833ba176ad8c0145a7b6d1488ca01630)

**GIF · Animated image** (887 × 887): a red ball on a white background; the file contains 2 frames at about 100 ms per frame.

![GPT-Image-2.6-All GIF sample: an animated red ball on a white background](https://mintcdn.com/apiyillc/T5jQzBS6HI2haOGz/images/gpt-image-2-6-all-format-gif-20261112.gif?s=20c11ede4b6e9a02e5e7f74a439c890b)

**SVG · Vector image** (`viewBox` 1024 × 1024): a red circle on a white canvas, drawn with SVG vector elements.

![GPT-Image-2.6-All SVG sample: a red circle on a white canvas, rendered as vector elements](https://mintcdn.com/apiyillc/T5jQzBS6HI2haOGz/images/gpt-image-2-6-all-format-svg-20261112.svg?fit=max\&auto=format\&n=T5jQzBS6HI2haOGz\&q=85\&s=afd9c8bf14e9cb20062c0a2c9cdfd5c9)

## Image editing

* **Endpoint**: `POST /v1/images/edits`, `multipart/form-data`.
* **Single image / mask / multiple references** are accepted. A mask is treated as a reference; **edits are not guaranteed to stay inside the mask**, so describe what to change and what to keep.
* **An explicit `size` is exact**, including 2K/4K (2048x2048 and 3840x2160 both verified).
* **Without `size` or with `auto`**, the output is normalized to about **1.57 MP** while preserving the input aspect ratio; the original pixel size is not guaranteed.
* Two reference images work in practice. For more, compose them on the client or edit in steps.

## `n` and responses

* `n` supports **1–4** and is billed per image. At 2K, `n=2` returned two 2048x2048 images, `n=3` three (8160 output tokens) and `n=4` four (10880); `n=5`+ returns 400 `n must be an integer between 1 and 4`. At \$0.025 per image, n=3 is \$0.075 and n=4 is \$0.10; the final charge is whatever the bill shows.
* The default is `b64_json`; `response_format=url` returns only `url`, never both.
* Common response fields: `created`, `data[]`, `usage`. **b64 responses echo `size`; `url` responses may omit it** — read the actual dimensions.
* URLs are signed for 24 hours; regenerate after expiry.

## Timeouts and concurrency

* **Set the client timeout to 600 seconds**: 1K takes about 10–22 s, 2K 12–24 s, 4K 15–42 s, and tail latency can reach 3 minutes (`1000x1000` measured 198 s). Loosen reverse proxies, serverless limits and queue consumers as well.
* **Concurrency**: at 1K, 12×2, 16×1 and 8×1536 all passed without 429s. 2K/4K has not been load-tested; start with 4–8 concurrent requests and watch tail latency.
* **Billing is synchronous**: the request is billed when sent; a client disconnect is not refunded and the result is not retained.

## Limits

* **2K/4K is super-resolution, for large-canvas compatibility.** It is not native pixels and is not promised to carry more detail than the 1536 native tier; for stable quality, stay at or below 1536.
* **2K/4K depends on a fallback route.** Requests first hit the native route and are switched to the super-resolution route when the size is out of range. If the fallback is unavailable, the API may return 400 `wide_fallback_required`; retry or stay at or below 1536.
* **GIF size is not guaranteed.** 1K, 2K and 4K can all return small images; only frame count and duration are promised.
* **WebP is not supported.** Only PNG / JPEG / GIF / SVG.
* **4:1 is not supported.** `4096x1024` returns 400; the maximum aspect ratio is 3:1.
* **4K transparency is unstable.** It may return 200 exact or 502 when upstream returns a 4096 long edge; keep transparency at or below 2K.
* **`quality` only accepts `auto` / `medium` / `high`.** `low` / `hd` return 400; `medium` / `high` return 2048x2048; no same-seed quality difference has been verified.
* **Editing with `auto` rescales.** The output is about 1.57 MP, not the input size.
* **Content policy**: upstream moderation returns 400 `content_policy_violation`; revise the prompt and retry.

## Errors

| HTTP | `code` | Meaning | Action |
| - | - | - | - |
| 400 | `invalid_request_error` | Invalid parameter (size format, aspect ratio, format) | Fix the parameter |
| 400 | `wide_fallback_required` | 2K/4K fallback temporarily unavailable | Retry, or use a size at or below 1536 |
| 400 | `content_policy_violation` | Content moderation rejection | Revise the prompt |
| 400 | `quality ... is not supported by this route` | quality only supports auto/medium/high | Change quality |
| 400 | `n must be an integer between 1 and 4` | n out of range | Use 1–4 |
| 401 | `invalid_api_key` | Wrong key or group | Check `APIYI_API_KEY` and the Default group |
| 429 | `rate_limit_exceeded` | Rate or quota limit | Back off and retry |
| 502 | `image 1 is gif, png was asked for` | GIF requested without `output_format=gif` | Send `output_format=gif` explicitly |

## Let an AI agent wire it up

**Copy this prompt into Codex / Claude Code / Cursor**

It first fetches the plain-text version of this page (append `.md` to any docs URL) and then writes code for your stack. The timeout, 2K/4K verification, GIF format and WebP limits are baked in.

9 requirements in total — use the button below to copy the full prompt.

Wire up or troubleshoot gpt-image-2.6-all text-to-image and image editing in this project.

Read the docs first: fetch [https://docs.apiyi.com/en/api-capabilities/gpt-image-2-all/gpt-image-2-6-all.md](https://docs.apiyi.com/en/api-capabilities/gpt-image-2-all/gpt-image-2-6-all.md) for the plain-text version of this page. For more detail, append `.md` to the text-to-image and image-edit pages as well.

Requirements:

1. Timeout: set the client timeout to 600 seconds. Image APIs are synchronous; there is no task ID. If the client disconnects, the result is lost but the request is still billed. Loosen reverse proxies, gateways and serverless limits too.

2. Rendering: the default is base64 (`b64_json`, no `data:` prefix). You can pass `response_format: "url"` for a 24-hour signed link. **Always pass `response_format` explicitly** rather than relying on the default. With URL mode, download and re-host immediately.

3. Sizes: long edge 512–1536 is native, with any integer dimensions and an aspect ratio up to 3:1. 2K/4K is super-resolution for large-canvas compatibility, not native pixels. **b64 responses echo `size`, `url` may not; a size mismatch returns 502 `size_not_deliverable`, so verify the response `size` and actual dimensions.** Ratios beyond 3:1 such as `4096x1024` return 400.

4. GIF: pass `output_format=gif` plus `frame_count` / `frame_duration_ms`. **`size` does not determine GIF dimensions**; do not use it to control pixels.

5. SVG: true vector output is available, but quality is unstable on this reverse route — **do not use it in production**; for vector work, switch to official-relay `gpt-image-2.6-sunburst` / `gpt-image-2.6-flare`, where `svg.model` writes the SVG code.

6. Transparent background: `background=transparent` + PNG, preferably at or below 2K. 4K transparency may return 200 exact or 502; do not hard-code it.

7. `n` supports 1–4 and is billed per image. `quality` only accepts `auto` / `medium` / `high`; `low` / `hd` return 400.

8. Read the key from `APIYI_API_KEY` and use [https://api.apiyi.com/v1](https://api.apiyi.com/v1) as the base URL. Never hard-code or commit the key.

9. After wiring it up, run one text-to-image and one edit; report the actual dimensions, latency and cost of both calls.

> [accordion] What this prompt prevents
>
> | Requirement | Pitfall it avoids |
> | - | - |
> | 600-second timeout | Common HTTP clients default to 30–60 s and cut off a request that is still generating; disconnected requests are still billed |
> | Explicit `response_format` | The default has changed before; without it you must handle both `url` and `b64_json` |
> | Read response `size` / actual dimensions | b64 echoes `size`; url may not; a size mismatch returns 502, no silent change |
> | GIF format | Omitting `output_format=gif` returns a 502 with a hard-to-read message |
> | Transparent at or below 2K | 4K transparent output drifts to a 4096 long edge with unpredictable height |
> | No WebP | Only PNG / JPEG / GIF / SVG are supported; WebP returns 400 |

## FAQ

### Is 2K/4K native resolution?

No. 2K/4K uses super-resolution to solve size / large-canvas compatibility, not native detail. Native quality is at 1536 and below, with the ChatGPT fingerprint. For stable quality, stay around 1.5K; use 2048–3840 for posters and print.

### Why is `size` sometimes missing?

b64 responses echo `size`; `url` responses may omit it. A size mismatch returns 502 `size_not_deliverable`. Use the response `size` and the actual image dimensions (for example, the PNG IHDR) instead of the requested value.

### Can it produce a 4K transparent image?

It may be exact, or it may return 502. At 2K, transparent output is stable (RGBA, about 40% fully transparent pixels). At 4K we have seen exact 3840x2160 as well as 502 when upstream returned a 4096 long edge. Do not assume it always works; keep transparent output at or below 2K.

### Can I set the GIF dimensions?

No. `size` does not affect GIF output: 1K has produced 384x512, 507x506 and 619x623; 2K returned 327x585; 4K returned 621x621. Only frame count and duration are promised. Resize or crop on the client if you need fixed pixels.

### Can I use SVG from this reverse route in production?

No. On the current reverse implementation SVG comes straight from the image model with no writer model, and measured quality is unstable. For vector output, use the official-relay 2.6 `svg.model` path. See the [test notes](https://docs.apiyi.com/en/live/2026-11/gpt-image-2-6-all-svg-quality).

### Is WebP supported?

No. Only PNG / JPEG / GIF / SVG; `output_format=webp` returns 400.

### Does `quality` matter?

Only `auto` / `medium` / `high` are accepted; `low` / `hd` return 400. `medium` / `high` return 2048x2048; no same-seed visual difference has been verified.

### Why does `4096x4096` fail?

The upstream square cap is 2880; `4096x4096`, `3840x3840` and `3200x3200` return 502 `size_not_deliverable` (upstream delivers 2880x2880). Request `2880x2880` directly if you need a large square.

### What is the maximum `n`?

1–4. `n=5` and above return 400 `n must be an integer between 1 and 4`; `n=0` returns 400 `n must be greater than 0`. Billing is per image, so `n=4` is four images.

### Why does `4096x1024` fail?

The maximum aspect ratio is 3:1; `4096x1024` is 4:1 and is rejected during parameter validation. Use a ratio within 3:1 (for example, up to `4096x1536`) or stitch two images.

## Related

* [Text to image API](https://docs.apiyi.com/en/api-capabilities/gpt-image-2-all/text-to-image.md)
* [Image editing API](https://docs.apiyi.com/en/api-capabilities/gpt-image-2-all/image-edit.md)
* [GPT-Image-2.5-All overview](https://docs.apiyi.com/en/api-capabilities/gpt-image-2-all/overview.md)
* [Official vs reverse comparison (2.6)](https://docs.apiyi.com/en/api-capabilities/gpt-image-2/vs-gpt-image-2-6-all.md) - Selection guide vs `gpt-image-2.6-flare` / `sunburst`
* [Image API best practices](https://docs.apiyi.com/en/api-capabilities/image-api-best-practices.md)


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