Claude Opus 5.5 已在 SeedRouter 上线

Image

Seedream 5.5

View Markdown

调用 Seedream 5.5 进行文生图、使用最多 10 张参考图编辑、透明背景生成,以及带文字识别的图层分解,按张计费,通过任务交付。

Seedream 5.5 是 ByteDance 的图像模型。每次请求可根据提示词,或提示词加最多 10 张参考图生成一张图像,也可将一张图像分解为底图和透明图层,并可选识别每个文字图层中的文字。发送请求后,保留返回的任务 ID,再从任务中读取完成的图像。参考图以 URL 形式传入。

模型 ID

模型 ID输入输出尺寸每次请求的图像数量
seedream-5-5文本、0–10 张图像1K、1.5K、2K 或 WIDTHxHEIGHT1 张,图层分解时为 2–100 张(包含底图)

当前价格见模型页面。

快速示例

curl https://api.seedrouter.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedream-5-5",
    "prompt": "A ceramic teapot shaped like a sleeping fox on a linen tablecloth, soft morning window light, shallow depth of field. No text.",
    "size": "1K"
  }'

端点

POST https://api.seedrouter.ai/v1/images/generations
请求头值
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

响应返回的是任务({"id": "task_...", "status": "processing"}),而非完成的图像。轮询 GET /v1/tasks/{task_id} 获取结果。请将 API Key 保存在服务端代码中。参考图和图层分解均通过 image 随同一次请求传入;此模型不使用 /v1/images/edits,调用该端点会返回 400。

参数

字段类型默认值说明
model字符串必填seedream-5-5
prompt字符串必填描述要生成的图像。使用 layer_decomposition 时可选:说明要拆分哪些元素,或省略,由模型自行识别主体、文字和背景。
imageURL 或 URL 列表无一个公开的图像 URL,或包含最多 10 个的列表。不传时为文生图。使用 layer_decomposition 时仅限一张。每张参考图均计费。
size字符串2K档位 1K、1.5K 或 2K,或精确像素尺寸 WIDTHxHEIGHT,见输出尺寸。使用 layer_decomposition 时仅支持 auto(默认)、1K、1.5K 或 2K。
output_format枚举pngpng 或 jpeg。使用 layer_decomposition 时仅设置底图格式;图层始终为 PNG。
background枚举autoauto、opaque 或 transparent。无论是否提供参考图都可使用 transparent,且必须使用 png 输出。使用 layer_decomposition 时请省略此字段,也不要传 auto。
layer_decomposition布尔值false将输入的一张图像分解为底图和透明 PNG 图层。
layer_decomposition_options.max_images整数30仅用于 layer_decomposition。2–100,包含底图。这是数量上限,模型可能返回更少的图像。
layer_decomposition_options.text_recognition布尔值false仅用于 layer_decomposition。为普通文字图层附带识别出的文字,见文字识别。
optimize_prompt_options.mode枚举standard仅支持 standard。提示词优化始终开启,无法关闭。
watermark布尔值falsetrue 添加“AI generated”标记。
content_filter布尔值true仅可通过 API 设置。Playground 始终保持开启。

此列表之外的字段会在转发请求前被丢弃,不会导致错误,也不会改变输出。不提供 n、stream、seed 和 response_format:每次请求返回一张图像,使用 layer_decomposition 时则最多返回 max_images 张。不支持 callback_url,请改为轮询任务。

输出尺寸

形式示例规则
档位"size": "2K"1K、1.5K 或 2K。在 prompt 中描述画面形状,模型据此选择宽高比。
精确像素尺寸"size": "2560x1440"总像素为 921,600 至 4,624,220;宽 / 高介于 1/16 与 16 之间。

没有 3K 或 4K 档位,也不支持宽高比形式:要在 2K 下固定使用 16:9 画幅,请传入 2560x1440。1K 与 1.5K 同价;2K 及超过 261 万像素的尺寸价格更高(见计费维度)。

参考图

传入一张图像进行编辑,或传入多张进行融合,并在 prompt 中说明要保留和修改的内容。按顺序指代它们(例如“图 1 中的夹克”)。

{
  "model": "seedream-5-5",
  "prompt": "Turn this scene into a snowy winter night with warm light from the lighthouse windows, keep the composition",
  "image": "https://example.com/lighthouse.jpg",
  "size": "2560x1440"
}

透明背景

设置 background: "transparent" 即可获取透明背景的 PNG,可仅使用提示词,也可提供参考图:

{
  "model": "seedream-5-5",
  "prompt": "A glossy red enamel pin shaped like a cherry, product cutout",
  "background": "transparent",
  "output_format": "png",
  "size": "1K"
}

图层分解

传入且仅传入一张图像,并设置 layer_decomposition: true。任务先返回底图,再以透明 PNG 格式返回各个图层。

{
  "model": "seedream-5-5",
  "image": "https://example.com/poster.jpg",
  "layer_decomposition": true,
  "size": "1K",
  "layer_decomposition_options": { "max_images": 4, "text_recognition": true }
}

每层包含 z_index(底图为 0;数字越大越靠上)、background,以及模型提供时的 name、description 和 bounding_box。bounding_box.absolute 使用底图像素坐标,格式为 [left, top, right, bottom];bounding_box.normalized 是将同一边界框缩放到 0–1000 的表示。图层文件按所选档位渲染,因此其像素尺寸可能与边界框不同:重建图像时,将各图层缩放到对应边界框大小,再按 z_index 升序放置到底图上。

档位决定底图和每个图层的尺寸。使用 auto 时,输出跟随输入图像尺寸,最低提高到 1K,最高降低到 2K。

文字识别

设置 layer_decomposition_options.text_recognition: true 后,含普通印刷文字的图层还会附带 text_recognition:完整的 text(各行以 \n 连接),以及 lines,每行均有自己的 bounding_box 和包含不同样式文字的 runs。每个文字片段的 style 包含 similar_font_family、foreground_color(#RRGGBB),以及 bold、italic、underline、strikethrough、shadow 和 translucent 标记。字体和标记均为模型的推测。艺术字或手写字不返回文字,而且分解时传入 prompt 可能使文字不返回,因此请将此字段视为可选。

媒体输入

每张参考图均使用公开的 HTTP(S) URL。不接受 Base64 data URI:请将文件上传到自己的存储空间,并传入其 URL。支持 JPEG、PNG、WebP、BMP、TIFF、GIF、HEIC 和 HEIF,每张不超过 30 MB,总像素不超过 36,000,000。不支持 AVIF 和 JP2;无法读取输入图像的任务会失败,不收费。

计费维度

当前费率见模型价格区块。Seedream 5.5 按像素档位对每张输出图像计费,每张参考图另行收费:

cost = Σ each returned image's price for its own tier + reference images × reference price
  • 低价档涵盖不超过 261 万像素的图像(1K 和 1.5K);超过此范围为高价档。
  • 每张参考图均计费,第一张也收费。图层分解也会收取一张输入图像的费用。
  • 图层分解按底图及每个图层各自尺寸对应的档位计费。
  • 任务受理时按最大可能结果预留金额:所选档位的一张图像,或图层分解的 max_images 张图像(省略时为 30 张),auto 按高价档计算。随后按实际返回的图像扣费,并释放差额。

最终费用可在账户用量记录中查看。失败的任务不收费。

输出结构

提交后返回任务:

{"id": "task_...", "model": "seedream-5-5", "status": "processing", "created_at": 1794323757}

查询任务

GET https://api.seedrouter.ai/v1/tasks/{task_id}

每隔 10–20 秒轮询一次,直到 status 为 completed 或 failed。轮询时发生网络超时并不表示生成失败:保留任务 ID,继续查询。不要为了查看进度而创建新任务。

已完成的任务

{
  "id": "task_...",
  "model": "seedream-5-5",
  "status": "completed",
  "created_at": 1794323757,
  "finished_at": 1794323804,
  "output": {
    "data": [
      {
        "url": "https://static.seedrouter.ai/media/tasks/task_example/0.png",
        "size": "1248x832",
        "output_format": "png",
        "background": "opaque"
      }
    ]
  }
}

图层分解任务先列出底图,再列出各个图层。以下是开启文字识别后实际分解一张海报的结果,展示了底图及三个图层中的第一个:

{
  "data": [
    { "url": "https://static.seedrouter.ai/media/tasks/task_example/0.png", "size": "836x1254", "output_format": "png", "background": "opaque", "z_index": 0 },
    {
      "url": "https://static.seedrouter.ai/media/tasks/task_example/1.png",
      "size": "1455x721",
      "output_format": "png",
      "background": "transparent",
      "z_index": 1,
      "name": "Dark blue serif main title text with dash decorations",
      "description": "Dark blue serif main title text reading \"BLUE TIDE SESSIONS\", with short horizontal dash decorations on its left and right sides.",
      "bounding_box": { "absolute": [0, 0, 836, 414], "normalized": [0, 0, 1000, 330] },
      "text_recognition": {
        "text": "BLUE TIDE\nSESSIONS",
        "lines": [
          {
            "bounding_box": { "absolute": [146, 69, 694, 196], "normalized": [175, 55, 830, 156] },
            "runs": [
              {
                "text": "BLUE TIDE",
                "style": { "similar_font_family": "HTF Didot", "foreground_color": "#122C4D", "bold": false, "italic": false, "underline": false, "strikethrough": false, "shadow": false, "translucent": false }
              }
            ]
          },
          {
            "bounding_box": { "absolute": [175, 168, 664, 300], "normalized": [209, 134, 794, 239] },
            "runs": [
              {
                "text": "SESSIONS",
                "style": { "similar_font_family": "HTF Didot", "foreground_color": "#122C4D", "bold": false, "italic": false, "underline": false, "strikethrough": false, "shadow": false, "translucent": false }
              }
            ]
          }
        ]
      }
    }
  ]
}

我们的测试中,一张 1K 图像耗时 47 秒,使用一张参考图的 2K 编辑耗时 40 秒,一次返回四张图像的 1K 图层分解耗时 39 秒。返回更多图层的分解可能需要几分钟。

错误

任务创建前被拒绝的请求会返回带有 error 对象的 HTTP 错误,不收费。任务受理后若失败,查询时仍返回 HTTP 200,并包含 status: "failed" 和 error 对象。

错误码、HTTP 状态及重试建议见公共错误目录。

{
  "id": "task_...",
  "model": "seedream-5-5",
  "status": "failed",
  "error": {
    "code": 60001,
    "message": "The request was rejected by the content policy. Please revise the prompt or input images."
  }
}

如果提交本身超时,请先查询任务,再决定是否重新提交:第一次请求可能已经受理。

使用提示

  • 从 1K 或 1.5K 开始反复调整;1.5K 与 1K 同价。
  • 用精确像素尺寸来固定画幅,例如在 2K 下使用 2560x1440 获得 16:9 画幅。
  • 每张参考图都收费:仅发送编辑需要的图像。
  • 图层分解时,将 max_images 设为接近预期元素数量的值;预留费用会随之变化。
  • 主要想获取文字时,开启 text_recognition,并省略分解请求中的 prompt。

相关内容