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

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

使用 `seedream-5-0-lite-260128` 通过同一个同步接口完成单图、图片编辑和连贯组图生成。

<Info>对于特定内容请求，请选择 **Special-Ns** 资源分组。</Info>

<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": "seedream-5-0-lite-260128",
        "prompt": "生成四张连贯的电影分镜，展示宇航员维修飞船的过程",
        "size": "2K",
        "seed": 42,
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": { "max_images": 4 },
        "response_format": "url",
        "output_format": "png",
        "watermark": false,
        "optimize_prompt_options": { "mode": "standard" }
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `seedream-5-0-lite-260128`。</ParamField>
    <ParamField body="prompt" type="string" required>图片生成提示词。</ParamField>
    <ParamField body="size" type="string">`2K`、`3K`、`4K` 或受支持的明确像素尺寸。</ParamField>
    <ParamField body="seed" type="integer">随机种子。</ParamField>
    <ParamField body="sequential_image_generation" type="string" default="disabled">`auto` 开启组图；`disabled` 生成单图。</ParamField>
    <ParamField body="sequential_image_generation_options.max_images" type="integer">组图最大生成数量。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。URL 有效期为 24 小时。</ParamField>
    <ParamField body="output_format" type="string" default="jpeg">`png` 或 `jpeg`。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加 AI 生成水印。</ParamField>
    <ParamField body="optimize_prompt_options.mode" type="string" default="standard">提示词优化模式。</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": "seedream-5-0-lite-260128",
        "prompt": "将图一人物的服装替换为图二的服装，保留身份、姿势和背景",
        "image": [
          "https://example.com/person.png",
          "https://example.com/outfit.png"
        ],
        "size": "2K",
        "response_format": "url",
        "output_format": "png",
        "watermark": false
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `seedream-5-0-lite-260128`。</ParamField>
    <ParamField body="prompt" type="string" required>图片编辑或参考图生成指令。</ParamField>
    <ParamField body="image" type="string | string[]" required>图片 URL、Base64 data URI 或参考图数组，最多 14 张。</ParamField>
    <ParamField body="size" type="string">`2K`、`3K`、`4K` 或受支持的明确像素尺寸。</ParamField>
    <ParamField body="seed" type="integer">随机种子。</ParamField>
    <ParamField body="sequential_image_generation" type="string" default="disabled">`auto` 开启组图；`disabled` 生成单图。</ParamField>
    <ParamField body="sequential_image_generation_options.max_images" type="integer">组图最大生成数量；参考图与生成图总数不超过 15。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。URL 有效期为 24 小时。</ParamField>
    <ParamField body="output_format" type="string" default="jpeg">`png` 或 `jpeg`。</ParamField>
    <ParamField body="watermark" type="boolean" default={true}>是否添加 AI 生成水印。</ParamField>
    <ParamField body="optimize_prompt_options.mode" type="string" default="standard">提示词优化模式。</ParamField>

    <Note>输入支持 jpeg、png、webp、bmp、tiff、gif、heic、heif；单张不超过 30 MB；宽高比为 `[1/16, 16]`；宽高均大于 14 px；单张总像素不超过 36,000,000。</Note>
  </Tab>
</Tabs>

## 请求头

<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": "seedream-5-0-lite-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">`response_format` 为 `url` 时返回的临时图片链接。</ResponseField>
<ResponseField name="data[].b64_json" type="string">`response_format` 为 `b64_json` 时返回的 Base64 数据。</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>

## 错误响应

错误响应通过 `error` 对象返回 `code`、`message` 和 `type` 字段。

<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">错误类型。</ResponseField>

<Tabs>
  <Tab title="400">
    请求无效，或包含不支持的参数值。

    ```json theme={null}
    { "error": { "code": "invalid_request_error", "message": "Invalid request parameter", "type": "invalid_request_error" } }
    ```
  </Tab>

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

    ```json theme={null}
    { "error": { "code": "unauthorized", "message": "Invalid API key", "type": "authentication_error" } }
    ```
  </Tab>

  <Tab title="429">
    请求超过速率限制。

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

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