APIMODELSAPIMODELS

Doubao Seedream 5.5 API

字节跳动豆包 Seedream 5.5 图片 API:像素级改图(多轮修改不走样)、原生 RGBA 透明输出、把一张图拆成底图加最多 100 层透明图层。一个异步接口覆盖文生图、1–10 张参考图改图、拆图层;1K / 1.5K / 2K 单图输出,无水印。

认证

所有请求在 Header 携带 API Key:

Authorization: Bearer YOUR_API_KEY

价格

字段必填类型说明
项目价格
每张输出 · 1K / 1.5K$0.03
每张输出 · 2K$0.05
每张输入图(参考图 / 被拆的图)+$0.01

自定义 size 按像素分档:≤ 2,601,123 像素按 $0.03,以上按 $0.05。拆图层先按 max_images 张冻结额度,完成后按实际拆出的张数结算,多冻的退回。只在成功时扣费,失败不扣费。

文生图

POST/v1/images/generations

异步:创建返回 taskId,轮询 GET ?task_id= 到 completed 取结果,或用 callback_url 接 webhook。我们测的 1K 文生图约 20 秒。

# Text-to-image — create returns a taskId, then poll for the result.
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-5",
    "prompt": "product photo of a matte white ceramic mug on a light oak table by a window, soft morning light",
    "resolution": "1.5K",
    "aspect_ratio": "16:9"
  }'
# → { "code": 200, "data": { "taskId": "...", "state": "pending", "model": "doubao-seedream-5-5" } }

curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
# → { "code": 200, "data": { "state": "completed", "resultUrls": ["https://r2.apimodels.app/..."] } }

改图 · 多图合成 · 透明背景

带 image(单张)或 images(最多 10 张)就是改图 / 多图合成,提示词里用「图 1」「图 2」指代。background: "transparent" 直接生成带透明通道的 PNG。

# Edit / compose — 1 to 10 reference images (+$0.01 each).
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-5",
    "prompt": "put the vase from image 2 on the table in image 1; keep the room, furniture and lighting unchanged",
    "images": ["https://example.com/dining-room.jpg", "https://example.com/vase.png"],
    "resolution": "2K"
  }'

# Transparent background — PNG with a real alpha channel.
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-5",
    "prompt": "a snowy owl with spread wings, isolated, detailed feathers",
    "background": "transparent",
    "resolution": "1K"
  }'

拆图层

layer_decomposition: true + 恰好一张图:返回底图加多张透明 PNG 图层。resultUrls[i] 与 layers[i] 一一对应,layers 里有层级 z_index、包围框 bounding_box、角色,开 text_recognition 还有识别出的文字。提示词可选,用来说明想怎么拆。

# Layer splitting — exactly one image in, a base plus transparent layers out.
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-5",
    "image": "https://example.com/poster.png",
    "layer_decomposition": true,
    "max_images": 10,
    "text_recognition": true
  }'
# Completed task:
# { "state": "completed",
#   "resultUrls": ["https://r2.apimodels.app/...base.png", "https://r2.apimodels.app/...layer1.png", ...],
#   "layers": [
#     { "index": 0, "role": "base", "size": "2048x2048", "z_index": 0, "background": "opaque" },
#     { "index": 1, "role": "layer", "size": "800x160", "z_index": 1, "background": "transparent",
#       "bounding_box": { "absolute": [120, 80, 920, 240] },
#       "text_recognition": { "text": "Summer Sale", ... } } ] }

参数

字段必填类型说明
字段类型说明
modelstringdoubao-seedream-5-5 (alias: seedream-5.5)
promptstring提示词;文生图和改图必填,拆图层可选
resolutionstring1K / 1.5K / 2K(默认 2K)
aspect_ratiostringauto / 1:1 / 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 / 9:21 / 1:2 / 2:1 / 1:3 / 3:1 / 4:5 / 5:4
sizestring自定义尺寸,如 2816x1584;优先于 resolution / aspect_ratio。总像素 921,600–4,624,220,长宽比 1:16–16:1
image / images / image_urlsstring / string[]参考图 1–10 张(网址或 data URI);拆图层恰好 1 张
backgroundstringauto(默认)/ transparent / opaque;transparent 只输出 PNG
output_formatstringjpeg(默认)或 png;拆图层时只管底图,其余图层固定 PNG
layer_decompositionbooleantrue = 拆图层
max_imagesinteger拆图层返回的总张数上限(含底图),2–100,默认 30
text_recognitionboolean拆图层时识别图层文字(富文本),不另收费
callback_urlstring任务完成后的 webhook 回调 URL

限制

  • 每次 1 张图,没有 4K;n 大于 1 返回 400,要多张请分开发请求。
  • 拆图层只收 1 张图,不能和透明背景、自定义 size 同用;max_images、text_recognition 只在拆图层时有效,用在别处返回 400。
  • 透明背景 + output_format: "jpeg" 返回 400(JPEG 不能带透明)。
  • 做不到的参数一律返回 400 并写明原因,不会被悄悄忽略。

不保证每次都成功

提示词或图片可能被内容审核拒绝;拿真人照片做图生图、结果仍带本人长相的请求也可能被拒;上游偶尔会临时出错。失败不扣费,冻结的额度退回,返回里带失败原因:审核类改提示词或换图再试,临时错误直接重试。结果文件保留 30 天后自动删除,请及时下载或转存。

试一试:Playground(试用区支持文生图和改图,1.5K、透明背景、拆图层请用 API)。要用坐标或手绘标记精确指定改哪里,见 Seedream 5.0 Pro。

常见问题

Seedream 5.5 怎么拆图层?

向 /v1/images/generations 发 layer_decomposition: true 加一张图。max_images(2–100,默认 30)限制含底图的总张数,text_recognition 识别图层文字。resultUrls[i] 与 layers[i] 一一对应,里面有 z_index、bounding_box 和角色。

Seedream 5.5 多少钱?

每张输出 1K 或 1.5K $0.03,2K $0.05,每张参考图另加 $0.01。拆图层按实际拆出的张数收费。失败不扣费。

Seedream 5.5 能出透明背景吗?

能:传 background: "transparent",结果是带透明通道的 PNG。JPEG 不能带透明,所以透明背景加 output_format jpeg 会返回 400。