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

> Seedream 5.0 文生图与图生图 API。

使用 `doubao-seedream-5-0-260128` 通过同一个同步接口完成文生图和图生图。

<Tabs>
  <Tab title="文生图">
    ## 创建图片

    `POST /v1/images/generations`

    ```bash cURL theme={null}
    curl --request POST \
      --url https://www.anyfast.ai/v1/images/generations \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '{
        "model": "doubao-seedream-5-0-260128",
        "prompt": "日出时分宁静的山景，山谷间弥漫着薄雾",
        "size": "2048x2048",
        "seed": 42,
        "watermark": false,
        "logo_info": { "add_logo": false }
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-260128`。</ParamField>
    <ParamField body="prompt" type="string" required>图片生成提示词。</ParamField>
    <ParamField body="size" type="string">输出图片尺寸，如 `2048x2048` 或 `2K`。</ParamField>
    <ParamField body="watermark" type="boolean" default={false}>是否添加水印。</ParamField>
    <ParamField body="seed" type="integer">随机种子。</ParamField>
    <ParamField body="logo_info" type="object">自定义 Logo 水印配置。</ParamField>
    <ParamField body="logo_info.add_logo" type="boolean">是否添加 Logo。</ParamField>
    <ParamField body="logo_info.position" type="integer">Logo 位置。</ParamField>
    <ParamField body="logo_info.language" type="integer">Logo 语言。</ParamField>
    <ParamField body="logo_info.opacity" type="number">Logo 透明度。</ParamField>
  </Tab>

  <Tab title="图生图">
    ## 创建图片

    `POST /v1/images/generations`

    ```bash cURL theme={null}
    curl --request POST \
      --url https://www.anyfast.ai/v1/images/generations \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '{
        "model": "doubao-seedream-5-0-260128",
        "prompt": "生成女孩和奶牛玩偶在游乐园开心地坐过山车的三张连贯图片",
        "image": [
          "https://example.com/ref1.png",
          "https://example.com/ref2.png"
        ],
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": { "max_images": 3 },
        "size": "2K",
        "watermark": false
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-260128`。</ParamField>
    <ParamField body="prompt" type="string" required>图片编辑或参考图生成指令。</ParamField>
    <ParamField body="image" type="string[]" required>参考图片 URL 数组。</ParamField>
    <ParamField body="sequential_image_generation" type="string">设为 `auto` 开启连续图片生成。</ParamField>
    <ParamField body="sequential_image_generation_options.max_images" type="integer">最大生成数量。</ParamField>
    <ParamField body="size" type="string">输出图片尺寸，如 `2048x2048` 或 `2K`。</ParamField>
    <ParamField body="watermark" type="boolean" default={false}>是否添加水印。</ParamField>
    <ParamField body="seed" type="integer">随机种子。</ParamField>
    <ParamField body="logo_info" type="object">自定义 Logo 水印配置。</ParamField>

    <Warning>外部图片链接被上游下载时，如果耗时超过 10 秒，请求可能超时。请使用加载稳定的图片 URL，或改用 Base64 data URI。</Warning>
  </Tab>
</Tabs>

## 支持的尺寸

文档列出的明确像素尺寸包括：`2048x2048`、`1728x2304`、`2304x1728`、`2848x1600`、`1600x2848`、`2496x1664`、`1664x2496`、`3136x1344`、`3072x3072`、`2592x3456`、`3456x2592`、`4096x2304`、`2304x4096`、`2496x3744`、`3744x2496` 和 `4704x2016`。

## 请求头

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

## 响应

```json 200 theme={null}
{
  "model": "doubao-seedream-5-0-260128",
  "created": 1775029815,
  "data": [{
    "url": "https://example.com/generated-image.png",
    "size": "2048x2048"
  }],
  "usage": {
    "generated_images": 1,
    "output_tokens": 16384,
    "total_tokens": 16384
  }
}
```

<ResponseField name="model" type="string">本次请求使用的模型 ID。</ResponseField>
<ResponseField name="created" type="integer">请求创建时间，Unix 秒级时间戳。</ResponseField>
<ResponseField name="data" type="object[]">生成图片列表。</ResponseField>
<ResponseField name="data[].url" type="string">生成图片 URL。</ResponseField>
<ResponseField name="data[].size" type="string">生成图片尺寸。</ResponseField>
<ResponseField name="usage.generated_images" type="integer">成功生成的图片数量。</ResponseField>
<ResponseField name="usage.output_tokens" type="integer">输出 token 数量。</ResponseField>
<ResponseField name="usage.total_tokens" type="integer">总 token 数量。</ResponseField>

## 错误响应

* `401 Unauthorized` — API 密钥缺失或无效。
* `429 Rate limit exceeded` — 请求超过适用的速率限制。

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