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

# GPT Image 2.6

> OpenAI GPT Image 2.6 图像生成，提供 Flare 与 Sunburst 两个版本，支持 GIF，输出像素固定为 816×816。

* 异步接口：提交后立即返回 `task_id`，再调用 [查询图片任务](https://docs.nodylink.com/api-reference/images/task-status.md) 获取结果。
* 支持输出 GIF。
* 输出像素固定为 816×816，不支持通过 `size` 或 `resolution` 调整尺寸。
* 按张计费，单价由 `quality` 决定，见 [模型价格](https://nodylink.com/pricing)。任务失败自动退款。

## 模型选择

| 模型 ID | 特点 | 适用场景 |
| - | - | - |
| `gpt-image-2.6-flare` | 生成速度快 | 社媒动图、商品动效、快速原型、大批量生成 |
| `gpt-image-2.6-sunburst` | 编辑精度优先 | 投放级动图、成品级商品动效、多轮精细编辑 |

> [!NOTE]
>
> GPT Image 2.6 的画面尺寸固定为 816×816。传入 `size` 或 `resolution` 不会改变输出像素。

```bash cURL theme={null}
curl https://api.nodylink.com/v1/images/generations \
  -H "Authorization: Bearer sk-你的密钥" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-flare",
    "prompt": "一只橘猫在窗台上转头，毛发轻轻晃动，生成 GIF",
    "output_format": "gif",
    "quality": "high"
  }'
```

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

API_KEY = "sk-你的密钥"
BASE = "https://api.nodylink.com"
headers = {"Authorization": f"Bearer {API_KEY}"}

submit = requests.post(
    f"{BASE}/v1/images/generations",
    headers=headers,
    json={
        "model": "gpt-image-2.6-flare",
        "prompt": "一只橘猫在窗台上转头，毛发轻轻晃动，生成 GIF",
        "output_format": "gif",
        "quality": "high",
    },
).json()
task_id = submit["task_id"]

while True:
    task = requests.get(f"{BASE}/v1/images/tasks/{task_id}", headers=headers).json()
    if task["status"] == "SUCCESS":
        print(task["data"][0]["url"])
        break
    if task["status"] == "FAILED":
        raise RuntimeError(task["fail_reason"])
    time.sleep(5)
```

```javascript Node.js theme={null}
const API_KEY = "sk-你的密钥";
const BASE = "https://api.nodylink.com";
const headers = {
  Authorization: `Bearer ${API_KEY}`,
  "Content-Type": "application/json",
};

const submit = await fetch(`${BASE}/v1/images/generations`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    model: "gpt-image-2.6-flare",
    prompt: "一只橘猫在窗台上转头，毛发轻轻晃动，生成 GIF",
    output_format: "gif",
    quality: "high",
  }),
}).then((r) => r.json());

while (true) {
  const task = await fetch(`${BASE}/v1/images/tasks/${submit.task_id}`, { headers })
    .then((r) => r.json());
  if (task.status === "SUCCESS") {
    console.log(task.data[0].url);
    break;
  }
  if (task.status === "FAILED") throw new Error(task.fail_reason);
  await new Promise((r) => setTimeout(r, 5000));
}
```

```json 200 theme={null}
{
  "code": 200,
  "status": "submitted",
  "task_id": "task_01M5XZ6F1M3P5Q7R9S1T3V5W8",
  "id": "task_01M5XZ6F1M3P5Q7R9S1T3V5W8"
}
```

```json 400 theme={null}
{
  "code": "invalid_request",
  "message": "prompt is required",
  "data": null
}
```

## 鉴权

**Authorization** `string` *required*

`Bearer <API Key>`。在 [API 密钥](https://nodylink.com/dashboard/keys) 页面创建。

## 请求参数

**model** `string` *required*

`gpt-image-2.6-flare` 或 `gpt-image-2.6-sunburst`。

**prompt** `string` *required*

图像生成或编辑的描述，支持中英文。建议说明主体、动作、场景和风格。需要动图时，在描述中写明生成 GIF。

**output\_format** `string`

输出格式。支持 `gif`。输出像素固定为 816×816。

**quality** `string`

输出质量：`low`、`medium`、`high`、`xhigh` 或 `max`，大小写均可。决定单价。

**image\_urls** `string[]`

参考图列表，传入后为图生图 / 参考图编辑模式。每项可以是公网图片 URL 或 `data:image/png;base64,...` 格式的 Data URL。

## 提交响应

**code** `integer`

固定为 `200`。

**status** `string`

固定为 `submitted`。

**task\_id** `string`

任务 ID，用于 [查询图片任务](https://docs.nodylink.com/api-reference/images/task-status.md)。

**id** `string`

与 `task_id` 相同。

## 使用示例

**生成 GIF**

```json theme={null}
{
  "model": "gpt-image-2.6-flare",
  "prompt": "咖啡杯中的热气缓缓升起，暖色灯光，生成 GIF",
  "output_format": "gif",
  "quality": "xhigh"
}
```

**商品动效（Sunburst）**

```json theme={null}
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "保留商品主体和包装文字，让背景光斑缓慢流动，生成 GIF",
  "output_format": "gif",
  "image_urls": ["https://example.com/product.png"]
}
```

## 查询结果

```json theme={null}
{
  "status": "SUCCESS",
  "task_id": "task_01M5XZ6F1M3P5Q7R9S1T3V5W8",
  "progress": "100%",
  "created": 1792000120,
  "data": [
    {"url": "https://example.com/generated/8a1d4c7e.gif"}
  ]
}
```

取图方式：`data[0].url`。`output_format` 为 `gif` 时，结果是 816×816 的 GIF。状态说明见 [查询图片任务](https://docs.nodylink.com/api-reference/images/task-status.md)。


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