Seedream
用 Seedream 生成和编辑图片:参数、返回与注意事项。
| 项目 | 值 |
|---|---|
| Base URL | https://api.hop-base.com/v1 |
| 生成(含参考图编辑) | POST /v1/images/generations |
| 编辑(multipart 兼容入口) | POST /v1/images/edits |
| 密钥分组 | 「Seedream 生图分组」或「Seedance 海外 · Seedream」 |
Seedream 只支持同步调用,每次出 1 张,结果是 24 小时有效的图片链接。
可用型号
| 型号 | 模型 ID | 尺寸简写 | 官方价 |
|---|---|---|---|
| Seedream 5.0 Pro | seedream-5-0-pro | 1K / 1.5K / 2K | $0.045起/ 张 |
| Seedream 5.0 Lite | seedream-5-0-lite | 2K / 3K / 4K | $0.035/ 张 |
| Seedream 4.5 | seedream-4-5 | 2K / 4K | $0.04/ 张 |
选型建议:要 1K 小图只能用 Pro,Pro 的 1.5K 与 1K 同价、效果更好,建议优先 1.5K;Lite 与 4.5 最小输出 2K。「Seedance 海外 · Seedream」只提供 seedream-5-0-pro。
请求参数
生成
POST /v1/images/generations,JSON 请求体。加上 image 即为单图编辑、多图融合或局部编辑。
| 参数 | 必填 | 类型与限制 | 默认 | 说明 |
|---|---|---|---|---|
model | 必填 | 字符串,见上表 | — | 以当前密钥 GET /v1/models 的返回为准 |
prompt | 必填 | 字符串,去除首尾空白后非空 | — | 内容、构图、风格或编辑指令 |
size | 可选 | 型号尺寸简写,或 宽x高 | — | 不接受 auto,像素范围见下表 |
n | 可选 | 只能为 1 | 1 | 其他值(含 null)返回 400 |
response_format | 可选 | 只能为 url | url | 返回签名直链 |
output_format | 可选 | 按型号,见下表 | — | 输出图片格式 |
optimize_prompt_options | 可选 | 对象,mode 按型号取值 | — | 提示词优化模式 |
image | 可选 | URL / Data URL,字符串或字符串数组 | — | 参考图,传入即图生图 / 编辑 |
按型号的限制:
| 模型 ID | size 总像素 | 参考图上限 | output_format | optimize_prompt_options.mode |
|---|---|---|---|---|
seedream-5-0-pro | 921,600–4,624,220 | 10 | png / jpeg | standard / fast |
seedream-5-0-lite | 3,686,400–16,777,216 | 14 | png / jpeg | standard |
seedream-4-5 | 3,686,400–16,777,216 | 14 | jpeg | standard |
宽x高 的宽高比须在 1:16–16:1 之间。size 不合规时在生成前返回 400,不计费。
image 的每一项是 http(s) URL 或 base64 编码的 Data URL,Data URL 单张 ≤ 30 MB。支持 JPEG、PNG、WebP、BMP、TIFF、GIF、HEIC、HEIF;URL 在提交时不下载、不检查大小,须是服务端能取得的公开地址。
局部编辑不用遮罩:把标注直接画在参考图上,并在 prompt 中描述坐标、bbox、箭头或涂画区域。
编辑
POST /v1/images/edits 是给已有 OpenAI Images 编辑代码用的兼容入口,推荐 multipart/form-data,也接受与生成相同的 JSON。至少要带 1 张参考图。
| 参数 | 必填 | 类型与限制 | 默认 | 说明 |
|---|---|---|---|---|
image / image[] | 必填 | 文件或 URL 字符串,可重复 | — | 上传文件单张 ≤ 30 MB |
model、prompt | 必填 | 同「生成」 | — | — |
size、n、response_format、output_format | 可选 | 同「生成」 | — | — |
optimize_prompt_options[mode] | 可选 | 同「生成」的 mode | — | 也可写 optimize_prompt_mode |
请求里带 mask 字段即返回 400,传 null 也一样。multipart 中上表以外的字段会被忽略。
返回结果
同步返回标准 OpenAI Images JSON,图片在 data[].url。
| 字段 | 类型 | 说明 |
|---|---|---|
created | integer | Unix 秒 |
model | string | 请求的模型 ID |
data[].url | string | 图片签名直链,24 小时有效 |
data[].size | string | 实际输出的 宽x高 |
usage | object | 可能返回,含 generated_images 等用量 |
{
"model": "seedream-5-0-pro",
"created": 1760000000,
"data": [
{
"url": "https://…/result.jpeg?X-Signature=…",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}返回的 URL 是 24 小时有效的签名直链,过期后无法重新取得、只能重新生成(会再次计费),请收到后立即下载。
示例
文生图
curl https://api.hop-base.com/v1/images/generations \
-H "Authorization: Bearer sk-你的密钥" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-pro",
"prompt": "霓虹夜色下的未来城市街景,电影感构图",
"size": "2048x2048",
"response_format": "url"
}'参考图编辑
curl https://api.hop-base.com/v1/images/generations \
-H "Authorization: Bearer sk-你的密钥" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-pro",
"prompt": "把第一张图中的杯子移到桌面右侧,保持其余内容不变",
"image": ["https://example.com/source.png"],
"size": "2K",
"output_format": "png",
"response_format": "url"
}'注意事项
- 每次只出 1 张,要多张请分多次请求。
- 只支持同步:
Prefer: respond-async会被忽略,照常同步返回。 - 结果只有
url,不支持b64_json。 size不接受auto,Lite 与 4.5 的最小输出是 2K。seedream-4-5只输出 JPEG。- 不支持传统 mask,局部编辑请用带标注的参考图加 prompt 描述。
watermark由服务端固定为 false,传了不生效。- 复数
images、quality、stream等字段不生效,会被忽略。 seedream-5-0-lite是 Seedream 5.0 的轻量版,公开模型名为 Seedream 5.0 Lite,请勿当作 Pro 使用。- Data URL 必须是 base64 编码,MIME 须与图片一致。
- 官方规格:输入单张最多 30 MB / 36MP。
常见报错
参数不合规在生成前返回 400,不计费。内容安全拦截也返回 400、不计费,原因在 error.message 中。
| 报错 | 改法 |
|---|---|
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or a valid WIDTHxHEIGHT pixel size | 改用该型号的尺寸简写或合法 宽x高 |
model seedream-5-0-lite requires the total pixel count of size to be between 3686400 and 16777216 | 把宽高调到总像素区间内 |
size aspect ratio must be between 1:16 and 16:1 | 调整宽高比 |
only a single output is supported (n=1) | 去掉 n,多张分次请求 |
response_format only supports url | 去掉该字段或改为 url |
model seedream-4-5 only supports output_format jpeg | 改传 jpeg 或不传 |
at most 10 reference images are supported | 减少参考图张数 |
seedream does not accept a traditional mask; ... | 去掉 mask,改用带标注的参考图 |
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or a valid WIDTHxHEIGHT pixel size # 例如 "size": "auto"
model seedream-5-0-lite requires the total pixel count of size to be between 3686400 and 16777216
size aspect ratio must be between 1:16 and 16:1
missing prompt
response_format only supports url
only a single output is supported (n=1)
model seedream-4-5 only supports output_format jpeg
model seedream-5-0-lite only supports optimize_prompt_options.mode standard
optimize_prompt_options must be an object
image must be a URL/data URL string or an array of strings
every item in the image array must be a URL or data URL string
image must not be empty
at most 10 reference images are supported
reference image 1 is invalid: data URL must be base64-encoded
reference image 1 is invalid: unsupported image format image/svg+xml
reference image 1 is invalid: a single image must not exceed 30 MB
image edits require at least one image reference # /v1/images/edits 未带图
seedream does not accept a traditional mask; ... # /v1/images/edits 带 "mask" 即拒,null 也一样计费
按输出张数计费,5.0 Pro 每张参考图另外计费;生成失败与安全拦截不计费。5.0 Pro 按输出像素分档计价,1K 与 1.5K 同价。
单价见各型号的模型卡与登录后的模型广场。