Seedream 系列
Seedream 4.0、4.5 与 5.0 Lite 图片生成和参考图编辑接口
三个 Seedream 模型共用 POST /v1/images/generations。请求参数位于 JSON 顶层,必填项是 model 和顶层 prompt;成功响应使用 data[]。它们的端点、请求层级和响应族一致,因此集中在一页说明。
版本能力矩阵
| 能力 | Doubao-seedream-4.0 | Doubao-seedream-4.5 | Doubao-Seedream-5.0-lite |
|---|---|---|---|
| 文生图 | 支持 | 支持 | 支持 |
| 参考图生图 | 支持,最多 14 张 | 支持,最多 14 张 | 支持,最多 14 张 |
| 组图生成 | 支持,最多 15 张输出 | 支持,最多 15 张输出 | 支持,最多 15 张输出 |
| 可配置输出格式 | 不支持,JPEG | 不支持,JPEG | jpeg 或 png |
| 尺寸档位 | 1K / 2K / 4K | 2K / 4K | 2K / 3K / 4K |
| 提示词优化 | standard / fast | 仅 standard | 仅 standard |
stream 虽是模型服务能力,但尚无 LoopToken 实测结果,不属于本页稳定接口。seed 也没有当前官方接口证据,请勿依赖。5.0 Lite 的联网搜索工具不在当前稳定兼容范围。
Seedream 5.0 Pro
doubao-seedream-5.0-pro 使用同一 generations 端点的扁平扩展格式:参考图放在 image_urls,分辨率放在 resolution,每次只生成一张。它支持 1K / 2K 和 jpeg / png,最多使用 10 张参考图;首张参考图包含在基础价格中,更多参考图可能产生额外费用。
{
"model": "doubao-seedream-5.0-pro",
"prompt": "高级产品摄影,柔和侧光",
"size": "1:1",
"resolution": "2K",
"image_urls": ["https://example.com/reference.jpg"],
"output_format": "jpeg",
"watermark": false
}请求参数
| 参数 | 类型 | 必填 | 适用模型 | 说明 |
|---|---|---|---|---|
model | string | 是 | 全部 | 使用上表中的精确模型名 |
prompt | string | 是 | 全部 | 中英文提示词;建议不超过 300 个汉字或 600 个英文单词 |
image | string 或 string[] | 否 | 全部 | 一张或最多 14 张参考图,URL 或 Base64 Data URL;用于保持主体、编辑和多图融合 |
size | string | 否 | 全部 | <宽>x<高> 或模型支持的档位;默认 2048x2048,规则见下文 |
response_format | string | 否 | 全部 | url(默认)或 b64_json |
output_format | string | 否 | 仅 5.0 Lite | jpeg(默认)或 png;4.0/4.5 不得传入 |
watermark | boolean | 否 | 全部 | 默认 true;设为 false 可关闭右下角水印 |
optimize_prompt_options | object | 否 | 全部 | mode 默认 standard;只有 4.0 支持 fast |
sequential_image_generation | string | 否 | 全部 | disabled(默认,单图)或 auto(由模型决定是否返回组图) |
sequential_image_generation_options | object | 否 | 全部 | 仅在组图模式生效;max_images 为 1-15,默认 15 |
n 不是 Seedream 官方的输出数量控制。LoopToken 会读取正整数 n 进行预扣,但模型的组图上限应使用 sequential_image_generation_options.max_images;不要把两者混用。
参考图约束
每张参考图支持 JPEG、PNG、WebP、BMP、TIFF、GIF、HEIC 或 HEIF,大小不超过 30 MB,宽高都大于 14 px,总像素不超过 36,000,000,宽高比为 1:16 至 16:1。URL 必须能被服务端直接访问;Base64 必须使用 data:image/<format>;base64,<data>,其中格式名小写。
单图模式最多输入 14 张参考图并输出 1 张。组图模式满足“参考图数量 + 最终输出数量不超过 15”:无参考图最多输出 15 张,一张参考图最多输出 14 张。
Seedream 4.0 尺寸表
显式尺寸总像素为 921,600 至 16,777,216,宽高比为 1:16 至 16:1。
| 档位 | 1:1 | 4:3 | 16:9 | 3:2 | 21:9 |
|---|---|---|---|---|---|
1K | 1024x1024 | 1152x864 | 1280x720 | 1248x832 | 1512x648 |
2K | 2048x2048 | 2304x1728 | 2848x1600 | 2496x1664 | 3136x1344 |
4K | 4096x4096 | 4704x3520 | 5504x3040 | 4992x3328 | 不提供推荐值 |
竖图使用对应宽高互换值。
Seedream 4.5 尺寸表
显式尺寸总像素为 3,686,400 至 16,777,216,宽高比为 1:16 至 16:1。
| 档位 | 1:1 | 4:3 | 16:9 | 3:2 | 21:9 |
|---|---|---|---|---|---|
2K | 2048x2048 | 2304x1728 | 2848x1600 | 2496x1664 | 3136x1344 |
4K | 4096x4096 | 4704x3520 | 5504x3040 | 4992x3328 | 6240x2656 |
竖图使用对应宽高互换值。
Seedream 5.0 Lite 尺寸表
显式尺寸总像素为 3,686,400 至 16,777,216,宽高比为 1:16 至 16:1。
| 档位 | 1:1 | 4:3 | 16:9 | 3:2 | 21:9 |
|---|---|---|---|---|---|
2K | 2048x2048 | 2304x1728 | 2848x1600 | 2496x1664 | 3136x1344 |
3K | 3072x3072 | 3456x2592 | 4096x2304 | 3744x2496 | 4704x2016 |
4K | 4096x4096 | 4704x3520 | 5504x3040 | 4992x3328 | 不提供推荐值 |
竖图使用对应宽高互换值。档位由模型结合 prompt 中的用途和比例描述选择实际尺寸;需要精确尺寸时传 <宽>x<高>。
请求示例
最小请求:
{
"model": "Doubao-seedream-4.0",
"prompt": "白底上的蓝色圆形图标"
}5.0 Lite 完整请求和 PNG 输出:
{
"model": "Doubao-Seedream-5.0-lite",
"prompt": "现代美术馆的中文活动海报,标题为‘夏日新展’,3:4 竖版,文字清晰",
"size": "2592x3456",
"response_format": "url",
"output_format": "png",
"watermark": false,
"optimize_prompt_options": {"mode": "standard"},
"sequential_image_generation": "disabled"
}多参考图融合与编辑:
{
"model": "Doubao-seedream-4.5",
"prompt": "保留第一张图的人物与第二张图的服装,将背景改为雨夜街道",
"image": [
"https://example.com/person.jpg",
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB..."
],
"size": "2K"
}最多生成 4 张关联组图:
{
"model": "Doubao-seedream-4.0",
"prompt": "四格连续故事:机器人种下一颗种子,发芽,开花,迎来蝴蝶",
"size": "1K",
"sequential_image_generation": "auto",
"sequential_image_generation_options": {"max_images": 4}
}Base64 返回:
{
"model": "Doubao-seedream-4.5",
"prompt": "透明玻璃杯中的柠檬水,产品摄影",
"size": "2048x2048",
"response_format": "b64_json"
}响应
非流式成功响应会原样透传。data[] 的顺序就是模型返回顺序;组图中单张审核失败时可出现 error 项,其他图片仍可能继续生成。模型服务异常可能终止后续图片。
URL 响应:
{
"created": 1719820800,
"data": [
{"url": "https://example.com/generated/01.jpeg", "size": "2048x2048"}
],
"usage": {
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}Base64 响应:
{
"created": 1719820800,
"data": [
{"b64_json": "/9j/4AAQSkZJRgABAQ...", "size": "2048x2048"}
],
"usage": {"generated_images": 1, "output_tokens": 16384, "total_tokens": 16384}
}| 字段 | 说明 |
|---|---|
created | Unix 秒级时间戳 |
data[].url | response_format=url 时返回的临时下载地址;请及时持久化 |
data[].b64_json | response_format=b64_json 时返回的纯 Base64 字符串,不含 Data URL 前缀 |
data[].size | 实际输出的 <宽>x<高> |
data[].error.code / message | 单张失败信息 |
usage.generated_images | 成功图片数,不含失败项 |
usage.output_tokens / total_tokens | 图像输出用量 |
计费、错误与透传
三个模型均按图片计费,最终价格以模型列表为准。请求提交时按正整数顶层 n 预扣,未传或非正数按 1。OpenAI 风格响应按 data[] 长度结算:只要 data[] 非空,Count 就等于数组项数,即使某项只有 error,或 URL/Base64 都为空,也会计入长度。只有 2xx 响应的 data[] 缺失、为空或无法识别并得到 Count=0 时,才按提交数量结算;这里的提交数量是上述本地解析值。模型服务非 2xx、没有可用服务资源或所有重试失败会全额退款。不要用 usage.generated_images 推断 LoopToken 的最终扣费张数;usage 是模型服务用量,不是计费金额。
LoopToken 本地错误统一为:
{
"error": {
"message": "unknown model: example-model",
"type": "model_not_found",
"code": "model_not_found",
"request_id": "req_example"
}
}error.type 与 error.code 均为 LoopToken 错误代码。常见状态包括:400 请求体或模型字段无效、401 API Key 缺失或无效、402 余额不足、403 API Key 不允许该模型、404 模型不存在、502 upstream_error、503 no_available_channel,以及 500 internal_error。模型服务的非 2xx 错误不会原样暴露,而会映射为 502;503 也可能出现在一次可重试失败之后。成功 JSON 原样透传,LoopToken 不向响应体注入请求 ID;请求 ID 位于 X-Request-Id 响应头。
可运行示例
# 依赖:curl、jq、openssl、file
response_file=$(mktemp)
curl --fail-with-body https://api.vibelab.me/v1/images/generations \
-H "Authorization: Bearer $LOOPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"Doubao-seedream-4.5","prompt":"白底上的蓝色圆形图标","size":"2048x2048","response_format":"url"}' \
> "$response_file"
index=0
while IFS=$'\t' read -r kind value; do
index=$((index + 1))
if [ "$kind" = error ]; then
echo "item $index failed: $value" >&2
continue
fi
temporary=$(mktemp)
if [ "$kind" = url ]; then
curl --fail --location "$value" --output "$temporary"
else
printf '%s' "$value" | openssl base64 -d -A > "$temporary"
fi
case "$(file --brief --mime-type "$temporary")" in
image/png) extension=.png ;;
image/jpeg) extension=.jpg ;;
*) extension=.bin ;;
esac
mv "$temporary" "seedream-${index}${extension}"
done < <(jq -r '.data[] | if .error then ["error", (.error | tostring)] elif .url then ["url", .url] else ["b64", .b64_json] end | @tsv' "$response_file")
rm -f "$response_file"