> ## 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.5

> Generate and edit images with GPT Image 2.5 Sunburst and Flare through the AnyFast Image API.

GPT Image 2.5 is OpenAI's image generation and editing model family. AnyFast exposes both models through the Image API:

| Model ID                 | Best for                                            |
| ------------------------ | --------------------------------------------------- |
| `gpt-image-2.5-sunburst` | Precise image editing and high-quality final assets |
| `gpt-image-2.5-flare`    | Fast, high-quality everyday image generation        |

Both models accept text and image inputs and return images. Use `POST /v1/images/generations` to create an image from text, or `POST /v1/images/edits` to edit one or more uploaded images.

## What changed in GPT Image 2.5

* **Higher reference fidelity** — Subjects, distinctive features, lighting, and textures are more likely to remain recognizable after transformation.
* **More precise edits** — The model is better at changing the requested element while preserving the surrounding subject, composition, and visual treatment.
* **More consistent iteration** — Successive edits are less likely to undo earlier changes or degrade image quality.
* **Faster generation** — OpenAI positions Flare as the default choice for most applications and reports up to 50% lower latency than GPT Image 2.
* **Better layout handling** — Complex visual instructions, transparent backgrounds, and layout-sensitive creative work are more reliable.

## Official editing example

This OpenAI launch example changes the subject's clothing while preserving the person, pose, printed-photo setting, and blue background.

<Columns cols={2}>
  <Frame caption="Input — OpenAI official example">
    <img src="https://images.ctfassets.net/kftzwdyauwt9/32SMucJsSrwGCjHrGx4wkb/34dc5553df131fac17423e84177ce002/baby-portrait-before.jpeg" alt="Input photograph of a printed child portrait with a red shirt and blue background" />
  </Frame>

  <Frame caption="Edited result — OpenAI official example">
    <img src="https://images.ctfassets.net/kftzwdyauwt9/31fyboLGIlu5roN22tlEHK/9be57d84b3b7bbf22e7aa7f74b5af102/baby-portrait-after.webp" alt="Edited printed child portrait with an ivory tuxedo while preserving the pose and blue background" />
  </Frame>
</Columns>

<Info>
  These assets come from the [OpenAI GPT Image 2.5 launch article](https://openai.com/index/introducing-chatgpt-images-2-5/). They illustrate upstream model behavior and are not presented as an AnyFast-generated validation result.
</Info>

## Key capabilities

* **Text-to-image** — Generate an image from a natural-language prompt
* **Image editing** — Apply broad or localized edits to uploaded images
* **Flexible dimensions** — Use recommended sizes or valid custom `WIDTHxHEIGHT` dimensions up to 4K
* **Expanded quality controls** — Select `low`, `medium`, `high`, `xhigh`, `max`, or `auto`
* **Transparent output** — Request a transparent background with PNG or WebP output
* **Multiple outputs** — Use `n` to request more than one result in one generation request

<Tabs sync={false}>
  <Tab title="Generate images">
    Send a JSON request to `POST /v1/images/generations`. Choose Sunburst for maximum editing and rendering precision, or Flare when latency matters more.

    ```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.5-flare",
        "prompt": "A clean editorial product photograph of a translucent green glass bottle on pale stone, soft morning light",
        "size": "1536x1024",
        "quality": "high",
        "background": "opaque",
        "output_format": "jpeg",
        "output_compression": 85,
        "n": 1
      }'
    ```
  </Tab>

  <Tab title="Edit images">
    Send a multipart request to `POST /v1/images/edits`. Use Sunburst when the workflow depends on precise preservation or targeted edits.

    ```bash cURL theme={null}
    curl --request POST \
      --url https://www.anyfast.ai/v1/images/edits \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --form 'model=gpt-image-2.5-sunburst' \
      --form 'image[]=@/path/to/product.png' \
      --form 'prompt=Keep the product unchanged and replace the background with a warm studio gradient' \
      --form 'size=1536x1024' \
      --form 'quality=xhigh' \
      --form 'output_format=png'
    ```
  </Tab>
</Tabs>

## Output controls

| Parameter            | Values                                          | Notes                                                                                 |
| -------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------- |
| `quality`            | `low`, `medium`, `high`, `xhigh`, `max`, `auto` | Defaults to `auto`; higher settings generally increase detail, latency, and token use |
| `size`               | `auto` or `WIDTHxHEIGHT`                        | Recommended sizes include `1024x1024`, `1536x1024`, and `1024x1536`                   |
| `background`         | `auto`, `opaque`, `transparent`                 | Transparent output requires `png` or `webp`                                           |
| `output_format`      | `png`, `jpeg`, `webp`                           | Defaults to `png`                                                                     |
| `output_compression` | `0`–`100`                                       | Applies to JPEG and WebP output                                                       |
| `moderation`         | `auto`, `low`                                   | Defaults to `auto`                                                                    |

### Custom size rules

Custom dimensions must satisfy all of the following requirements:

* Width and height are multiples of 16 pixels.
* The aspect ratio is between `1:3` and `3:1`.
* Neither edge exceeds 3,840 pixels.
* Total pixels are between 655,360 and 8,294,400.
* Resolutions above `2560x1440` are experimental.

## Image editing inputs

* Upload a single source image with `image`, or up to 16 source images with `image[]`.
* Use multipart form uploads rather than public image URLs for the Image API edit endpoint.
* An optional mask must have an alpha channel and match the first source image's format and dimensions.
* The source image and mask must each be smaller than 50 MB.

## Response handling

GPT Image models return image data in `data[].b64_json`. Decode the Base64 value and save it using the extension reported by `output_format`. The `response_format` parameter used by DALL·E models does not apply to GPT Image 2.5.

```bash Decode the first result theme={null}
echo "$RESPONSE" | jq -r '.data[0].b64_json' | base64 --decode > result.png
```

<Info>
  The upstream OpenAI API also lets supported mainline models call GPT Image 2.5 through the Responses API image-generation tool. This page documents the direct AnyFast Image API endpoints.
</Info>

See the [OpenAI image generation guide](https://developers.openai.com/api/docs/guides/image-generation), [Create image API](https://developers.openai.com/api/reference/resources/images/methods/generate), [Create image edit API](https://developers.openai.com/api/reference/resources/images/methods/edit), [Sunburst model page](https://developers.openai.com/api/docs/models/gpt-image-2.5-sunburst), and [Flare model page](https://developers.openai.com/api/docs/models/gpt-image-2.5-flare) for the upstream model specification.

<Card title="GPT Image 2.5 API Reference" icon="code" href="/api-reference/model-api/openai/gpt-image-2-5">
  View generation and editing request fields and response schemas.
</Card>

<script src="/public/feedback.js" />
