Seedream 图片生成模型,可根据用户输入的文本或参考图像生成高质量图片,支持组图与流式输出。
Seedream系列模型可广泛应用于电商、游戏、影视、动漫、设计等行业,正在深刻改变传统的内容生产方式,大幅提升视觉内容的生产效率。
细分项 | 注意与前提 |
|---|---|
开通 LAS |
|
费用 | 调用算子前,您需先了解使用算子时的模型调用费用,详情请参见大模型调用计费。 |
鉴权(API Key) | 调用算子前,您需要先生成算子调用的API Key,并建议将API Key配置为环境变量,便于更安全地调用算子,详情请参见获取 API Key 并配置。 |
BaseURL | 调用算子前,您需要先根据您当前使用的LAS服务所在地域,了解算子调用的BaseURL,用于配置算子调用路径参数取值。 |
POST https://operator.las.cn-beijing.volces.com/api/v1/online/images/generations
调用 Seedream 图片生成模型进行文生图/图生图/组图生成(非流式)。
参数名称 | 参数类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|
model | string | 是 | doubao-seedream-4-5-251128 | 本次请求使用模型ID,支持:
doubao-seedream-5-0-lite-260128、
doubao-seedream-5-0-260128、
doubao-seedream-4-5-251128、
doubao-seedream-4-0-250828、
doubao-seedream-3-0-t2i-250415。 |
prompt | string | 是 | 一只戴着墨镜的橘猫,坐在海边,日落,超写实。 | 用于生成图像的提示词,支持中英文。建议不超过300个汉字或600个英文单词。 |
tools | array of tools_item | 否 | 仅 doubao-seedream-5.0-lite(doubao-seedream-5-0-lite-260128/doubao-seedream-5-0-260128)支持。用于配置模型要调用的工具。
| |
type | string | 是 | web_search | 指定使用的工具类型。当前支持:web_search(联网搜索功能)。 |
image | string / array | 否 | 输入的图片信息,支持 URL 或 Base64 编码。doubao-seedream-3.0-t2i 不支持该参数。doubao-seeddoubao-seedream-5.0-lite/4.5/4.0 支持单图或多图输入。Base64 格式:data:image/<图片格式>;base64,<Base64编码>,其中 <图片格式> 需小写。图片限制:格式 jpeg、png(doubao-seedream-5.0-lite/4.5/4.0 额外支持 webp、bmp、tiff、gif);宽高比范围 doubao-seedream-5.0-lite/4.5/4.0 为 [1/16, 16];宽高长度 > 14px;大小不超过 10MB;总像素不超过 6000x6000;doubao-seedream-5.0-lite/4.5/4.0 最多支持 14 张参考图。 | |
size | string | 否 | 2048x2048 | 指定生成图像的尺寸信息。
|
seed | integer | 否 | -1 | 仅 doubao-seedream-3.0-t2i。随机数种子,取值范围 [-1, 2147483647]。 |
sequential_image_generation | string | 否 | disabled | 仅 doubao-seedream-5.0-lite/4.5/4.0 支持。auto 表示自动判断是否组图,disabled 表示只生成一张图。 |
sequential_image_generation_options | sequential_image_generation_options | 否 | 仅 doubao-seedream-5.0-lite/4.5/4.0 支持。仅当 sequential_image_generation=auto 生效。 | |
max_images | integer | 否 | 15 | 最多生成图片数量。取值范围 [1, 15];需满足“输入参考图数量 + 生成图片数量 ≤ 15”。 |
guidance_scale | float | 否 | 2.5 | doubao-seedream-5.0-lite/4.5/4.0 不支持;doubao-seedream-3.0-t2i 默认 2.5。取值范围 [1, 10]。 |
response_format | string | 否 | url | 指定生成图像的返回格式。支持以下两种返回方式:
|
output_format | string | 否 | jepg | 仅 doubao-seedream-5.0-lite(doubao-seedream-5-0-lite-260128/doubao-seedream-5-0-260128)支持。指定生成图像的文件格式。可选值:png、jpeg;默认 jpeg。
说明:doubao-seedream-4.5/4.0、doubao-seedream-3.0-t2i/seededit-3.0-i2i 模型生成图像的文件格式默认为 jpeg,不支持自定义设置。 |
watermark | boolean | 否 | true | 是否添加“AI生成”水印。false 为不添加,true 为添加。 |
optimize_prompt_options | optimize_prompt_options | 否 | 仅 doubao-seedream-5.0-lite/4.5(当前仅标准模式)、doubao-seedream-4.0 支持。 | |
mode | string | 否 | standard | 提示词优化模式:standard(质量更高、耗时更长)或 fast(更快、质量一般)。 |
参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
model | string | doubao-seedream-4-5-251128 | 本次请求使用的模型 ID(模型名称-版本)。 |
created | integer | 1589478378 | 请求创建时间的 Unix 时间戳(秒)。 |
data | list of data_item | 输出图像信息列表。 | |
url | string | https://... | 当 response_format=url 时返回。 |
b64_json | string | <base64> | 当 response_format=b64_json 时返回。 |
size | string | 2048x2048 | 图像宽高像素值(仅 doubao-seedream-5.0-lite/4.5/4.0 支持)。 |
tools | list of tools_item | 本次请求配置的工具信息(仅配置 tools 时返回)。 | |
type | string | web_search | 配置的调用工具类型。
|
usage | usage | 本次请求的用量信息。 | |
generated_images | integer | 1 | 模型成功生成的图片张数,不包含生成失败的图片。仅对成功生成图片按张数进行计费。 |
output_tokens | integer | 16384 | 模型生成的图片花费的 token 数量。计算逻辑为 计算 sum(宽*高)/256 ,然后取整。 |
total_tokens | integer | 16384 | 本次请求消耗的总 token 数量。 当前不计算输入 token,故与 output_tokens 值一致。 |
tool_usage | tool_usage | 使用工具的用量信息(仅开启联网搜索时返回)。 | |
web_search | integer | 1 | 调用联网搜索工具次数,仅开启联网搜索时返回。 |
error | error_info | 请求级错误信息。 | |
code | string | BadRequest | 请参见下文的 错误码 章节。 |
message | string | Missing required parameter. | 错误提示信息 |
curl --location "https://operator.las.cn-beijing.volces.com/api/v1/images/generations" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $LAS_API_KEY" \ --data '{ "model": "doubao-seedream-4-5-251128", "prompt": "一只戴着墨镜的橘猫,坐在海边,日落,超写实。", "size": "2048x2048", "response_format": "url", "watermark": true }'
{ "model": "doubao-seedream-4-5-251128", "created": 1764041608, "data": [ { "url": "<image_url>", "size": "2048x2048" } ], "usage": { "generated_images": 1, "output_tokens": 16384, "total_tokens": 16384 } }
POST https://operator.las.cn-beijing.volces.com/api/v1/online/images/generations
调用 Seedream 图片生成模型进行文生图/图生图/组图生成(流式 SSE)。
参数名称 | 参数类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|
model | string | 是 | doubao-seedream-4-5-251128 | 本次请求使用模型ID,支持:
doubao-seedream-5-0-lite-260128、
doubao-seedream-5-0-260128、
doubao-seedream-4-5-251128、
doubao-seedream-4-0-250828、
doubao-seedream-3-0-t2i-250415。 |
prompt | string | 是 | 一只戴着墨镜的橘猫,坐在海边,日落,超写实。 | 用于生成图像的提示词,支持中英文。建议不超过300个汉字或600个英文单词。 |
tools | array of tools_item | 否 | 仅 doubao-seedream-5.0-lite(doubao-seedream-5-0-lite-260128/doubao-seedream-5-0-260128)支持。用于配置模型要调用的工具。
| |
type | string | 是 | web_search | 指定使用的工具类型。当前支持:web_search(联网搜索功能)。 |
image | string / array | 否 | 输入的图片信息,支持 URL 或 Base64 编码。doubao-seedream-3.0-t2i 不支持该参数。doubao-seeddoubao-seedream-5.0-lite/4.5/4.0 支持单图或多图输入。Base64 格式:data:image/<图片格式>;base64,<Base64编码>,其中 <图片格式> 需小写。图片限制:格式 jpeg、png(doubao-seedream-5.0-lite/4.5/4.0 额外支持 webp、bmp、tiff、gif);宽高比范围 doubao-seedream-5.0-lite/4.5/4.0 为 [1/16, 16];宽高长度 > 14px;大小不超过 10MB;总像素不超过 6000x6000;doubao-seedream-5.0-lite/4.5/4.0 最多支持 14 张参考图。 | |
size | string | 否 | 2048x2048 | 指定生成图像的尺寸信息。
|
seed | integer | 否 | -1 | 仅 doubao-seedream-3.0-t2i。随机数种子,取值范围 [-1, 2147483647]。 |
sequential_image_generation | string | 否 | disabled | 仅 doubao-seedream-5.0-lite/4.5/4.0 支持。auto 表示自动判断是否组图,disabled 表示只生成一张图。 |
sequential_image_generation_options | sequential_image_generation_options | 否 | 仅 doubao-seedream-5.0-lite/4.5/4.0 支持。仅当 sequential_image_generation=auto 生效。 | |
max_images | integer | 否 | 15 | 最多生成图片数量。取值范围 [1, 15];需满足“输入参考图数量 + 生成图片数量 ≤ 15”。 |
stream | boolean | 是 | true | 仅doubao-seedream-5.0-lite/4.5/4.0 支持;需设置为 true 以启用流式输出(SSE)。 |
guidance_scale | float | 否 | 2.5 | doubao-seedream-5.0-lite/4.5/4.0 不支持;doubao-seedream-3.0-t2i 默认 2.5。取值范围 [1, 10]。 |
response_format | string | 否 | url | 指定生成图像的返回格式。支持以下两种返回方式:
|
output_format | string | 否 | jepg | 仅 doubao-seedream-5.0-lite(doubao-seedream-5-0-lite-260128/doubao-seedream-5-0-260128)支持。指定生成图像的文件格式。可选值:png、jpeg;默认 jpeg。
说明:doubao-seedream-4.5/4.0、doubao-seedream-3.0-t2i/seededit-3.0-i2i 模型生成图像的文件格式默认为 jpeg,不支持自定义设置。 |
watermark | boolean | 否 | true | 是否添加“AI生成”水印。false 为不添加,true 为添加。 |
optimize_prompt_options | optimize_prompt_options | 否 | 仅 doubao-seedream-5.0-lite/4.5(当前仅标准模式)、doubao-seedream-4.0 支持。 | |
mode | string | 否 | standard | 提示词优化模式:standard(质量更高、耗时更长)或 fast(更快、质量一般)。 |
参数名称 | 参数类型 | 示例值 | 说明 |
|---|---|---|---|
type | string | image_generation.partial_succeeded | 事件类型,可能为 image_generation.partial_succeeded、image_generation.partial_failed、image_generation.completed、error。 |
model | string | doubao-seedream-4-0-250828 | 本次请求使用的模型 ID ,格式为<模型名称>-<版本>。 |
created | integer | 1589478378 | 请求创建时间的 Unix 时间戳(秒)。 |
image_index | integer | 0 | 本次生图请求中,本次事件对应图片在请求中的序号。从0开始累加,不管生图是否成功,均会自动累加 1。 |
url | string | https://... | 当 response_format=url 时返回。 |
b64_json | string | 当 response_format=b64_json 时返回。 | |
size | string | 2048x2048 | 图像宽高像素值(仅 doubao-seedream-4.5/4.0 支持)。 |
tools | list of tools_item | 本次请求配置的工具信息(仅配置 tools 时返回)。仅当事件类型为 image_generation.completed 时返回。 | |
type | string | web_search | 配置的调用工具类型。支持 web_search:联网搜索工具。 |
usage | usage | 本次请求的用量信息(仅在 event=completed 时返回)。 | |
generated_images | integer | 1 | 模型成功生成的图片张数。 |
output_tokens | integer | 16384 | 模型生成的图片花费的 token 数量。计算逻辑为 计算 sum(宽*高)/256,然后取整。 |
total_tokens | integer | 16384 | 本次请求消耗的总 token 数量。当前不计算输入 token,故与 output_tokens 值一致。 |
tool_usage | object | 工具调用统计信息。 | |
web_search | integer | 1 | 调用联网搜索工具次数,仅开启联网搜索时返回。 |
curl --location "https://operator.las.cn-beijing.volces.com/api/v1/images/generations" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $LAS_API_KEY" \ --data '{ "model": "doubao-seedream-4-5-251128", "prompt": "一只戴着墨镜的橘猫,坐在海边,日落,超写实。", "size": "2048x2048", "response_format": "url", "stream": true }'
{ "type": "image_generation.completed", "model": "doubao-seedream-4-5-251128", "created": 1589478378, "usage": { "generated_images": 1, "output_tokens": 16384, "total_tokens": 16384 } }
HttpCode | 错误码 | 错误信息 | 说明 |
|---|---|---|---|
400 | Model.InvalidName | The model name is invalid. | 模型名称不合法 |
401 | Authorization.Missing | Missing Authorization. | 缺少鉴权 |
401 | ApiKey.Invalid | The api key is invalid. | API不合法 |