> ## 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 gpt-image-2.5-flare.

Use one GPT Image 2.5 model ID with the generation or editing endpoint.

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

<Info>
  GPT Image 2.5 always returns Base64-encoded image data in `data[].b64_json`. Do not send the DALL·E-only `response_format` parameter.
</Info>

<Tabs sync={false}>
  <Tab title="Generate images">
    ## Generate images

    `POST /v1/images/generations`

    <div className="kling-api-example-panel">
      ```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,
          "moderation": "auto",
          "n": 1
        }'
      ```
    </div>

    ## Request headers

    <ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>Data exchange format.</ParamField>

    ## Request body

    <ParamField body="model" type="string" required>
      Model ID: `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare`.
    </ParamField>

    <ParamField body="prompt" type="string" required>
      Text description of the image to generate. Length: `1`–`32,000` characters.
    </ParamField>

    <ParamField body="n" type="integer" default={1}>
      Number of images to generate. Supported range: `1`–`10`.
    </ParamField>

    <ParamField body="size" type="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.
    </ParamField>

    <ParamField body="quality" type="string" default="auto">
      Rendering quality: `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
    </ParamField>

    <ParamField body="background" type="string" default="auto">
      Background mode: `auto`, `opaque`, or `transparent`. Transparent backgrounds require PNG or WebP output.
    </ParamField>

    <ParamField body="output_format" type="string" default="png">
      Output format: `png`, `jpeg`, or `webp`.
    </ParamField>

    <ParamField body="output_compression" type="integer" default={100}>
      JPEG or WebP compression level from `0` through `100`. Ignored for PNG output.
    </ParamField>

    <ParamField body="moderation" type="string" default="auto">
      Moderation strictness: `auto` or `low`.
    </ParamField>

    ## Generation response

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "created": 1788926400,
        "background": "opaque",
        "data": [
          {
            "b64_json": "iVBORw0KGgoAAA..."
          }
        ],
        "output_format": "jpeg",
        "quality": "high",
        "size": "1536x1024"
      }
      ```
    </div>

    <ResponseField name="created" type="integer">Creation time as a Unix timestamp in seconds.</ResponseField>
    <ResponseField name="background" type="string">Resolved background mode: `opaque` or `transparent`.</ResponseField>
    <ResponseField name="data" type="object[]">Generated image results.</ResponseField>
    <ResponseField name="data[].b64_json" type="string">Base64-encoded image data.</ResponseField>
    <ResponseField name="output_format" type="string">Returned image format: `png`, `jpeg`, or `webp`.</ResponseField>
    <ResponseField name="quality" type="string">Quality level used for the result.</ResponseField>
    <ResponseField name="size" type="string">Resolved output dimensions as `WIDTHxHEIGHT`.</ResponseField>
  </Tab>

  <Tab title="Edit images">
    ## Edit images

    `POST /v1/images/edits`

    <div className="kling-api-example-panel">
      ```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 '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'
      ```
    </div>

    ## Request headers

    <ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
    <ParamField header="Content-Type" type="string" default="multipart/form-data" required>Set automatically when using multipart form uploads.</ParamField>

    ## Request body

    <ParamField body="model" type="string" required>
      Model ID: `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare`.
    </ParamField>

    <ParamField body="image" type="file">
      One source image file. Use `image[]` instead when uploading multiple images. Each source image must be smaller than 50 MB.
    </ParamField>

    <ParamField body="image[]" type="file[]">
      Up to 16 source image files. Do not send both `image` and `image[]`.
    </ParamField>

    <ParamField body="mask" type="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.
    </ParamField>

    <ParamField body="prompt" type="string" required>
      Instructions describing the edit. Length: `1`–`32,000` characters.
    </ParamField>

    <ParamField body="n" type="integer" default={1}>
      Number of edited images to return. Supported range: `1`–`10`.
    </ParamField>

    <ParamField body="size" type="string" default="auto">
      `auto` or a valid custom `WIDTHxHEIGHT` value using the same limits as image generation.
    </ParamField>

    <ParamField body="quality" type="string" default="auto">
      Rendering quality: `low`, `medium`, `high`, `xhigh`, `max`, or `auto`.
    </ParamField>

    <ParamField body="background" type="string" default="auto">
      Background mode: `auto`, `opaque`, or `transparent`. Transparent backgrounds require PNG or WebP output.
    </ParamField>

    <ParamField body="output_format" type="string" default="png">
      Output format: `png`, `jpeg`, or `webp`.
    </ParamField>

    <ParamField body="output_compression" type="integer" default={100}>
      JPEG or WebP compression level from `0` through `100`. Ignored for PNG output.
    </ParamField>

    <ParamField body="moderation" type="string" default="auto">
      Moderation strictness: `auto` or `low`.
    </ParamField>

    ## Edit response

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "created": 1788926460,
        "background": "opaque",
        "data": [
          {
            "b64_json": "iVBORw0KGgoAAA..."
          }
        ],
        "output_format": "png",
        "quality": "xhigh",
        "size": "1536x1024"
      }
      ```
    </div>

    <ResponseField name="created" type="integer">Creation time as a Unix timestamp in seconds.</ResponseField>
    <ResponseField name="background" type="string">Resolved background mode: `opaque` or `transparent`.</ResponseField>
    <ResponseField name="data" type="object[]">Edited image results.</ResponseField>
    <ResponseField name="data[].b64_json" type="string">Base64-encoded edited image data.</ResponseField>
    <ResponseField name="output_format" type="string">Returned image format: `png`, `jpeg`, or `webp`.</ResponseField>
    <ResponseField name="quality" type="string">Quality level used for the result.</ResponseField>
    <ResponseField name="size" type="string">Resolved output dimensions as `WIDTHxHEIGHT`.</ResponseField>
  </Tab>
</Tabs>

## Validation 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.
* GPT Image 2.5 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.

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