> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powertokens.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Seedream 4.5 图生图

> 支持模型包括 `seedream-4-5-251128`。本文档覆盖图生图与多图参考生成场景。公开字段包括 `model`、`prompt`、`image`、`size`、`seed`、`sequential_image_generation`、`sequential_image_generation_options`、`response_format`、`watermark`。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelImage/byteplus/seedream-4-5-image-to-image.json POST /v1/images/generations
openapi: 3.0.1
info:
  title: Seedream 4.5 图生图
  version: 1.0.0
  description: Seedream 系列图生图与多图参考能力文档。公开统一入口为 `/v1/images/generations`。
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API 服务地址
security: []
tags:
  - name: Seedream Image
    description: Seedream 系列图像生成能力
paths:
  /v1/images/generations:
    post:
      tags:
        - Seedream Image
      summary: Seedream 4.5 图生图
      description: >-
        支持模型包括 `seedream-4-5-251128`。本文档覆盖图生图与多图参考生成场景。公开字段包括
        `model`、`prompt`、`image`、`size`、`seed`、`sequential_image_generation`、`sequential_image_generation_options`、`response_format`、`watermark`。
      operationId: byteplusImageToImage45
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageToImageRequest'
            examples:
              image_to_image:
                summary: 基础图生图
                value:
                  model: seedream-4-5-251128
                  prompt: 将图片转换为宫崎骏动画风格
                  image: https://example.com/input.jpg
                  size: 2048x2048
              multi_image_reference:
                summary: 多图参考生成
                value:
                  model: seedream-4-5-251128
                  prompt: 结合这些图片的风格，生成一张新的风景图
                  image:
                    - https://example.com/ref1.jpg
                    - https://example.com/ref2.jpg
      responses:
        '200':
          description: 调用成功，返回图像生成结果。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
        '400':
          description: 请求参数不合法。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: 参数错误
                  value:
                    error:
                      message: 请求体格式错误或字段取值非法
                      type: invalid_request_error
                      code: bad_request_body
                      param: ''
        '401':
          description: 鉴权失败，例如未提供令牌或令牌无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: 未授权
                  value:
                    error:
                      message: 无效的令牌
                      type: api_error
                      code: access_denied
                      param: ''
        '429':
          description: 触发速率限制或账户额度不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: 额度不足或速率受限
                  value:
                    error:
                      message: 当前账户额度不足，请稍后重试
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
        '500':
          description: 服务端处理请求时发生内部错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: 内部处理失败
                  value:
                    error:
                      message: 服务内部处理失败，请稍后重试
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
      security:
        - BearerAuth: []
components:
  schemas:
    ImageToImageRequest:
      type: object
      required:
        - model
        - prompt
        - image
      properties:
        model:
          type: string
          enum:
            - seedream-4-5-251128
          description: 图像生成模型名称。支持的模型包括 `seedream-4-5-251128`。
        prompt:
          type: string
          description: >-
            用于生成图像的提示词，支持中英文。建议不超过 300 个汉字或 600
            个英文单词。字数过多信息容易分散，模型可能因此忽略细节，只关注重点，造成图片缺失部分元素。
          example: 充满活力的特写编辑肖像，模特眼神犀利，头戴雕塑感帽子，色彩拼接丰富。
        image:
          oneOf:
            - type: string
              description: 输入的图片信息，支持 URL 或 Base64 编码。
            - type: array
              description: 输入的多张图片信息，支持 URL 或 Base64 编码。
              items:
                type: string
              maxItems: 14
          description: >-
            输入的图片信息，支持 URL 或 Base64 编码。seedream 4.0 支持单图或多图输入。


            - 图片 URL：请确保图片 URL 可被访问。

            - Base64 编码：请遵循此格式 `data:image/<图片格式>;base64,<Base64编码>`。注意 `<图片格式>`
            需小写，如 `data:image/png;base64,<base64_image>`。


            说明：

            - 传入单张图片要求：
              - 图片格式：jpeg、png（seedream 4.0 新增支持 webp、bmp、tiff、gif、heic、heif 格式）
              - 宽高比（宽/高）范围：[1/16, 16]（适用模型：seedream 4.0）
              - 宽高长度（px） > 14
              - 大小：不超过 30MB
              - 总像素：不超过 6000×6000 = 36000000 px（对单张图宽度和高度的像素乘积限制，而不是对宽度或高度的单独值进行限制）
            - seedream 4.0 最多支持传入 14 张参考图。
        size:
          type: string
          x-enum:
            - 2K
            - 4K
          description: >+
            指定生成图像的尺寸信息。不同模型支持的尺寸方式存在差异。


            **seedream-4-5-251128**：

            指定生成图像的尺寸信息，支持以下两种方式，不可混用。


            * 方式 1 | 指定生成图像的宽高像素值：
              * 默认值：`2048x2048`
              * 总像素取值范围：[`2560x1440`（3686400）, `4096x4096`（16777216）]
              * 宽高比取值范围：[1/16, 16]

              > 说明：采用方式 1 时，需同时满足总像素取值范围和宽高比取值范围。其中，总像素是对单张图宽度和高度的像素乘积限制，而不是对宽度或高度的单独值进行限制。
              > * 有效示例：`3750x1250`
                总像素值 3750x1250=4687500，符合 [3686400, 16777216] 的区间要求；宽高比 3750/1250=3，符合 [1/16, 16] 的区间要求，故该示例值有效。
              > * 无效示例：`1500x1500`
                总像素值 1500x1500=2250000，未达到 3686400 的最低要求；宽高 1500/1500=1，虽符合 [1/16, 16] 的区间要求，但因其未同时满足两项限制，故该示例值无效。

            * 方式 2 | 指定生成图像的分辨率，并在 prompt
            中用自然语言描述图片宽高比、图片形状或图片用途，最终由模型判断生成图片的大小。
              * 可选值：`2K`、`4K`

              说明：采用方式 2 并在 prompt 中描述特定宽高比时，模型实际映射的宽高像素参考值：

              | 分辨率 | 宽高比 | 宽高像素值 |
              |---|---|---|
              | 2K | 1:1 | 2048x2048 |
              | | 4:3 | 2304x1728 |
              | | 3:4 | 1728x2304 |
              | | 16:9 | 2848x1600 |
              | | 9:16 | 1600x2848 |
              | | 3:2 | 2496x1664 |
              | | 2:3 | 1664x2496 |
              | | 21:9 | 3136x1344 |
              | 4K | 1:1 | 4096x4096 |
              | | 4:3 | 4704x3520 |
              | | 3:4 | 3520x4704 |
              | | 16:9 | 5504x3040 |
              | | 9:16 | 3040x5504 |
              | | 3:2 | 4992x3328 |
              | | 2:3 | 3328x4992 |
              | | 21:9 | 6240x2656 |

          default: 2K
          example: 2048x2048
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: |-
            指定生成图像的返回格式。支持以下两种返回方式：
            - `url`：返回图片下载链接；链接在图片生成后 24 小时内有效，请及时下载图片。
            - `b64_json`：以 Base64 编码字符串的 JSON 格式返回图像数据。
          default: url
        seed:
          type: integer
          description: 随机数种子。部分 Seedream 模型支持。取值范围 [-1, 2147483647]。
          default: -1
          minimum: -1
          maximum: 2147483647
        sequential_image_generation:
          type: string
          enum:
            - auto
            - disabled
          description: |-
            控制是否关闭组图功能。
            - `auto`：自动判断模式，模型会根据用户提供的提示词自主判断是否返回组图以及组图包含的图片数量。
            - `disabled`：关闭组图功能，模型只会生成一张图。

            仅 seedream 5.0/4.5/4.0 支持该参数。
          default: disabled
        sequential_image_generation_options:
          type: object
          description: |-
            组图功能的配置。仅当 `sequential_image_generation` 为 `auto` 时生效。

            仅 seedream 5.0/4.5/4.0 支持该参数。
          properties:
            max_images:
              type: integer
              description: >-
                指定本次请求，最多可生成的图片数量。

                - 取值范围：[1, 15]


                说明：实际可生成的图片数量，除受到 `max_images` 影响外，还受到输入的参考图数量影响。输入的参考图数量 +
                最终生成的图片数量 ≤ 15 张。
              minimum: 1
              maximum: 15
              default: 15
        watermark:
          type: boolean
          description: |-
            是否在生成的图片中添加水印。
            - `false`：不添加水印。
            - `true`：在图片右下角添加「AI生成」字样的水印标识。
          default: true
    ImageGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: 创建时间的 Unix 时间戳（秒）。
        data:
          type: array
          items:
            $ref: '#/components/schemas/ImageData'
          description: 生成的图像列表。组图场景下可能包含多张图片。
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
    ImageData:
      type: object
      properties:
        url:
          type: string
          description: 图片下载链接。有效期 24 小时，请及时保存。
        b64_json:
          type: string
          description: Base64 编码的图片数据。
        size:
          type: string
          description: 图像尺寸（宽x高）。仅 seedream-5.0-lite/4.5/4.0 返回。
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````