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

# Seedream 5.0 Pro

> 使用 Seedream 5.0 Pro 生成、编辑、融合图片，保留透明背景，并将图片拆分为可编辑图层。

Seedream 5.0 Pro 是 ByteDance 的高精度图片生成与编辑模型。通过 AnyFast，可用于文生图、单图和多图编辑、透明背景图生图以及图层拆分。模型 ID 为 `doubao-seedream-5-0-pro-260628`。

<Warning>Seedream 5.0 Pro 的普通生成请求每次只输出 1 张图片，不支持组图生成、联网搜索和流式输出。请勿传入 `sequential_image_generation`、`sequential_image_generation_options`、`tools` 或 `stream`。</Warning>

## 核心能力

* **文生图** — 根据文本提示词生成一张高精度图片
* **图片编辑与融合** — 编辑单张参考图，或融合最多 10 张参考图中的内容和风格
* **交互编辑** — 通过自然语言、标记、点、边界框、箭头或草图指定编辑区域
* **透明背景** — 在单图编辑流程中保留 Alpha 透明通道
* **图层拆分** — 将一张图片拆分为底图和最多 16 个可独立编辑的透明 PNG 图层
* **多语言文字** — 除中英文外，还支持俄语、阿拉伯语、菲律宾语、泰语、土耳其语、韩语、马来语、西班牙语、葡萄牙语、印尼语、法语、德语、越南语和日语提示词

<Tabs>
  <Tab title="文生图">
    ## 根据文本生成图片

    <CodeGroup>
      ```bash cURL theme={null}
      curl https://www.anyfast.com.cn/v1/images/generations \
        -H "Authorization: Bearer <token>" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "doubao-seedream-5-0-pro-260628",
          "prompt": "一只白色陶瓷杯放在浅灰色背景上，居中构图，柔和阴影，产品摄影，无文字",
          "size": "1.5K",
          "response_format": "url",
          "output_format": "jpeg",
          "watermark": false,
          "optimize_prompt_options": { "mode": "fast" }
        }'
      ```

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

      response = requests.post(
          "https://www.anyfast.com.cn/v1/images/generations",
          headers={
              "Authorization": "Bearer YOUR_API_KEY",
              "Content-Type": "application/json",
          },
          json={
              "model": "doubao-seedream-5-0-pro-260628",
              "prompt": "一只白色陶瓷杯放在浅灰色背景上，居中构图，柔和阴影，产品摄影，无文字",
              "size": "1.5K",
              "response_format": "url",
              "output_format": "jpeg",
              "watermark": False,
              "optimize_prompt_options": {"mode": "fast"},
          },
      )

      print(response.json())
      ```
    </CodeGroup>

    `size` 支持 `1K`、`1.5K`、`2K` 或合法的 `宽x高` 像素值。`optimize_prompt_options.mode` 支持 `standard` 和 `fast`，两种模式均已通过 AnyFast 实测。
  </Tab>

  <Tab title="图片编辑">
    ## 编辑或融合参考图

    ```bash cURL theme={null}
    curl https://www.anyfast.com.cn/v1/images/generations \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "doubao-seedream-5-0-pro-260628",
        "prompt": "使用图 1 的构图，并采用图 2 的视觉风格。",
        "image": [
          "https://example.com/composition.png",
          "https://example.com/style.png"
        ],
        "size": "1K",
        "output_format": "jpeg",
        "watermark": false
      }'
    ```

    `image` 支持图片 URL、Base64 Data URI，或最多 10 张参考图组成的数组。在提示词中可按照数组顺序使用“图 1”“图 2”等名称引用图片。

    坐标编辑使用 1000 × 1000 归一化坐标系：

    ```json 坐标编辑 theme={null}
    {
      "model": "doubao-seedream-5-0-pro-260628",
      "prompt": "将图 1 中 <bbox>179 283 796 986</bbox> 的主体放入图 2 的 <bbox>118 331 933 871</bbox> 区域。",
      "image": [
        "https://example.com/source.png",
        "https://example.com/target.png"
      ],
      "size": "2K",
      "output_format": "png"
    }
    ```
  </Tab>

  <Tab title="透明背景">
    ## 保留透明通道

    ```bash cURL theme={null}
    curl https://www.anyfast.com.cn/v1/images/generations \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "doubao-seedream-5-0-pro-260628",
        "prompt": "保留主体并优化边缘，同时保持透明背景。",
        "image": "https://example.com/transparent-source.png",
        "background": "transparent",
        "size": "1K",
        "output_format": "png",
        "watermark": false
      }'
    ```

    透明模式仅适用于图生图，且必须只输入 1 张本身带有 Alpha 通道的图片。请使用 `output_format: "png"`；JPEG 输入或输出均不支持透明通道。
  </Tab>

  <Tab title="图层拆分">
    ## 将图片拆分为图层

    ```bash cURL theme={null}
    curl https://www.anyfast.com.cn/v1/images/generations \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "doubao-seedream-5-0-pro-260628",
        "prompt": "仅将鹦鹉主体与背景分离为一个可编辑图层。",
        "image": "https://example.com/parrot-poster.png",
        "layer_decomposition": true,
        "size": "2K",
        "response_format": "url",
        "output_format": "jpeg",
        "watermark": false
      }'
    ```

    图层拆分仅接受 1 张 PNG 或 JPEG。返回 1 张底图和最多 16 个透明 PNG 图层。底图遵循 `output_format`，拆出的图层固定为 PNG，并返回 `z_index`、`bounding_box`、`name` 和 `description` 元数据。

    ```json 响应结构 theme={null}
    {
      "model": "doubao-seedream-5-0-pro-260628",
      "created": 1787562257,
      "data": [
        {
          "url": "https://example.com/background.jpeg",
          "size": "2048x2048",
          "output_format": "jpeg",
          "z_index": 0
        },
        {
          "url": "https://example.com/parrot-layer.png",
          "size": "892x2179",
          "output_format": "png",
          "z_index": 1,
          "bounding_box": {
            "absolute": [730, 627, 1301, 2021],
            "normalized": [356, 306, 635, 986]
          },
          "name": "鹦鹉主体",
          "description": "从原图中拆出的透明背景鹦鹉主体"
        }
      ],
      "usage": {
        "input_images": 1,
        "generated_images": 2,
        "output_tokens": 33768,
        "total_tokens": 33768
      }
    }
    ```

    图层拆分时，`size` 支持 `auto`、`1K`、`1.5K` 或 `2K`，不支持自定义像素尺寸。任一目标图层生成失败时，整个请求会失败。
  </Tab>
</Tabs>

## 输出控制

| 参数                             | 可选值                     | 说明                          |
| ------------------------------ | ----------------------- | --------------------------- |
| `size`                         | `1K`、`1.5K`、`2K` 或自定义像素 | 普通生成默认 `2K`；图层拆分还支持 `auto`  |
| `response_format`              | `url`、`b64_json`        | URL 有效期为 24 小时，请及时保存        |
| `output_format`                | `jpeg`、`png`            | 默认 `jpeg`；透明输出和拆出的图层使用 PNG  |
| `background`                   | `opaque`、`transparent`  | `transparent` 仅适用于单张透明输入图流程 |
| `watermark`                    | `true`、`false`          | 默认 `true`                   |
| `optimize_prompt_options.mode` | `standard`、`fast`       | `standard` 偏重质量，`fast` 偏重时延 |

## 尺寸与输入限制

普通生成使用自定义尺寸时，总像素数必须在 921,600 到 4,624,220 之间，宽高比必须在 `[1/16, 16]`。代表性尺寸包括：1K 的 `1024x1024`、1.5K 的 `1536x1536` 和 2K 的 `2048x2048`。

普通参考图支持 `jpeg`、`png`、`webp`、`bmp`、`tiff`、`gif`、`heic` 和 `heif`。单张图片小于 30 MB，宽高比在 `[1/16, 16]`，宽和高均大于 14 px，总像素数在 196 到 36,000,000 之间。

图层拆分仅接受 1 张 PNG 或 JPEG，总像素数在 `512x512` 到 `6000x6000` 之间，并遵循相同的宽高比和 30 MB 限制。

<Note>以上示例和响应字段已同时对齐当前火山引擎图片生成 API，以及 AnyFast 对文生图、多图融合、PNG/Base64 返回、`standard`/`fast` 提示词优化、透明背景和图层拆分的成功实测。</Note>

上游模型规格可参阅[火山引擎图片生成 API](https://docs.volcengine.com/docs/82379/1541523?lang=zh)。

<Card title="API 参考" icon="code" href="/api-reference/model-api/bytedance/doubao-seedream-5-0-pro-260628">查看 Seedream 5.0 Pro 的全部调用方式。</Card>

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