Doubao Seedream
Doubao Seedream 图片生成模型,支持文生图、单图参考和多图参考;Lite 与 4.5 还支持组图生成。平台对外使用异步任务协议:创建任务返回 taskId,通过查询任务接口或回调获取图片结果。
模型
| 模型名称 | 输出 | 模式 |
|---|---|---|
doubao-seedream-5.0-pro | 图片 URL | 文生图、单图生图、多图融合;固定输出一张图片 |
doubao-seedream-5.0-lite | 图片 URL | 文生图、图像参考、组图生成、联网搜索 |
doubao-seedream-4.5 | 图片 URL | 文生图、图像参考、组图生成 |
定价
Pro 按上游返回的真实输出像素和实际输入参考图数量结算;Lite 与 4.5 按成功生成的图片数量计费。
| 模型 | 积分 |
|---|---|
doubao-seedream-5.0-pro | ≤ 2,360,000 像素 15 积分;> 2,360,000 像素 30 积分;首张参考图免费,第 2 张起每张 1 积分 |
doubao-seedream-5.0-lite | 15 积分/图 |
doubao-seedream-4.5 | 15 积分/图 |
创建任务
curl -X POST https://api.aivideoapi.ai/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5.0-pro",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "一只橘猫坐在窗边读书,水彩插画风格,柔和晨光",
"size": "1K",
"watermark": false
}
}'
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | doubao-seedream-5.0-pro、doubao-seedream-5.0-lite 或 doubao-seedream-4.5 |
input | object | 是 | 生成参数,见下方 |
callback_url | string | 否 | 任务完成/失败时接收通知的 URL |
Input 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | 是 | 图片生成提示词,支持中文和英文 |
image_urls | string[] | 否 | 公网 HTTP(S) 参考图片 URL。输入图片不支持 Base64;Pro 最多 10 张,其他模型最多 14 张 |
size | string | 否 | 输出尺寸。Pro 默认 1024x1024,其他模型默认 2048x2048;见下方尺寸与分辨率 |
sequential_image_generation | string | 否 | 是否开启组图生成,默认 disabled。可选:disabled、auto |
sequential_image_generation_options | object | 否 | 组图配置,仅 sequential_image_generation=auto 时生效 |
tools | array | 否 | 仅 doubao-seedream-5.0-lite 支持,目前可传 [{ "type": "web_search" }] |
stream | boolean | 否 | Lite/4.5 可传;Pro 仅兼容 false,不支持流式输出 |
output_format | string | 否 | Pro 与 Lite 支持。可选:jpeg、png,默认 jpeg |
watermark | boolean | 否 | 是否添加水印,默认 true |
optimize_prompt_options | object | 否 | 提示词优化配置。Pro 支持 standard、fast;其他模型支持 standard |
Pro 不支持组图、联网搜索和流式输出;兼容并忽略 sequential_image_generation: "disabled" 与 stream: false,实际启用这些能力时返回参数错误。平台固定向上游请求 URL,因此不接受 response_format 或 Base64 输出。doubao-seedream-4.5 不支持 3K、tools、output_format。
参考图限制
| 限制项 | 要求 |
|---|---|
| 图片格式 | jpeg、png、webp、bmp、tiff、gif、heic、heif |
| 单图文件大小 | 不超过 30 MB |
| 单图总像素 | 不超过 6000×6000 |
| 单图宽高 | 均需大于 14 px |
| 单图宽高比 | [1/16, 16] |
| 多图参考 | Pro 最多 10 张;Lite/4.5 最多 14 张 |
开启组图时,参考图数量与最终生成图片数量之和不能超过 15。
尺寸与分辨率
size 可以传分辨率档位,也可以传像素尺寸,例如 2048x2048。Pro 精确尺寸总像素需在 921600 到 4624220 之间;Lite/4.5 总像素需在 2560x1440 到 4096x4096 之间。所有模型宽高比需在 [1/16, 16] 之间。
| 模型 | 支持档位 | 默认值 |
|---|---|---|
doubao-seedream-5.0-pro | 1K、2K | 1024x1024 |
doubao-seedream-5.0-lite | 2K、3K、4K | 2048x2048 |
doubao-seedream-4.5 | 2K、4K | 2048x2048 |
Pro 档位参考尺寸(实际尺寸以模型返回为准):
| 分辨率 | 宽高比 | 像素尺寸 |
|---|---|---|
1K | 1:1 | 1024x1024 |
1K | 4:3 | 1152x864 |
1K | 3:4 | 864x1152 |
1K | 16:9 | 1424x800 |
1K | 9:16 | 800x1424 |
1K | 3:2 | 1248x832 |
1K | 2:3 | 832x1248 |
1K | 21:9 | 1568x672 |
2K | 1:1 | 2048x2048 |
2K | 4:3 | 2368x1776 |
2K | 3:4 | 1776x2368 |
2K | 16:9 | 2816x1584 |
2K | 9:16 | 1584x2816 |
2K | 3:2 | 2496x1664 |
2K | 2:3 | 1664x2496 |
2K | 21:9 | 3136x1344 |
Lite/4.5 常用尺寸:
| 分辨率 | 宽高比 | 像素尺寸 |
|---|---|---|
2K | 1:1 | 2048x2048 |
2K | 4:3 | 2304x1728 |
2K | 3:4 | 1728x2304 |
2K | 16:9 | 2848x1600 |
2K | 9:16 | 1600x2848 |
2K | 3:2 | 2496x1664 |
2K | 2:3 | 1664x2496 |
2K | 21:9 | 3136x1344 |
3K | 1:1 | 3072x3072 |
3K | 4:3 | 3456x2592 |
3K | 3:4 | 2592x3456 |
3K | 16:9 | 4096x2304 |
3K | 9:16 | 2304x4096 |
3K | 3:2 | 3744x2496 |
3K | 2:3 | 2496x3744 |
3K | 21:9 | 4704x2016 |
4K | 1:1 | 4096x4096 |
4K | 4:3 | 4704x3520 |
4K | 3:4 | 3520x4704 |
4K | 16:9 | 5504x3040 |
4K | 9:16 | 3040x5504 |
4K | 3:2 | 4992x3328 |
4K | 2:3 | 3328x4992 |
4K | 21:9 | 6240x2656 |
Pro 的 1K/2K 档位可配合 prompt 描述宽高比或用途,由模型决定最终像素;计费始终以上游返回的真实尺寸为准。3K 仅 doubao-seedream-5.0-lite 支持。
组图生成(Lite/4.5)
sequential_image_generation 控制是否开启组图生成:
| 取值 | 说明 |
|---|---|
disabled | 关闭组图功能,只生成一张图片 |
auto | 模型根据提示词自动判断是否返回组图以及组图数量 |
sequential_image_generation_options 支持:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
max_images | integer | 否 | 最多生成图片数,范围 1-15 |
示例:文生图
curl -X POST https://api.aivideoapi.ai/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5.0-pro",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "一个雨夜霓虹城市海报,街道上有湿润反光",
"size": "1K",
"watermark": false
}
}'
示例:多图参考
curl -X POST https://api.aivideoapi.ai/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5.0-pro",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "参考两张图片的主体和配色,生成一张产品海报,背景简洁,高级商业摄影风格",
"image_urls": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
],
"size": "2048x2048",
"optimize_prompt_options": { "mode": "standard" }
}
}'
示例:组图和联网搜索
curl -X POST https://api.aivideoapi.ai/v1/images/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5.0-lite",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "生成一组夏季露营装备的电商详情页配图,包含帐篷、营灯、折叠椅和户外餐桌",
"size": "3K",
"sequential_image_generation": "auto",
"sequential_image_generation_options": {
"max_images": 6
},
"tools": [
{ "type": "web_search" }
],
"output_format": "png"
}
}'
响应
{
"code": 200,
"msg": "success",
"data": {
"taskId": "397ce9f2-c04e-4244-ac33-3af19a7cc297"
}
}
查询任务
curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
-H "Authorization: Bearer sk-your-api-key"
状态变化:pending -> processing -> completed 或 failed。
已完成
{
"id": "397ce9f2-c04e-4244-ac33-3af19a7cc297",
"status": "completed",
"model": "doubao-seedream-5.0-pro",
"credits_consumed": 30,
"created_at": 1775383908,
"completed_at": 1775383925,
"output": {
"urls": [
"https://file.aivideoapi.ai/images/2026/07/04/abc123.png"
],
"metadata": {
"model": "doubao-seedream-5.0-pro",
"generated_images": 1,
"requested_image_count": 1,
"output_format": "png",
"image_sizes": ["2048x2048"],
"partial_errors": [],
"usage": {
"input_images": 0,
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}
}
}
组图部分失败(Lite/4.5)
只要至少一张图片成功,任务会标记为 completed,成功图片正常返回,失败图片记录在 metadata.partial_errors 中。实际扣费只按成功图片数计算。
{
"id": "397ce9f2-c04e-4244-ac33-3af19a7cc297",
"status": "completed",
"model": "doubao-seedream-5.0-lite",
"output": {
"urls": [
"https://file.aivideoapi.ai/images/2026/07/04/abc123.png"
],
"metadata": {
"generated_images": 1,
"requested_image_count": 2,
"partial_errors": [
{
"index": 1,
"code": "image_generation_failed",
"message": "部分图片生成失败,可调整参数后重新提交"
}
]
}
}
}
失败
{
"id": "57c8772c-f834-46f3-9b7d-81f92e104050",
"status": "failed",
"model": "doubao-seedream-5.0-lite",
"created_at": 1775383908,
"error": {
"code": "upstream_error",
"message": "Image generation failed"
}
}
任务失败时,预扣积分会自动退还。
回调通知
创建任务时传入 callback_url,任务完成或失败时系统会自动向该 URL 发送 POST 请求,格式与 GET /v1/tasks/{taskId} 响应一致。
常见错误码
请求失败时,API 返回 JSON 格式的错误响应:
{
"error": {
"code": "insufficient_credits",
"message": "Your credit balance is too low. Please top up.",
"type": "billing_error"
}
}
错误码一览
| HTTP 状态码 | 错误码 | 类型 | 说明 |
|---|---|---|---|
| 400 | invalid_request | invalid_request_error | 缺少必填参数或参数无效 |
| 401 | invalid_api_key | authentication_error | API Key 无效、已禁用或已删除 |
| 402 | insufficient_credits | billing_error | 积分余额不足,请充值 |
| 403 | ip_not_allowed | permission_error | 请求 IP 不在 Key 的白名单中 |
| 404 | model_not_found | invalid_request_error | 模型不存在或已停用 |
| 404 | task_not_found | invalid_request_error | 任务 ID 不存在 |
| 429 | rate_limit_exceeded | rate_limit_error | 请求过于频繁,请降低频率 |
| 429 | spend_limit_exceeded | billing_error | 达到 Key 的消费限额(每小时/每天/总量) |
| 500 | internal_error | api_error | 服务器内部错误 |
| 503 | upstream_error | upstream_error | 上游 AI 服务返回错误 |
常见场景
invalid_request (400)
缺少必填字段或参数格式错误时返回。
{
"error": {
"code": "invalid_request",
"message": "'model' is required.",
"type": "invalid_request_error"
}
}
insufficient_credits (402)
积分不足。可通过 GET /v1/credits 查询余额,前往 Dashboard > Billing 充值。
invalid_api_key (401)
可能原因:
- Key 不以
sk-开头 - Key 已被禁用或删除
- 用户账户已被封禁
upstream_error (503)
上游 AI 服务返回错误,可能原因:
- 输入内容包含敏感或违规信息
- 上游服务暂时不可用
- 请求参数不被上游支持
因上游错误导致任务失败时,预扣积分会自动退还。