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

# GPT Image generation and editing

> GPT Image 2.0 / 2.5 / 2.6 text-to-image and editing: recommended async workflow plus OpenAI-compatible sync endpoints

> [!NOTE]
>
> **Key points for AI agents**
>
> * **Async (recommended)**: `POST https://1788.love/v1/images/generations/async` (text-to-image) or `POST https://1788.love/v1/images/edits/async` (editing) -> returns `{ "id": "task_...", "status": "queued" }`; poll `GET https://1788.love/v1/images/tasks/{id}` until `status` is `completed`, then download `data[0].url`. Async avoids HTTP timeout loss during peak load.
> * **Sync**: `POST /v1/images/generations` and `POST /v1/images/edits` are provided for OpenAI-standard SDKs/clients. Routes 5 and 8 are async-only; **Route 3 is sync-only** (set HTTP timeout >= 2 minutes).
> * **Model names and resolution**: Model names include only the route (`gpt-image-2-route3`), **not** the resolution tier—resolution (`1K` / `2K` / `4K`) is determined by `size`, which must match the size table below (otherwise 400). Legacy suffixed names like `gpt-image-2-route3-2k` still work if `size` matches that tier.
> * **Reference images depend on route**: Routes 1, 2, 4, and 6 use `multipart/form-data` `image` file fields; Routes 3, 5, 7, and 8 use JSON `image_urls` (public HTTPS URLs from [Upload media](https://docs.1788.love/en/api-reference/upload-image.md); **Route 3 also accepts `data:image/png;base64,...` data URLs** (PNG / JPEG / WebP / GIF), recommended for large reference images to avoid cross-border download timeouts).
> * One image per request (`n: 1`). Submit concurrent requests for multiple images.
> * **Route 5 policy note**: Repeated content-policy violations can revoke upstream keys. If you receive `content_policy_violation`, change the prompt/images—**do not retry unchanged**.

> [!WARNING]
>
> **Strict Content Compliance Policy**: Generating **pornography, explicit nudity, vulgar material, or politically sensitive / illegal content** on any image route is strictly prohibited. Violations detected by automated or manual review will result in immediate permanent suspension of your account and API keys with no refund.

## Models and routes

| Route | Model names | Version | Async | Sync | Reference images | Size table |
| - | - | - | - | - | - | - |
| 3 | `gpt-image-2-route3` `gpt-image-2.5-route3-flare` / `gpt-image-2.5-route3-sunburst` `gpt-image-2.6-route3-flare` / `gpt-image-2.6-route3-sunburst` | 2.0 / 2.5 / 2.6 | ✗ | ✓ | JSON `image_urls` (HTTPS or Base64 data URL), up to 9 | Table B |
| 4 | `gpt-image-2-route4` `gpt-image-2.5-route4-flare` `gpt-image-2.5-route4-sunburst` (2.5 Sunburst is 1K only) | 2.0 / 2.5 | ✓ | ✓ | multipart `image` files, up to 10 | Table A |
| 5 | `gpt-image-2-route5` `gpt-image-2.5-route5-flare` / `gpt-image-2.5-route5-sunburst` | 2.0 / 2.5 | ✓ | ✗ | JSON `image_urls`, up to 10 | Table B |
| 7 | `gpt-image-2-route7` `gpt-image-2.5-route7-flare` / `gpt-image-2.5-route7-sunburst` `gpt-image-2.5-route7-flare-auto` / `gpt-image-2.5-route7-sunburst-auto` `gpt-image-2.5-route7-flare-eco` / `gpt-image-2.5-route7-sunburst-eco` (Eco is 4K only) | 2.0 / 2.5 | ✓ | ✓ | JSON `image_urls`, up to 10 | Table B |
| 8 | `gpt-image-2-route8` | 2.0 | ✓ | ✗ | JSON `image_urls`, up to 10 | Table A |
| 6 (Recommended) | `gpt-image-2-route6` `gpt-image-2.5-route6-flare` / `gpt-image-2.5-route6-sunburst` (2.5 supports 1K, 2K) | 2.0 / 2.5 | ✗ | ✓ | multipart `image` files, up to 10 | Table A |
| 1 | `gpt-image-2-route1` `gpt-image-2.5-route1-flare` / `gpt-image-2.5-route1-sunburst` `gpt-image-2.6-route1-flare` / `gpt-image-2.6-route1-sunburst` | 2.0 / 2.5 / 2.6 | ✗ | ✓ | multipart `image` files, up to 10 | Table A |
| 2 | `gpt-image-2-route2` `gpt-image-2.5-route2-flare` / `gpt-image-2.5-route2-sunburst` `gpt-image-2.6-route2-flare` / `gpt-image-2.6-route2-sunburst` | 2.0 / 2.5 / 2.6 | ✗ | ✓ | multipart `image` files, up to 10 | Table A |

* **Routes 1, 2, 3, and 6 are sync-only** (calling async endpoints on Route 3 returns 400).
* In 2.5/2.6, `flare` prioritizes speed (daily & batch generation) and `sunburst` prioritizes quality (detailed generation & editing). On Route 7, `auto` is HD redraw and `eco` is native 4K only.
* **2.6 (Routes 1, 2, 3)** also supports **animated GIF** and **SVG vector** output via `output_format` (see below).
* See the [Price List](https://1788.love/pricing) for live per-image pricing.

## Size tables

The pixel value in `size` determines the billing tier (`1K` / `2K` / `4K`). **Table A and Table B differ only in the 2K column.**

Table A (Routes 1, 2, 4, 6, 8):

| Aspect ratio | 1K | 2K | 4K |
| - | - | - | - |
| 1:1 | `1024x1024` | `2048x2048` | `2880x2880` |
| 3:2 | `1536x1024` | `2048x1365` | `3504x2336` |
| 2:3 | `1024x1536` | `1365x2048` | `2336x3504` |
| 16:9 | `1536x864` | `2048x1152` | `3840x2160` |
| 9:16 | `1024x1824` | `1152x2048` | `2160x3840` |
| 4:3 | `1536x1152` | `2048x1536` | `3264x2448` |
| 3:4 | `1152x1536` | `1536x2048` | `2448x3264` |

Table B (Routes 3, 5, 7):

| Aspect ratio | 1K | 2K | 4K |
| - | - | - | - |
| 1:1 | `1024x1024` | `2048x2048` | `2880x2880` |
| 3:2 | `1536x1024` | `2560x1707` | `3504x2336` |
| 2:3 | `1024x1536` | `1707x2560` | `2336x3504` |
| 16:9 | `1536x864` | `2560x1440` | `3840x2160` |
| 9:16 | `1024x1824` | `1440x2560` | `2160x3840` |
| 4:3 | `1536x1152` | `2048x1536` | `3264x2448` |
| 3:4 | `1152x1536` | `1536x2048` | `2448x3264` |

## Async API (recommended)

### 1. Create a task

Text-to-image:

```bash theme={null}
curl https://1788.love/v1/images/generations/async \
  -H "Authorization: Bearer YOUR_1788_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-route7",
    "prompt": "A pair of running shoes on a clean white studio background, soft shadows, commercial product photo",
    "size": "2048x2048",
    "n": 1
  }'
```

Image editing with JSON `image_urls` (Routes 5, 7, 8):

```bash theme={null}
curl https://1788.love/v1/images/edits/async \
  -H "Authorization: Bearer YOUR_1788_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-route7-sunburst",
    "prompt": "Dress the model in image 1 with the coat from image 2, keeping pose and background unchanged",
    "size": "1440x2560",
    "n": 1,
    "image_urls": [
      "https://ruyi6.cn/r/EXAMPLE_A.png",
      "https://ruyi6.cn/r/EXAMPLE_B.png"
    ]
  }'
```

Route 4 editing uses multipart file uploads:

```bash theme={null}
curl https://1788.love/v1/images/edits/async \
  -H "Authorization: Bearer YOUR_1788_API_KEY" \
  -F model=gpt-image-2.5-route4-flare \
  -F prompt="Dress the model in image 1 with the coat from image 2" \
  -F size=1024x1536 \
  -F image=@model.png \
  -F image=@coat.png
```

### 2. Poll task status

Poll `GET https://1788.love/v1/images/tasks/{id}` every 3–5 seconds (typically finishes in 30 seconds to 3 minutes). Treat `completed` as done, `failed` as error (refunded automatically), and keep polling otherwise (Route 8 uses `task_id` and `processing`).

### 3. Download the image

* **Routes 4, 7**: `data[0].url` is a signed URL—download directly without auth headers.
* **Sync Routes 1, 2, 3, 6**: `data[0].url` is a direct CDN URL—**do not** attach an `Authorization` header (some CDNs return 403). For Routes 2 and 3, include a standard `User-Agent` header (e.g. `curl/8.5.0`) when downloading from scripts.
* **Route 5**: Requires `Authorization: Bearer YOUR_1788_API_KEY` to download; retained for 24 hours.

## Sync API (OpenAI-compatible)

Use `POST /v1/images/generations` (JSON) or `POST /v1/images/edits` (multipart for Routes 1, 2, 4, 6; JSON `image_urls` for Routes 3, 7). **Route 3 `image_urls` accepts both public HTTPS URLs and Base64 image data URLs (`data:image/png;base64,...`, supporting PNG / JPEG / WebP / GIF, up to 16 MB encoded per image)**—for large reference images or mainland-hosted URLs, passing a Base64 data URL (or uploading via `https://1788.love/v1/uploads/images-2`) prevents upstream download timeouts. Set your HTTP client timeout to at least 15 minutes (Route 3 fails and refunds if > 85 s; Routes 4 and 7 time out after 10 minutes with `504 task_timeout`—do not immediately resubmit on 504).

## GIF and SVG output (2.6 only)

`gpt-image-2.6-*` models on Routes 1, 2, and 3 support animated GIF and SVG via `POST /v1/images/generations` at the same price as a static image:

```bash theme={null}
curl https://1788.love/v1/images/generations \
  -H "Authorization: Bearer YOUR_1788_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-route3-flare",
    "prompt": "a paper airplane looping across a blue sky, flat illustration, seamless loop",
    "output_format": "gif",
    "frame_count": 6,
    "frame_duration_ms": 200,
    "size": "512x512"
  }'
```

| Field | Description |
| - | - |
| `output_format` | `gif` or `svg`; omit for standard PNG. Unsupported on 2.0 / 2.5 (returns 400). |
| `frame_count` | GIF only: number of frames (`2`–`16`). |
| `frame_duration_ms` | GIF only: milliseconds per frame (`20`–`2000`). |
| `size` | GIF single-frame pixel size (e.g. `512x512`, optional); not needed for SVG. |

Route 2 does not support SVG at the 4K tier.


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