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

# GPT-Image-2.6 图像生成

> - 提供 gpt-image-2.6-flare 与 gpt-image-2.6-sunburst 两种模型
- 支持文生图与最多 16 张参考图的图像编辑
- 支持比例、精确像素尺寸以及 1k / 2k / 4k 分辨率
- 支持规划强度、标注引导编辑、GIF 动图与 SVG 矢量图

```bash cURL theme={null}
curl -X POST 'https://ai.xbrod.com/v1/images/generations' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-image-2.6-flare","prompt":"一张简洁的绿色植物海报，干净背景","size":"1:1","resolution":"1k","quality":"medium"}'
```

```python Python theme={null}
import requests

response = requests.post('https://ai.xbrod.com/v1/images/generations',
    headers={'Authorization': 'Bearer <token>'},
    json={'model': 'gpt-image-2.6-flare', 'prompt': '一张简洁的绿色植物海报，干净背景',
          'size': '1:1', 'resolution': '1k', 'quality': 'medium'})
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch('https://ai.xbrod.com/v1/images/generations', {
  method: 'POST',
  headers: { Authorization: 'Bearer <token>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: 'gpt-image-2.6-flare',
    prompt: '一张简洁的绿色植物海报，干净背景',
    size: '1:1', resolution: '1k', quality: 'medium',
  }),
});
console.log(await response.json());
```

```go Go theme={null}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    body := []byte(`{"model":"gpt-image-2.6-flare","prompt":"一张简洁的绿色植物海报，干净背景","size":"1:1","resolution":"1k","quality":"medium"}`)
    req, err := http.NewRequest("POST", "https://ai.xbrod.com/v1/images/generations", bytes.NewReader(body))
    if err != nil { panic(err) }
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")
    resp, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer resp.Body.Close()
    result, err := io.ReadAll(resp.Body)
    if err != nil { panic(err) }
    fmt.Println(string(result))
}
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        var request = HttpRequest.newBuilder(URI.create("https://ai.xbrod.com/v1/images/generations"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString("{\"model\":\"gpt-image-2.6-flare\",\"prompt\":\"绿色植物海报\",\"size\":\"1:1\",\"resolution\":\"1k\",\"quality\":\"medium\"}"))
            .build();
        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```php PHP theme={null}
<?php
$ch = curl_init('https://ai.xbrod.com/v1/images/generations');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer <token>', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"model":"gpt-image-2.6-flare","prompt":"绿色植物海报","size":"1:1","resolution":"1k","quality":"medium"}',
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
if ($result === false) { throw new RuntimeException(curl_error($ch)); }
curl_close($ch);
echo $result;
```

```ruby Ruby theme={null}
require 'net/http'

uri = URI('https://ai.xbrod.com/v1/images/generations')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = '{"model":"gpt-image-2.6-flare","prompt":"绿色植物海报","size":"1:1","resolution":"1k","quality":"medium"}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
puts response.body
```


## OpenAPI

````yaml generated/gpt-image-2.6.json POST /v1/images/generations
openapi: 3.0.3
info:
  title: XBRD AI 聚合站 GPT-Image-2.6 API
  version: 0.1.0
servers:
  - url: https://ai.xbrod.com
    description: 本项目线上 API 网关
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: GPT-Image-2.6 图像生成
      description: 使用 Flare 或 Sunburst 生成静态图片，或通过参考图进行编辑。
      operationId: generate_gpt_image_2_6
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: |-
                    图像生成模型名称。可选值：

                    - `gpt-image-2.6-flare`
                    - `gpt-image-2.6-sunburst`
                prompt:
                  type: string
                  description: 图像生成或编辑的文字描述。仅传提示词时生成图片；提供 `image_urls` 时按参考图编辑。
                size:
                  type: string
                  default: auto
                  description: >-
                    输出图像的比例或精确像素尺寸。支持：


                    - `auto`：由模型决定

                    -
                    比例：`1:1`、`3:2`、`2:3`、`4:3`、`3:4`、`5:4`、`4:5`、`16:9`、`9:16`、`2:1`、`1:2`、`21:9`、`9:21`、`3:1`、`1:3`

                    - 精确像素：例如 `1600x1200`


                    图生图省略此字段时，按首张参考图比例选择尺寸。GIF 使用单帧像素尺寸，例如 `384x384`。
                resolution:
                  type: string
                  default: 1k
                  description: 分辨率档位：`1k`（默认）、`2k`、`4k`。使用精确像素尺寸时，此字段不决定输出大小。
                quality:
                  type: string
                  default: medium
                  description: >-
                    图片质量档位：`low`、`medium`、`high`、`xhigh`、`max`、`auto`。本网关当前将省略或
                    `auto` 规范化为 `medium`。
                'n':
                  type: integer
                  minimum: 1
                  maximum: 4
                  default: 1
                  description: 生成图片数量，1 至 4 张；省略时生成 1 张。SVG 仅支持 `1`。
                output_format:
                  type: string
                  enum:
                    - png
                    - jpeg
                    - webp
                    - gif
                    - svg
                  default: png
                  description: >-
                    输出格式：`png`、`jpeg`、`webp`、`gif` 或 `svg`。GIF 和 SVG
                    仅支持文生图，不能同时传参考图或蒙版；GIF 可设置帧数与帧间隔，SVG 需设置 `svg.model`。
                frame_count:
                  type: integer
                  minimum: 2
                  maximum: 16
                  description: 仅用于 GIF 的帧数，范围为 2 至 16。
                frame_duration_ms:
                  type: integer
                  minimum: 20
                  multipleOf: 10
                  description: 仅用于 GIF 的单帧时长（毫秒），至少 20，且为 10 的倍数。
                svg:
                  type: object
                  required:
                    - model
                  properties:
                    model:
                      type: string
                      description: 生成 SVG 的文本模型，例如 `gpt-5.4-mini`。
                  description: 当 `output_format` 为 `svg` 时必填；仅支持文生图，且 `n` 为 `1`。
                output_compression:
                  type: integer
                  minimum: 0
                  maximum: 100
                  description: 仅用于 JPEG 或 WebP 的压缩参数，范围为 0 至 100；GIF 与 SVG 不支持。
                background:
                  type: string
                  description: 背景设置：`auto`、`opaque` 或 `transparent`；透明背景仅搭配 PNG 或 WebP。
                image_urls:
                  type: array
                  items:
                    type: string
                  description: 图像编辑的参考图数组，最多 16 张。使用公网可访问的 HTTP(S) 图片地址。
                mask_url:
                  type: string
                  description: >-
                    局部编辑蒙版。需同时提供 `image_urls`；使用与首张参考图同尺寸、带透明通道的 PNG 图片地址或 Data
                    URI。不能与 `markup` 同时提供。
                markup:
                  type: object
                  required:
                    - image_url
                  properties:
                    image_url:
                      type: string
                      description: 与首张参考图同尺寸的透明 PNG 标注层，使用图片地址或 PNG Data URI。
                  description: >-
                    标注引导编辑，需同时提供 `image_urls`；不能与 `mask_url` 同时提供。传入包含
                    `image_url` 的对象，例如
                    `{"image_url":"data:image/png;base64,..."}`。
                complexity:
                  type: string
                  default: high
                  description: 规划强度：`low`、`medium`、`high`；省略时为 `high`。此字段独立于图片质量 `quality`。
                response_format:
                  type: string
                  enum:
                    - url
                    - b64_json
                  default: b64_json
                  description: 返回格式：默认 b64_json 为 Base64 数据；url 为图片地址。
            example:
              model: gpt-image-2.6-flare
              prompt: 一张简洁的绿色植物海报，干净背景
              size: '1:1'
              resolution: 1k
              quality: medium
      responses:
        '200':
          description: '生成成功，默认返回 Base64 图片数据；显式传入 response_format: url 时返回图片 URL'
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: integer
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        b64_json:
                          type: string
              example:
                created: 1735689600
                data:
                  - b64_json: iVBORw0KGgoAAAANSUhEUg...
        '400':
          description: 缺少必要参数或参数不符合模型要求
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 控制台获取的API密钥

````

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