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

> Seedream 5.0 Flash 图片生成、编辑、透明背景和图层拆分 API。

使用 `doubao-seedream-5-0-flash-260915` 调用同步图片生成接口。请切换能力 Tab 查看对应的请求和响应结构。

> [!WARNING]
>
> 该模型不支持组图生成、联网搜索和流式输出。请勿传入 `sequential_image_generation`、`sequential_image_generation_options`、`tools` 或 `stream`。

> [tab] 文生图
>
> ## 生成图片
>
> `POST /v1/images/generations`
>
> ```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,
>     "optimize_prompt_options": { "mode": "standard" }
>   }'
> ```
>
> ## 请求头
>
> **Authorization** `string` *required*
>
> Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。
>
> **Content-Type** `string` *required* (default: application/json)
>
> 请求体格式。
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `doubao-seedream-5-0-flash-260915`。
>
> **prompt** `string` *required*
>
> 图片生成提示词。中文建议不超过 300 字，英文建议不超过 600 词。
>
> **size** `string` (default: 2K)
>
> `1K`、`1.5K`、`2K` 或合法的 `宽x高`。自定义尺寸总像素数须在 921,600–4,624,220，宽高比须在 `[1/16, 16]`。
>
> **response\_format** `string` (default: url)
>
> `url` 或 `b64_json`。URL 有效期为 24 小时。
>
> **output\_format** `string` (default: jpeg)
>
> `jpeg` 或 `png`。
>
> **watermark** `boolean` (default: true)
>
> 是否添加“AI 生成”水印。
>
> **optimize\_prompt\_options** `object`
>
> 提示词优化配置。
>
> **optimize\_prompt\_options.mode** `string` (default: standard)
>
> 仅支持 `standard`；Flash 不支持 `fast`。
>
> ## 生成响应
>
> ```json 200 theme={null}
> {
>   "model": "doubao-seedream-5-0-flash-260915",
>   "created": 1792129491,
>   "data": [{
>     "url": "https://example.com/seedream-flash-text.jpeg",
>     "size": "1024x1024",
>     "output_format": "jpeg"
>   }],
>   "usage": {
>     "input_images": 0,
>     "generated_images": 1,
>     "output_tokens": 4096,
>     "total_tokens": 4096
>   }
> }
> ```
>
> **model** `string`
>
> 本次请求使用的模型 ID。
>
> **created** `integer`
>
> 请求创建时间，Unix 秒级时间戳。
>
> **data** `object[]`
>
> 生成图片列表。
>
> **data\[].url** `string`
>
> `response_format` 为 `url` 时返回的临时图片链接。
>
> **data\[].b64\_json** `string`
>
> `response_format` 为 `b64_json` 时返回的 Base64 图片数据。
>
> **data\[].size** `string`
>
> 生成图片尺寸。
>
> **data\[].output\_format** `string`
>
> 输出图片格式。
>
> **usage** `object`
>
> 本次调用的用量信息。
>
> **usage.input\_images** `integer`
>
> 输入图片数量。
>
> **usage.generated\_images** `integer`
>
> 生成图片数量。
>
> **usage.output\_tokens** `integer`
>
> 输出 Token 数量。
>
> **usage.total\_tokens** `integer`
>
> 总 Token 数量。

> [tab] 图片编辑
>
> ## 生成图片
>
> `POST /v1/images/generations`
>
> ```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",
>     "response_format": "url",
>     "output_format": "jpeg",
>     "watermark": false
>   }'
> ```
>
> ## 请求头
>
> **Authorization** `string` *required*
>
> Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。
>
> **Content-Type** `string` *required* (default: application/json)
>
> 请求体格式。
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `doubao-seedream-5-0-flash-260915`。
>
> **prompt** `string` *required*
>
> 编辑或参考生成指令。坐标编辑可使用归一化 `<point>` 和 `<bbox>` 标签。
>
> **image** `string | string[]` *required*
>
> 图片 URL、Base64 Data URI，或最多 10 张参考图组成的数组。
>
> **size** `string` (default: 2K)
>
> `1K`、`1.5K`、`2K` 或合法的自定义像素尺寸。
>
> **response\_format** `string` (default: url)
>
> `url` 或 `b64_json`。
>
> **output\_format** `string` (default: jpeg)
>
> `jpeg` 或 `png`。
>
> **watermark** `boolean` (default: true)
>
> 是否添加“AI 生成”水印。
>
> **optimize\_prompt\_options** `object`
>
> 提示词优化配置。
>
> **optimize\_prompt\_options.mode** `string` (default: standard)
>
> 仅支持 `standard`。
>
> > [!NOTE]
> >
> > 普通参考图支持 jpeg、png、webp、bmp、tiff、gif、heic 和 heif。单张图片小于 30 MB，宽高比在 `[1/16, 16]`，宽和高均大于 14 px，总像素数不超过 36,000,000。
>
> ## 生成响应
>
> ```json 200 theme={null}
> {
>   "model": "doubao-seedream-5-0-flash-260915",
>   "created": 1792129583,
>   "data": [{
>     "url": "https://example.com/seedream-flash-edit.jpeg",
>     "size": "1024x1024",
>     "output_format": "jpeg"
>   }],
>   "usage": {
>     "input_images": 2,
>     "generated_images": 1,
>     "output_tokens": 4096,
>     "total_tokens": 4096
>   }
> }
> ```
>
> **model** `string`
>
> 本次请求使用的模型 ID。
>
> **created** `integer`
>
> 请求创建时间，Unix 秒级时间戳。
>
> **data** `object[]`
>
> 生成图片列表。
>
> **data\[].url** `string`
>
> `response_format` 为 `url` 时返回的临时图片链接。
>
> **data\[].b64\_json** `string`
>
> `response_format` 为 `b64_json` 时返回的 Base64 图片数据。
>
> **data\[].size** `string`
>
> 生成图片尺寸。
>
> **data\[].output\_format** `string`
>
> 输出图片格式。
>
> **usage** `object`
>
> 本次调用的用量信息。
>
> **usage.input\_images** `integer`
>
> 输入图片数量。
>
> **usage.generated\_images** `integer`
>
> 生成图片数量。
>
> **usage.output\_tokens** `integer`
>
> 输出 Token 数量。
>
> **usage.total\_tokens** `integer`
>
> 总 Token 数量。

> [tab] 透明背景
>
> ## 生成图片
>
> `POST /v1/images/generations`
>
> ```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",
>     "response_format": "url",
>     "output_format": "png",
>     "watermark": false
>   }'
> ```
>
> ## 请求头
>
> **Authorization** `string` *required*
>
> Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。
>
> **Content-Type** `string` *required* (default: application/json)
>
> 请求体格式。
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `doubao-seedream-5-0-flash-260915`。
>
> **prompt** `string` *required*
>
> 图片编辑指令。
>
> **image** `string` *required*
>
> 仅允许 1 张带 Alpha 通道的输入图。PNG 支持透明通道，JPEG 不支持。
>
> **background** `string` (default: opaque)
>
> `transparent` 表示保留透明背景，`opaque` 表示生成普通不透明背景。
>
> **size** `string` (default: 2K)
>
> `1K`、`1.5K`、`2K` 或合法的自定义像素尺寸。
>
> **output\_format** `string`
>
> `background` 为 `transparent` 时，省略此字段会默认输出 PNG；显式设置时仅可用 `png`，不可用 `jpeg`。
>
> **response\_format** `string` (default: url)
>
> `url` 或 `b64_json`。
>
> **watermark** `boolean` (default: true)
>
> 是否添加“AI 生成”水印。
>
> **optimize\_prompt\_options** `object`
>
> 提示词优化配置。
>
> **optimize\_prompt\_options.mode** `string` (default: standard)
>
> 仅支持 `standard`。
>
> ## 生成响应
>
> ```json 200 theme={null}
> {
>   "model": "doubao-seedream-5-0-flash-260915",
>   "created": 1792129634,
>   "data": [{
>     "url": "https://example.com/seedream-flash-transparent.png",
>     "size": "640x1600",
>     "output_format": "png"
>   }],
>   "usage": {
>     "input_images": 1,
>     "generated_images": 1,
>     "output_tokens": 4000,
>     "total_tokens": 4000
>   }
> }
> ```
>
> **model** `string`
>
> 本次请求使用的模型 ID。
>
> **created** `integer`
>
> 请求创建时间，Unix 秒级时间戳。
>
> **data** `object[]`
>
> 生成图片列表。
>
> **data\[].url** `string`
>
> `response_format` 为 `url` 时返回的临时图片链接。
>
> **data\[].b64\_json** `string`
>
> `response_format` 为 `b64_json` 时返回的 Base64 图片数据。
>
> **data\[].size** `string`
>
> 生成图片尺寸。
>
> **data\[].output\_format** `string`
>
> 输出图片格式。
>
> **usage** `object`
>
> 本次调用的用量信息。
>
> **usage.input\_images** `integer`
>
> 输入图片数量。
>
> **usage.generated\_images** `integer`
>
> 生成图片数量。
>
> **usage.output\_tokens** `integer`
>
> 输出 Token 数量。
>
> **usage.total\_tokens** `integer`
>
> 总 Token 数量。

> [tab] 图层拆分
>
> ## 生成图片
>
> `POST /v1/images/generations`
>
> ```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
>   }'
> ```
>
> ## 请求头
>
> **Authorization** `string` *required*
>
> Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。
>
> **Content-Type** `string` *required* (default: application/json)
>
> 请求体格式。
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `doubao-seedream-5-0-flash-260915`。
>
> **prompt** `string`
>
> 可选的拆层指令，可使用归一化 `<bbox>` 坐标指定元素。
>
> **image** `string` *required*
>
> 仅允许 1 张 PNG 或 JPEG。
>
> **layer\_decomposition** `boolean` *required*
>
> 设为 `true`，返回 1 张底图和最多 16 个可编辑图层。
>
> **size** `string` (default: auto)
>
> `auto`、`1K`、`1.5K` 或 `2K`；该模式不支持自定义像素尺寸。
>
> **response\_format** `string` (default: url)
>
> `url` 或 `b64_json`。
>
> **output\_format** `string` (default: jpeg)
>
> 仅控制底图格式；拆出的图层始终为 PNG。
>
> **watermark** `boolean` (default: true)
>
> 是否添加“AI 生成”水印。
>
> > [!NOTE]
> >
> > 拆层输入图总像素数须在 262,144 到 36,000,000 之间，宽高比须在 `[1/16, 16]`，文件小于 30 MB。任一目标图层失败时，整个请求失败。
>
> ## 生成响应
>
> ```json 200 theme={null}
> {
>   "model": "doubao-seedream-5-0-flash-260915",
>   "created": 1792129605,
>   "data": [
>     {
>       "url": "https://example.com/seedream-flash-layer-0.jpeg",
>       "size": "1024x1024",
>       "output_format": "jpeg",
>       "z_index": 0
>     },
>     {
>       "url": "https://example.com/seedream-flash-layer-1.png",
>       "size": "662x855",
>       "output_format": "png",
>       "z_index": 1,
>       "bounding_box": {
>         "absolute": [305, 251, 729, 800],
>         "normalized": [298, 245, 711, 780]
>       },
>       "name": "绿色叶片图标",
>       "description": "从原图中拆出的透明背景绿色叶片图标"
>     }
>   ],
>   "usage": {
>     "input_images": 1,
>     "generated_images": 2,
>     "output_tokens": 8549,
>     "total_tokens": 8549
>   }
> }
> ```
>
> **model** `string`
>
> 本次请求使用的模型 ID。
>
> **created** `integer`
>
> 请求创建时间，Unix 秒级时间戳。
>
> **data** `object[]`
>
> 生成图片列表。
>
> **data\[].url** `string`
>
> `response_format` 为 `url` 时返回的临时图片链接。
>
> **data\[].b64\_json** `string`
>
> `response_format` 为 `b64_json` 时返回的 Base64 图片数据。
>
> **data\[].size** `string`
>
> 生成图片尺寸。
>
> **data\[].output\_format** `string`
>
> 输出图片格式。
>
> **data\[].z\_index** `integer`
>
> 图层顺序，底图为 `0`。
>
> **data\[].bounding\_box** `object`
>
> 图层在输出底图中的边界框。
>
> **data\[].bounding\_box.absolute** `integer[]`
>
> 图层的 `[left, top, right, bottom]` 像素坐标。
>
> **data\[].bounding\_box.normalized** `integer[]`
>
> 映射到 1000 × 1000 坐标系的边界框。
>
> **data\[].name** `string`
>
> 图层名称。
>
> **data\[].description** `string`
>
> 图层内容描述。
>
> **usage** `object`
>
> 本次调用的用量信息。
>
> **usage.input\_images** `integer`
>
> 输入图片数量。
>
> **usage.generated\_images** `integer`
>
> 生成图片数量。
>
> **usage.output\_tokens** `integer`
>
> 输出 Token 数量。
>
> **usage.total\_tokens** `integer`
>
> 总 Token 数量。

## 支持的尺寸

普通图片生成与编辑支持 `1K`、`1.5K`、`2K` 或合法的 `宽x高` 像素尺寸，默认 `2K`。自定义尺寸总像素数须在 921,600–4,624,220，宽高比须在 `[1/16, 16]`。

图层拆分支持 `auto`、`1K`、`1.5K` 和 `2K`，默认 `auto`，不支持自定义像素尺寸。拆层输入仅限一张 PNG 或 JPEG，总像素数须在 262,144–36,000,000，宽高比须在 `[1/16, 16]`，文件大小不超过 30 MB。


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