> ## 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 Flash

> 通过 AnyFast 调用 Seedream 5.0 Flash，生成和编辑图片、保留透明背景并拆分图层。

Seedream 5.0 Flash 通过同一个同步接口完成图片生成、编辑和图层拆分。AnyFast 模型 ID 为 `doubao-seedream-5-0-flash-260915`，接口为 `POST /v1/images/generations`。

| 能力 | 输入 | 输出 |
| - | - | - |
| 文生图 | 文本提示词 | 一张图片 |
| 图片编辑 | 提示词和 1–10 张参考图 | 一张编辑或融合后的图片 |
| 透明背景 | 提示词和一张带透明通道的图片 | 一张透明 PNG 图片 |
| 图层拆分 | 一张 PNG 或 JPEG；提示词可选 | 一张底图和最多 16 个透明 PNG 图层 |

> [!NOTE]
>
> 接口会在生成完成后直接返回图片列表，不会返回需要轮询的任务 ID。文生图、双图编辑、透明背景、图层拆分、Base64 返回和 `standard` 提示词优化模式均已通过 AnyFast 国内站调用验证。

> [!WARNING]
>
> 普通生成每次只输出一张图片，不支持组图生成、联网搜索和流式输出。请勿传入 `sequential_image_generation`、`sequential_image_generation_options`、`tools` 或 `stream`。

## 能力示例

以下图片来自火山引擎的 [Seedream 5.0 Pro / Flash 教程](https://docs.volcengine.com/docs/ark/seedream-5-0-pro?lang=zh)。官方使用 Pro 模型制作这些示例，图片用于说明两款模型共同支持的工作流。

> [tab] 文生图
>
> 只传 `prompt` 即可生成一张图片。例如，提示词“白色背景中央的一片绿色叶子图标，扁平风格，无文字”可用于生成图标。普通生成的 `size` 默认是 `2K`，也可指定 `1K`、`1.5K` 或合法的像素尺寸。

> [tab] 图片编辑
>
> 在请求中增加 `image`，传入一张参考图或最多 10 张图片组成的数组。提示词可以描述要保留、修改或融合的内容；需要精确定位时，可使用 `<point>` 和 `<bbox>` 坐标标签。
>
> 官方示例在输入图上标记位置，提示词要求在左下角添加杂志、在右侧添加咖啡杯，并移除草图线条。
>
> ![官方交互编辑示例的输入房间图片，包含手绘标记](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/seedream_50_pro_input2.png)
>
> 输入：带手绘标记的房间照片
>
> ![官方交互编辑示例的输出图片，杂志和咖啡杯已加入房间](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/seedream_50_pro_output2.png)
>
> 输出：在标记区域添加物品后的房间

> [tab] 透明背景
>
> 只输入一张本身带 Alpha 通道的图片，并设置 `background: "transparent"`。输出应使用 PNG；JPEG 不支持透明通道。官方示例要求把输入图层中的鹦鹉改成孔雀，同时保留透明背景。
>
> ![官方透明背景编辑示例的输入鹦鹉图层](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/Seedream50_layer_4.png)
>
> 输入：透明背景的鹦鹉图层
>
> ![官方透明背景编辑示例的输出孔雀图层](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/Seedream50_layer_4_re.png)
>
> 输出：透明背景的孔雀图层

> [tab] 图层拆分
>
> 传入一张 PNG 或 JPEG，并设置 `layer_decomposition: true`。`prompt` 可省略，让模型自动拆出主要元素；也可说明目标元素或使用 `<bbox>` 指定区域。返回一张底图和最多 16 个带透明通道的 PNG 图层。
>
> ![官方图层拆分示例的输入海报，包含文字和鹦鹉](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/seedream_50_pro_layer_input.png)
>
> 输入：待拆分的海报
>
> ![官方图层拆分示例的输出底图](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/Seedream50_layer_0.jpeg)
>
> 输出：移除元素后的底图
>
> ![官方图层拆分示例的透明 PNG 鹦鹉图层](https://arkdocs.tos-cn-beijing.volces.com/images/image-generation/Seedream50_layer_4.png)
>
> 输出：独立透明 PNG 图层
>
> 拆层时 `size` 默认是 `auto`，还可选 `1K`、`1.5K` 或 `2K`；不支持自定义像素尺寸。任一目标图层生成失败时，整个请求失败。

## 调用示例

> [tab] 文生图
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.com.cn/v1/images/generations \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "doubao-seedream-5-0-flash-260915",
>     "prompt": "白色背景中央的一片绿色叶子图标，扁平风格，无文字",
>     "size": "1K",
>     "response_format": "url",
>     "output_format": "jpeg",
>     "watermark": false
>   }'
> ```
>
> ```python Python theme={null}
> import requests
>
> response = requests.post(
>     "https://www.anyfast.com.cn/v1/images/generations",
>     headers={"Authorization": "Bearer YOUR_API_KEY"},
>     json={
>         "model": "doubao-seedream-5-0-flash-260915",
>         "prompt": "白色背景中央的一片绿色叶子图标，扁平风格，无文字",
>         "size": "1K",
>         "response_format": "url",
>         "output_format": "jpeg",
>         "watermark": False,
>     },
> )
> response.raise_for_status()
> print(response.json()["data"][0]["url"])
> ```

> [tab] 图片编辑
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.com.cn/v1/images/generations \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "doubao-seedream-5-0-flash-260915",
>     "prompt": "使用图 1 的构图，并采用图 2 的视觉风格。",
>     "image": [
>       "https://example.com/composition.png",
>       "https://example.com/style.png"
>     ],
>     "size": "1K",
>     "output_format": "jpeg",
>     "watermark": false
>   }'
> ```
>
> ```python Python theme={null}
> import requests
>
> response = requests.post(
>     "https://www.anyfast.com.cn/v1/images/generations",
>     headers={"Authorization": "Bearer YOUR_API_KEY"},
>     json={
>         "model": "doubao-seedream-5-0-flash-260915",
>         "prompt": "使用图 1 的构图，并采用图 2 的视觉风格。",
>         "image": [
>             "https://example.com/composition.png",
>             "https://example.com/style.png",
>         ],
>         "size": "1K",
>         "output_format": "jpeg",
>         "watermark": False,
>     },
> )
> response.raise_for_status()
> print(response.json()["data"][0]["url"])
> ```

> [tab] 透明背景
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.com.cn/v1/images/generations \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "doubao-seedream-5-0-flash-260915",
>     "prompt": "保留主体并优化边缘，同时保持透明背景。",
>     "image": "https://example.com/transparent-source.png",
>     "background": "transparent",
>     "size": "1K",
>     "output_format": "png",
>     "watermark": false
>   }'
> ```
>
> ```python Python theme={null}
> import requests
>
> response = requests.post(
>     "https://www.anyfast.com.cn/v1/images/generations",
>     headers={"Authorization": "Bearer YOUR_API_KEY"},
>     json={
>         "model": "doubao-seedream-5-0-flash-260915",
>         "prompt": "保留主体并优化边缘，同时保持透明背景。",
>         "image": "https://example.com/transparent-source.png",
>         "background": "transparent",
>         "size": "1K",
>         "output_format": "png",
>         "watermark": False,
>     },
> )
> response.raise_for_status()
> print(response.json()["data"][0]["url"])
> ```

> [tab] 图层拆分
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.com.cn/v1/images/generations \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "doubao-seedream-5-0-flash-260915",
>     "prompt": "仅将绿色叶片图标与白色背景分离为一个可编辑图层。",
>     "image": "https://example.com/green-leaf.jpeg",
>     "layer_decomposition": true,
>     "size": "1K",
>     "response_format": "url",
>     "output_format": "jpeg",
>     "watermark": false
>   }'
> ```
>
> ```python Python theme={null}
> import requests
>
> response = requests.post(
>     "https://www.anyfast.com.cn/v1/images/generations",
>     headers={"Authorization": "Bearer YOUR_API_KEY"},
>     json={
>         "model": "doubao-seedream-5-0-flash-260915",
>         "prompt": "仅将绿色叶片图标与白色背景分离为一个可编辑图层。",
>         "image": "https://example.com/green-leaf.jpeg",
>         "layer_decomposition": True,
>         "size": "1K",
>         "response_format": "url",
>         "output_format": "jpeg",
>         "watermark": False,
>     },
> )
> response.raise_for_status()
> print([(item["z_index"], item["url"]) for item in response.json()["data"]])
> ```

## 参数与输出

| 参数 | 文生图 | 图生图（含透明背景） | 图层拆分 | 说明 |
| - | - | - | - | - |
| `model` | 必填 | 必填 | 必填 | 固定为 `doubao-seedream-5-0-flash-260915` |
| `prompt` | 必填 | 必填 | 可选 | 生成、编辑或指定拆分元素的提示词 |
| `image` | 不传 | 必填 | 必填 | 普通编辑最多 10 张；透明背景和拆层均只接受一张 |
| `size` | 可选 | 可选 | 可选 | 普通生成默认 `2K`；拆层默认 `auto` |
| `response_format` | 可选 | 可选 | 可选 | `url`（默认）或 `b64_json`；URL 有效期为 24 小时 |
| `output_format` | 可选 | 可选 | 可选 | `jpeg` 或 `png`；透明背景使用 PNG，拆出的图层固定为 PNG |
| `background` | 不传 | 可选 | 不传 | `transparent` 仅适用于一张带 Alpha 通道的输入图 |
| `layer_decomposition` | 不传 | 不传 | 必填 | 设置为 `true` 开启图层拆分 |
| `watermark` | 可选 | 可选 | 可选 | 是否添加“AI 生成”水印，默认 `true` |
| `optimize_prompt_options.mode` | 可选 | 可选 | 不传 | 普通生成与编辑仅支持 `standard`；不支持 `fast` |

普通生成支持 `1K`、`1.5K`、`2K` 或合法的 `宽x高` 像素尺寸。自定义尺寸总像素数须在 921,600–4,624,220，宽高比在 `[1/16, 16]`。拆层只支持 `auto`、`1K`、`1.5K` 和 `2K`，不支持自定义像素尺寸。

普通参考图支持 `jpeg`、`png`、`webp`、`bmp`、`tiff`、`gif`、`heic` 和 `heif`，单张不超过 30 MB、宽高比在 `[1/16, 16]`、宽和高均大于 14 px、总像素数为 196–36,000,000。拆层仅接受一张 PNG 或 JPEG，总像素数为 262,144–36,000,000，宽高比和大小限制相同。

成功响应中的 `data` 是生成图片列表；拆层模式下包含底图和独立图层，图层还会返回 `z_index`、`bounding_box`、`name` 和 `description`。`usage` 返回输入与输出图片数量及 Token 用量。

> [card] [API 参考](https://docs.anyfast.com.cn/api-reference/model-api/bytedance/doubao-seedream-5-0-flash-260915.md)
>
> 查看 Seedream 5.0 Flash 各能力的完整字段与响应。


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