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

# GPT Image 2.5 Sunburst API 调用

> 图像生成接口调用指南

## Endpoints and authentication

Syon uses the OpenAI Images API compatible format:

* Generate images: `POST https://api.syon.com/v1/images/generations`
* Edit images: `POST https://api.syon.com/v1/images/edits`

Request headers:

http

```
Authorization: Bearer sk-xxxxxx
Content-Type: application/json
```

The edit endpoint also accepts `multipart/form-data` for uploading image files.

## Generate images

Minimal request:

bash

```
curl https://api.syon.com/v1/images/generations \
  -H "Authorization: Bearer sk-xxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5-sunburst",
    "prompt": "An orange tabby cat typing on a keyboard, illustration style"
  }'
```

Specify size and quality:

json

```
{
  "model": "gpt-image-2.5-sunburst",
  "prompt": "An orange tabby cat typing on a keyboard, illustration style",
  "size": "2048x2048",
  "quality": "high"
}
```

Common parameters:

| Parameter            | Description                                                                                                                                                                                                                                              |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`              | Use `gpt-image-2.5-sunburst`. It must be specified explicitly; when `model` is omitted, `gpt-image-2` is used by default.                                                                                                                                |
| `prompt`             | Description of the image to generate.                                                                                                                                                                                                                    |
| `size`               | `auto` or `widthxheight`, for example `1024x1024`, `2048x2048`, `3840x2160`.                                                                                                                                                                             |
| `quality`            | `low`, `medium`, `high`, or `auto`.                                                                                                                                                                                                                      |
| `n`                  | Number of images to generate per request. Defaults to 1.                                                                                                                                                                                                 |
| `output_format`      | `png`, `jpeg`, or `webp`.                                                                                                                                                                                                                                |
| `output_compression` | JPEG/WebP compression level, 0 to 100.                                                                                                                                                                                                                   |
| `background`         | `transparent`, `opaque`, or `auto`. With `transparent`, the returned image has an alpha channel; pair it with `output_format` set to `png` or `webp`.                                                                                                    |
| `moderation`         | Content moderation strictness, `low` or `auto`.                                                                                                                                                                                                          |
| `stream`             | Set to `true` to stream the response over SSE: intermediate chunks have `object` set to `image.generation.chunk`, the final chunk has `object` set to `image.generation.result` with the result image in `data[0].b64_json`, followed by `data: [DONE]`. |
| `partial_images`     | 0 to 3. Currently intermediate chunks carry no image; only the final chunk carries the result.                                                                                                                                                           |
| `user`               | A caller-defined end-user identifier, passed through as is.                                                                                                                                                                                              |

OpenAI's size constraints for `gpt-image-2.5-sunburst`: the longest side must not exceed 3840 pixels; width and height must both be multiples of 16; the aspect ratio must not exceed 3:1; and the total pixel count must be between 655,360 and 8,294,400. Sizes are pixel dimensions, not fixed `1k`, `2k`, `4k` strings.

## Edit images

bash

```
curl https://api.syon.com/v1/images/edits \
  -H "Authorization: Bearer sk-xxxxxx" \
  -F "model=gpt-image-2.5-sunburst" \
  -F "prompt=Replace the background with snowy mountains" \
  -F "image=@input.png" \
  -F "size=1024x1024"
```

Common parameters:

| Parameter            | Description                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `model`              | Use `gpt-image-2.5-sunburst`.                                                                                       |
| `image`              | The source image file.                                                                                              |
| `mask`               | Mask image file; transparent areas are editable. Must match the source image size.                                  |
| `prompt`             | The edit instruction.                                                                                               |
| `n`                  | Number of images to generate per request. Defaults to 1.                                                            |
| `size`               | `auto` or `widthxheight`.                                                                                           |
| `quality`            | `low`, `medium`, `high`, or `auto`.                                                                                 |
| `background`         | `transparent`, `opaque`, or `auto`. In testing, images returned by the edit endpoint do not carry an alpha channel. |
| `input_fidelity`     | How faithfully to preserve details of the source image, `high` or `low`.                                            |
| `output_format`      | `png`, `jpeg`, or `webp`.                                                                                           |
| `output_compression` | JPEG/WebP compression level, 0 to 100.                                                                              |
| `stream`             | Set to `true` to stream the response over SSE. The event format is the same as for image generation.                |
| `partial_images`     | 0 to 3.                                                                                                             |
| `user`               | A caller-defined end-user identifier, passed through as is.                                                         |

## Size and billing rules

Image generation is billed per image. Each image's unit price is determined by its actual resolution, in three tiers by the longest side:

| Longest side of the output image | Tier |
| -------------------------------- | ---- |
| Up to 1024                       | 1K   |
| Up to 2048                       | 2K   |
| Above 2048                       | 4K   |

The tier is decided by the actual width and height of the returned image, not by the request parameters. When `size` is `auto`, omitted, or empty, billing follows the size the model actually outputs; without `size`, the model outputs 1024 or 1254 pixels by default, billed as 1K or 2K respectively. Pass `size` explicitly if you need a fixed tier. See [live pricing](https://syon.com/pricing) for the three tier prices.
