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

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

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

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

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

<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-pro-260628",
        "prompt": "为智能音箱生成一张高端产品主视觉图，版式干净",
        "size": "2K",
        "response_format": "url",
        "output_format": "png",
        "watermark": false,
        "optimize_prompt_options": { "mode": "standard" }
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-pro-260628`。</ParamField>
    <ParamField body="prompt" type="string" required>图片生成提示词。</ParamField>
    <ParamField body="size" type="string">`1K`、`2K` 或明确像素尺寸，如 `2048x1024`。明确尺寸必须满足总像素和宽高比限制。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。URL 为临时链接，请及时保存。</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">提示词优化模式，仅支持 `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": "doubao-seedream-5-0-pro-260628",
        "prompt": "在标记区域添加一个陶瓷咖啡杯，并保持原始构图",
        "image": ["https://example.com/reference.png"],
        "size": "2K",
        "response_format": "url",
        "output_format": "png",
        "watermark": false
      }'
    ```

    <ParamField body="model" type="string" required>固定为 `doubao-seedream-5-0-pro-260628`。</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">`1K`、`2K` 或明确像素尺寸。</ParamField>
    <ParamField body="response_format" type="string" default="url">`url` 或 `b64_json`。URL 为临时链接，请及时保存。</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">提示词优化模式，仅支持 `standard`。</ParamField>

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

## 尺寸限制

分辨率档位支持 `1K` 和 `2K`。使用明确的 `widthxheight` 尺寸时，总像素范围为 `1280x720` 至 `2048x2048x1.1025`，宽高比范围为 `[1/16, 16]`。

## 请求头

<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-pro-260628",
  "created": 1775029815,
  "data": [{
    "url": "https://example.com/generated-image.png",
    "output_format": "png",
    "size": "2048x2048"
  }],
  "usage": {
    "generated_images": 1,
    "input_images": 0,
    "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[].output_format" type="string">生成图片格式。</ResponseField>
<ResponseField name="data[].size" type="string">生成图片尺寸。</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>

## 错误响应

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

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

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

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

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

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

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