Doubao Seedream

Doubao Seedream 图片生成模型,支持文生图、单图参考、多图参考和组图生成。平台对外使用异步任务协议:创建任务返回 taskId,通过查询任务接口或回调获取图片结果。

模型

模型名称输出模式
doubao-seedream-5.0-lite图片 URL文生图、图像参考、组图生成、联网搜索
doubao-seedream-4.5图片 URL文生图、图像参考、组图生成

定价

按成功生成的图片数量计费,失败图片不计费。

模型积分
doubao-seedream-5.0-lite15 积分/图
doubao-seedream-4.515 积分/图

组图模式会先按最大可能生成张数预扣,任务完成后按实际成功图片数结算,多扣部分自动退回。

创建任务

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": "2K",
        "watermark": false
      }
  }'

请求体

字段类型必填说明
modelstringdoubao-seedream-5.0-litedoubao-seedream-4.5
inputobject生成参数,见下方
callback_urlstring任务完成/失败时接收通知的 URL

Input 参数

字段类型必填说明
promptstring图片生成提示词,支持中文和英文
image_urlsstring[]公网 HTTP(S) 参考图片 URL。输入图片不支持 Base64,传入时为 1-14 张
sizestring输出尺寸,默认 2048x2048。支持分辨率档位或像素尺寸,见下方尺寸与分辨率
sequential_image_generationstring是否开启组图生成,默认 disabled。可选:disabledauto
sequential_image_generation_optionsobject组图配置,仅 sequential_image_generation=auto 时生效
toolsarraydoubao-seedream-5.0-lite 支持,目前可传 [{ "type": "web_search" }]
streamboolean是否请求上游流式输出,默认 false。平台仍通过任务结果返回最终图片
output_formatstringdoubao-seedream-5.0-lite 支持。可选:jpegpng,默认 jpeg
watermarkboolean是否添加水印,默认 true
optimize_prompt_optionsobject提示词优化配置,目前支持 { "mode": "standard" }

doubao-seedream-4.5 不支持 3Ktoolsoutput_format

参考图限制

限制项要求
图片格式jpegpngwebpbmptiffgifheicheif
单图文件大小不超过 30 MB
单图总像素不超过 6000×6000
单图宽高均需大于 14 px
单图宽高比[1/16, 16]
多图参考最多 14 张

开启组图时,参考图数量与最终生成图片数量之和不能超过 15。

尺寸与分辨率

size 可以传分辨率档位,也可以传像素尺寸,例如 2048x2048。传像素尺寸时,总像素需在 2560x14404096x4096 之间,宽高比需在 [1/16, 16] 之间。

模型支持档位默认值
doubao-seedream-5.0-lite2K3K4K2048x2048
doubao-seedream-4.52K4K2048x2048

常用尺寸:

分辨率宽高比像素尺寸
2K1:12048x2048
2K4:32304x1728
2K3:41728x2304
2K16:92848x1600
2K9:161600x2848
2K3:22496x1664
2K2:31664x2496
2K21:93136x1344
3K1:13072x3072
3K4:33456x2592
3K3:42592x3456
3K16:94096x2304
3K9:162304x4096
3K3:23744x2496
3K2:32496x3744
3K21:94704x2016
4K1:14096x4096
4K4:34704x3520
4K3:43520x4704
4K16:95504x3040
4K9:163040x5504
4K3:24992x3328
4K2:33328x4992
4K21:96240x2656

3Kdoubao-seedream-5.0-lite 支持。

组图生成

sequential_image_generation 控制是否开启组图生成:

取值说明
disabled关闭组图功能,只生成一张图片
auto模型根据提示词自动判断是否返回组图以及组图数量

sequential_image_generation_options 支持:

字段类型必填说明
max_imagesinteger最多生成图片数,范围 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-lite",
    "callback_url": "https://your-server.com/webhook",
    "input": {
      "prompt": "一个雨夜霓虹城市海报,街道上有湿润反光",
      "size": "2K",
      "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-4.5",
    "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"
    }
  }'

示例:组图和联网搜索

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 -> completedfailed

已完成

{
  "id": "397ce9f2-c04e-4244-ac33-3af19a7cc297",
  "status": "completed",
  "model": "doubao-seedream-5.0-lite",
  "created_at": 1775383908,
  "completed_at": 1775383925,
  "output": {
    "urls": [
      "https://file.aivideoapi.ai/images/2026/07/04/abc123.png"
    ],
    "metadata": {
      "model": "doubao-seedream-5.0-lite",
      "generated_images": 1,
      "requested_image_count": 1,
      "output_format": "png",
      "image_sizes": ["2048x2048"],
      "partial_errors": [],
      "usage": {
        "generated_images": 1,
        "output_tokens": 16384,
        "total_tokens": 16384
      }
    }
  }
}

组图部分失败

只要至少一张图片成功,任务会标记为 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 状态码错误码类型说明
400invalid_requestinvalid_request_error缺少必填参数或参数无效
401invalid_api_keyauthentication_errorAPI Key 无效、已禁用或已删除
402insufficient_creditsbilling_error积分余额不足,请充值
403ip_not_allowedpermission_error请求 IP 不在 Key 的白名单中
404model_not_foundinvalid_request_error模型不存在或已停用
404task_not_foundinvalid_request_error任务 ID 不存在
429rate_limit_exceededrate_limit_error请求过于频繁,请降低频率
429spend_limit_exceededbilling_error达到 Key 的消费限额(每小时/每天/总量)
500internal_errorapi_error服务器内部错误
503upstream_errorupstream_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 服务返回错误,可能原因:

  • 输入内容包含敏感或违规信息
  • 上游服务暂时不可用
  • 请求参数不被上游支持

因上游错误导致任务失败时,预扣积分会自动退还。