> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/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`。</Warning>

<Tabs sync={false}>
  <Tab title="文生图">
    ## 创建图片

    `POST /v1/images/generations`

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/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
        }'
      ```
    </div>

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-flash-260915`。</ParamField>
    <ParamField body="prompt" type="string" required>图片生成提示词。中文建议不超过 300 字，英文建议不超过 600 词。</ParamField>
    <ParamField body="size" type="string" default="2K">`1K`、`1.5K`、`2K` 或合法的 `宽x高`。自定义尺寸总像素数须在 921,600–4,624,220，宽高比须在 `[1/16, 16]`。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。URL 有效期为 24 小时。</ParamField>
    <ParamField body="output_format" type="string" default="jpeg">`jpeg` 或 `png`。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加“AI 生成”水印。</ParamField>
    <ParamField body="optimize_prompt_options" type="object">提示词优化配置。</ParamField>
    <ParamField body="optimize_prompt_options.mode" type="string" default="standard">仅支持 `standard`，Flash 不支持 `fast`。</ParamField>

    ### 创建响应

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```json 200 theme={null}
      {
        "model": "dola-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
        }
      }
      ```
    </div>
  </Tab>

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

    `POST /v1/images/generations`

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/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",
          "size": "1K",
          "response_format": "url",
          "output_format": "jpeg",
          "watermark": false
        }'
      ```
    </div>

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-flash-260915`。</ParamField>
    <ParamField body="prompt" type="string" required>编辑或参考生成指令。坐标编辑可使用归一化 `<point>` 和 `<bbox>` 标签。</ParamField>
    <ParamField body="image" type="string | string[]" required>图片 URL、Base64 Data URI，或最多 10 张参考图组成的数组。</ParamField>
    <ParamField body="size" type="string" default="2K">`1K`、`1.5K`、`2K` 或合法的自定义像素尺寸。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。</ParamField>
    <ParamField body="output_format" type="string" default="jpeg">`jpeg` 或 `png`。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加“AI 生成”水印。</ParamField>
    <ParamField body="optimize_prompt_options.mode" type="string" default="standard">仅支持 `standard`，Flash 不支持 `fast`。</ParamField>

    ### 创建响应

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```json 200 theme={null}
      {
        "model": "dola-seedream-5-0-flash-260915",
        "created": 1792129583,
        "data": [
          {
            "url": "https://example.com/seedream-flash-edit.jpeg",
            "size": "1024x1024",
            "output_format": "jpeg"
          }
        ],
        "usage": {
          "input_images": 1,
          "generated_images": 1,
          "output_tokens": 4096,
          "total_tokens": 4096
        }
      }
      ```
    </div>
  </Tab>

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

    `POST /v1/images/generations`

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/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
        }'
      ```
    </div>

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-flash-260915`。</ParamField>
    <ParamField body="prompt" type="string" required>图片编辑指令。</ParamField>
    <ParamField body="image" type="string" required>仅允许 1 张带 Alpha 通道的输入图。PNG 支持透明通道，JPEG 不支持。</ParamField>
    <ParamField body="background" type="string" default="opaque">`transparent` 表示保留透明背景，`opaque` 表示生成普通不透明背景。</ParamField>
    <ParamField body="size" type="string" default="2K">`1K`、`1.5K`、`2K` 或合法的自定义像素尺寸。</ParamField>
    <ParamField body="output_format" type="string" required>`background` 为 `transparent` 时必须使用 `png`。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加“AI 生成”水印。</ParamField>

    ### 创建响应

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```json 200 theme={null}
      {
        "model": "dola-seedream-5-0-flash-260915",
        "created": 1792129634,
        "data": [
          {
            "url": "https://example.com/seedream-flash-transparent.png",
            "size": "1024x1024",
            "output_format": "png"
          }
        ],
        "usage": {
          "input_images": 1,
          "generated_images": 1,
          "output_tokens": 4096,
          "total_tokens": 4096
        }
      }
      ```
    </div>
  </Tab>

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

    `POST /v1/images/generations`

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/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
        }'
      ```
    </div>

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-flash-260915`。</ParamField>
    <ParamField body="prompt" type="string">可选的拆层指令，可使用归一化 `<bbox>` 坐标指定元素。</ParamField>
    <ParamField body="image" type="string" required>仅允许 1 张 PNG 或 JPEG。</ParamField>
    <ParamField body="layer_decomposition" type="boolean" required>设为 `true`，返回 1 张底图和最多 16 个可编辑图层。</ParamField>
    <ParamField body="size" type="string" default="auto">`auto`、`1K`、`1.5K` 或 `2K`；该模式不支持自定义像素尺寸。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。</ParamField>
    <ParamField body="output_format" type="string" default="jpeg">仅控制底图格式；拆出的图层始终为 PNG。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加“AI 生成”水印。</ParamField>

    ### 创建响应

    <div className="kling-api-example-panel seedream-api-example-panel">
      ```json 200 theme={null}
      {
        "model": "dola-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": "green leaf icon",
            "description": "Extract the complete green leaf icon with leaf blade, veins and petiole, no other background elements included"
          }
        ],
        "usage": {
          "input_images": 1,
          "generated_images": 2,
          "output_tokens": 8549,
          "total_tokens": 8549
        }
      }
      ```
    </div>
  </Tab>
</Tabs>

## 请求头

<ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
<ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

## 响应字段

<ResponseField name="model" type="string">供应商模型名称。本模型通过 AnyFast 成功调用时返回 `dola-seedream-5-0-flash-260915`。</ResponseField>
<ResponseField name="created" type="integer">Unix 秒级创建时间戳。</ResponseField>
<ResponseField name="data" type="object[]">生成图片；拆层模式下为底图和拆出的图层。</ResponseField>
<ResponseField name="data[].url" type="string">`response_format` 为 `url` 时返回的临时图片链接。</ResponseField>
<ResponseField name="data[].b64_json" type="string">`response_format` 为 `b64_json` 时返回的 Base64 图片数据。</ResponseField>
<ResponseField name="data[].output_format" type="string">输出图片格式。</ResponseField>
<ResponseField name="data[].size" type="string">输出图片尺寸。</ResponseField>
<ResponseField name="data[].z_index" type="integer">拆层模式下的图层顺序，底图为 `0`。</ResponseField>
<ResponseField name="data[].name" type="string">拆层模式下模型生成的图层名称。</ResponseField>
<ResponseField name="data[].description" type="string">拆层模式下模型生成的图层描述。</ResponseField>
<ResponseField name="data[].bounding_box.absolute" type="integer[]">图层在输出底图中的 `[left, top, right, bottom]` 像素坐标。</ResponseField>
<ResponseField name="data[].bounding_box.normalized" type="integer[]">图层边界映射到 1000 × 1000 坐标系后的坐标。</ResponseField>
<ResponseField name="data[].error" type="object">可选的单张图片生成失败信息。</ResponseField>
<ResponseField name="data[].error.code" type="string">单张图片错误码，存在时返回。</ResponseField>
<ResponseField name="data[].error.message" type="string">单张图片错误信息，存在时返回。</ResponseField>
<ResponseField name="usage.generated_images" type="integer">生成结果数；拆层模式下包含底图和所有图层。</ResponseField>
<ResponseField name="usage.input_images" type="integer">输入图片数。</ResponseField>
<ResponseField name="usage.output_tokens" type="integer">输出 Token 数。</ResponseField>
<ResponseField name="usage.total_tokens" type="integer">总 Token 数。</ResponseField>
<ResponseField name="error" type="object">请求级错误信息。</ResponseField>
<ResponseField name="error.code" type="string">请求级错误码。</ResponseField>
<ResponseField name="error.message" type="string">请求级错误说明。</ResponseField>
<ResponseField name="error.type" type="string">AnyFast 返回的错误类别（如有）。</ResponseField>
<ResponseField name="error.param" type="string">上游接口返回的错误参数名称（如有）。</ResponseField>

## 错误响应

<div className="kling-api-example-panel seedream-api-example-panel">
  <Tabs sync={false}>
    <Tab title="400">
      请求参数非法，或当前模型不支持传入的参数。

      ```json theme={null}
      {
        "error": {
          "message": "The parameter is not supported by the current model.",
          "type": "BadRequest",
          "param": "sequential_image_generation",
          "code": "InvalidParameter"
        }
      }
      ```
    </Tab>

    <Tab title="401">
      API Key 缺失或无效。

      ```json theme={null}
      {
        "error": {
          "code": "",
          "message": "Invalid token (request id: REQUEST_ID)",
          "type": "new_api_error"
        }
      }
      ```
    </Tab>

    <Tab title="429">
      请求超过当前限流。

      ```json theme={null}
      {
        "error": {
          "code": "rate_limit_exceeded",
          "message": "Rate limit exceeded"
        }
      }
      ```
    </Tab>
  </Tabs>
</div>

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


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