Seedream 系列
Doubao-seedream-4.0 / 4.5、Doubao-Seedream-5.0-lite、doubao-seedream-5.0-pro:文生图、参考图生图与组图,同步,响应为 OpenAI Images data[]
| 项 | 值 |
|---|---|
| 模型 | Doubao-seedream-4.0 / Doubao-seedream-4.5 / Doubao-Seedream-5.0-lite(另有 doubao-seedream-5.0-pro) |
| 端点 | POST /v1/images/generations |
| 模式 | 同步;成功响应使用 data[] |
| 请求层级 | 参数位于 JSON 顶层,必填 model 和顶层 prompt |
| 计费 | 按图片,价格以定价页为准,见计费 |
| 媒体保留 | data[].url 为临时下载地址,请及时转存 |
三个模型的端点、请求层级和响应族一致,因此集中在一页说明。
快速开始
curl https://api.vibelab.me/v1/images/generations \
-H "Authorization: Bearer $LOOPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "Doubao-seedream-4.0", "prompt": "白底上的蓝色圆形图标"}'{
"created": 1719820800,
"data": [{"url": "https://example.com/generated/01.jpeg", "size": "2048x2048"}],
"usage": {"generated_images": 1, "output_tokens": 16384, "total_tokens": 16384}
}模式选择
| 模式 | 怎么传参 |
|---|---|
| 文生图 | 只传 prompt |
| 参考图生图 | image 传 1–14 张参考图(URL 或 Base64 Data URL);doubao-seedream-5.0-pro 改用 image_urls |
| 组图生成 | sequential_image_generation: "auto",用 sequential_image_generation_options.max_images 控制上限 |
版本能力矩阵
| 能力 | 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 |
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;用于保持主体、编辑和多图融合(doubao-seedream-5.0-pro 用 image_urls) |
size | string | 否 | 2048x2048 | <宽>x<高> 或模型支持的档位,规则见下文尺寸表 |
response_format | string | 否 | url | url 或 b64_json |
output_format | string | 否 | jpeg | jpeg 或 png;仅 5.0 Lite,4.0/4.5 不得传入 |
watermark | boolean | 否 | true | 设为 false 可关闭右下角水印 |
optimize_prompt_options | object | 否 | {"mode":"standard"} | mode 为 standard;只有 4.0 支持 fast |
sequential_image_generation | string | 否 | disabled | disabled(单图)或 auto(由模型决定是否返回组图) |
sequential_image_generation_options.max_images | integer | 否 | 15 | 1–15,仅在组图模式生效 |
image_urls | string[] | 否 | - | 仅 doubao-seedream-5.0-pro:参考图 |
resolution | string | 否 | 2K | 仅 doubao-seedream-5.0-pro:1K / 2K,与 size(填比例)配合 |
参考图约束
每张参考图支持 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"
}代码示例
# 依赖: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"响应
非流式成功响应会原样透传。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是模型服务用量,不是计费金额。
错误
错误体为统一信封(见图片生成总览)。本页特有或需注意的情形:
| HTTP | code | 触发场景 | 处理 |
|---|---|---|---|
| 400 | invalid_request | 请求体不是合法 JSON,或 model 缺失(invalid image generation request) | 修正请求体 |
| 400 | invalid_request | 请求经 apimart 渠道转换时:use either image or image_urls、image must be a URL or an array of URLs、image must contain at least one URL、image cannot contain empty URLs、invalid Seedream pixel size、size and resolution disagree、unsupported size for <model>、unsupported resolution for <model> | 按请求参数修正参考图与尺寸 |
| 502 | upstream_error | 模型服务拒绝参数、素材或内容;模型服务的非 2xx 错误不会原样暴露 | 有限退避重试;参数问题先修正 |
| 503 | no_available_channel | 当前没有可用服务资源;也可能出现在一次可重试失败之后 | 稍后重试 |
| 500 | internal_error | 计费、定价或请求构建异常 | 稍后重试 |
LoopToken 本地错误示例:
{
"error": {
"message": "unknown model: example-model",
"type": "model_not_found",
"code": "model_not_found",
"request_id": "req_example"
}
}成功 JSON 原样透传,LoopToken 不向响应体注入请求 ID;请求 ID 位于 X-Request-Id 响应头。
注意事项
-
传
n→ 不是 Seedream 官方的输出数量控制:LoopToken 读取正整数n仅用于预扣,组图上限使用sequential_image_generation_options.max_images,不要混用。 -
doubao-seedream-5.0-pro传n、response_format→ 平台转发时忽略,固定生成一张并返回 URL。 -
4.0 / 4.5 传
output_format→ 仅 5.0 Lite 可传,4.0/4.5 不得传入。 -
stream→ 是模型服务能力,但尚无 LoopToken 实测结果,不属于本页稳定接口。 -
seed→ 没有当前官方接口证据,请勿依赖。 -
5.0 Lite 联网搜索工具 → 不在当前稳定兼容范围。