Seedream 图片生成

本文说明火山 Seedream 图片生成、参考图生成和图片编辑接口。

一、Seedream 图片生成

适用模型:

  • doubao-seedream-5.0-lite
    doubao-seedream-5.0-lite
  • doubao-seedream-4.5
    doubao-seedream-4.5
  • doubao-seedream-4.0
    doubao-seedream-4.0

请求地址:

POST https://cn-shanghai-alicloud-aimesh.api.clickzetta.com/gateway/api/v3/images/generations

文生图

curl -X POST "$AI_GATEWAY_VOLC_BASE_URL/images/generations" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedream-4.0", "prompt": "一张现代数据平台控制台的产品插画,干净、专业、科技感", "size": "2K", "response_format": "url", "watermark": false }'

参考图生成 / 图片编辑

Seedream 支持在请求中传入参考图。不同版本对参考图数量、格式和大小的限制不同,请以模型详情页为准。

curl -X POST "$AI_GATEWAY_VOLC_BASE_URL/images/generations" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedream-4.5", "prompt": "保持图中产品主体不变,将背景替换为干净的科技展厅,并增强光影质感。", "image": "https://example.com/product.png", "size": "2K", "response_format": "url", "watermark": false }'

多图参考 / 组图输出

部分 Seedream 模型支持多参考图和组图输出。

{ "model": "doubao-seedream-4.0", "prompt": "生成 3 张同一产品在早晨、中午、夜晚不同光照下的电商海报。", "image": [ "https://example.com/reference-1.png", "https://example.com/reference-2.png" ], "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 3 }, "size": "2K", "response_format": "url", "watermark": false }

图片生成请求字段

字段类型必填说明
model
model
stringSeedream 模型名称。
prompt
prompt
string图片生成或编辑提示词。
image
image
string / array参考图 URL 或图片数组。用于图生图、图片编辑、多图融合等场景。
size
size
string输出尺寸。常见写法包括
2K
2K
4K
4K
1024x1024
1024x1024
等,取决于模型版本。
n
n
integer输出图片数量。部分模型使用组图参数控制多图输出。
response_format
response_format
string返回格式,常见为
url
url
b64_json
b64_json
watermark
watermark
boolean是否添加水印。
seed
seed
integer随机种子。用于提高可复现性。
stream
stream
boolean是否使用流式图片生成响应,取决于模型能力。
sequential_image_generation
sequential_image_generation
string组图生成模式,例如
auto
auto
disabled
disabled
,取决于模型能力。
sequential_image_generation_options.max_images
sequential_image_generation_options.max_images
integer组图最大输出数量。
optimize_prompt_options
optimize_prompt_options
object提示词优化配置。具体字段以模型详情页为准。

图片生成响应

{ "created": 1710000000, "model": "doubao-seedream-4.0", "data": [ { "url": "https://example.com/generated.png", "size": "2048x2048" } ], "usage": { "generated_images": 1, "output_tokens": 12000, "total_tokens": 12000 } }

建议:

  • 返回的图片 URL 可能有有效期,生产环境应及时下载并转存到自有对象存储。
  • 参考图 URL 需要公网可访问,且不依赖浏览器登录态。
  • 图片生成费用通常按成功生成图片计费,应控制输出数量和重试次数。
联系我们
预约咨询
微信咨询
电话咨询
邮件咨询