01
单一入口,覆盖三款 Seedream 模型
调用 POST /api/v1/seedream/generations,通过 model 字段无缝切换 seedream-5-5(文生图与多图编辑)、seedream-5-5-layers(图层拆解)与 seedream-5-pro。
开发者 API · V1
通过统一 REST 接口调用 Seedream 5.5、Seedream 5.5 Layers 与 Seedream 5 Pro,实现高质量文生图、图生图编辑、透明背景生成与图层拆解。与网页工作台共享同一套积分账本和生成历史。
01
调用 POST /api/v1/seedream/generations,通过 model 字段无缝切换 seedream-5-5(文生图与多图编辑)、seedream-5-5-layers(图层拆解)与 seedream-5-pro。
02
每次 Seedream API 调用都直接从现有 FIFO 积分余额扣费,所有任务自动同步至个人中心的「历史记录」与「积分明细」。
03
传入公网 HTTPS webhook_url 和可选 webhook_secret 即可接收 HMAC-SHA256 签名回调,也可随时轮询 GET /api/v1/seedream/generations/{id}。
04
与网页工作台计费完全一致,且不额外限制并发数与 RPM。任务失败、超时或拆层未用满名额时,系统自动退回对应积分。
鉴权与基础地址
在「个人中心 → API 密钥」创建并管理 sk- 密钥。所有请求均走 HTTPS,且需使用付费账号(已开通有效订阅或购买过积分包)。
基础地址 (Base URL)
https://seedream5-5.net/api/v1鉴权请求头 (Authorization)
快速开始
在下方切换模型模式和编程语言。图生图编辑与图层拆解支持直接传入公网 HTTPS 图片 URL,无需额外上传步骤。
curl -X POST "https://seedream5-5.net/api/v1/seedream/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: req_20261127_001" \
-d '{
"model": "seedream-5-5",
"prompt": "Minimalist matte-black ceramic pour-over coffee dripper centered on a clean studio backdrop, crisp editorial lighting.",
"aspect_ratio": "1:1",
"resolution": "1.5K",
"output_format": "png",
"background": "transparent",
"webhook_url": "https://your-app.example.com/webhooks/seedream",
"webhook_secret": "whsec_replace_with_at_least_16_chars"
}'# 1. Poll generation status (returns image_url, images[], and layers[])
curl -X GET "https://seedream5-5.net/api/v1/seedream/generations/TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# 2. Check remaining credit balance & Seedream pricing
curl -X GET "https://seedream5-5.net/api/v1/credits" \
-H "Authorization: Bearer YOUR_API_KEY"接口清单
所有接口均位于 /api/v1 路径下,请求与响应统一使用 application/json。
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/v1/seedream/generations | 创建 Seedream 生成任务(支持 seedream-5-5、seedream-5-5-layers 与 seedream-5-pro),支持 Idempotency-Key 与 webhook_url。 |
| GET | /api/v1/seedream/generations/{id} | 查询单条任务状态、持久化公网 image_url、images[]、layers[] 图层元数据、实际结算积分与错误信息。 |
| GET | /api/v1/seedream/generations | 分页获取账号下 Seedream 生成记录(网页与 API 互通),支持 ?page=1&limit=20(最大 50)、?model= 及 ?status=success|failed|pending|processing。 |
| GET | /api/v1/credits | 查询当前剩余积分余额、付费权限状态以及三款 Seedream 模型的完整计费标准。 |
请求参数规范
本接口严格仅开放 Seedream 系列模型。所有外部公网 HTTP(S) 图片 URL 均会经过基础安全校验后直接用于生成。
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| model | string | 必填 | 可选 "seedream-5-5"、"seedream-5-5-layers" 或 "seedream-5-pro"。传入非 Seedream 模型将返回 400 invalid_model。 |
| prompt | string | 按模型决定 | seedream-5-5(5–5,000 字符)与 seedream-5-pro(3–5,000 字符)必填;seedream-5-5-layers 可选(0–2,000 字符)。 |
| resolution | string | 可选 | seedream-5-5:"1K"、"1.5K"(默认)、"2K";seedream-5-5-layers:"1K"、"1.5K"(默认)、"2K"、"auto";seedream-5-pro:"1K"(默认)、"2K"。别名:size。 |
| output_format | string | 可选 | 输出图片格式:"png"(默认)或 "jpeg"。 |
| webhook_url | string (HTTPS) | 可选 | 公网 HTTPS 回调地址,任务到达 success、failed 或 canceled 终态时自动发送 POST 通知。 |
| webhook_secret | string | 可选 | 16–256 位密钥,用于生成 X-Seedream-Signature(HMAC-SHA256)回调签名。需与 webhook_url 同时传入。 |
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| aspect_ratio | string | 可选 | 支持 "1:1"、"4:3"、"3:4"、"16:9"、"9:16"、"2:3"、"3:2"、"21:9"。seedream-5-5 图生图额外支持 "auto"(默认 "auto");seedream-5-pro 默认 "1:1"。 |
| image_urls | string[] | 可选 | 最多 10 张公网参考图 URL(JPG、PNG、WebP),传入即自动进入图生图编辑模式;留空则为文生图。别名:images、image_input。 |
| background | string | 可选 | 仅 seedream-5-5 支持:"auto"(默认)、"transparent"(透明背景,必须搭配 output_format: "png")或 "opaque"。 |
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| image_url | string (URL) | 必填 | 单张待拆解的公网 HTTP(S) 图片 URL(推荐使用 PNG 或 JPEG)。别名:image、image_urls[0]。 |
| max_images | integer | 可选 | 最大拆解图层数量,范围 2–100(默认 2)。创建时按上限预扣,完成后按实际返回图层数自动退还多余积分。 |
| text_recognition | boolean | 可选 | 设为 true 时识别画面中的文字并拆分为独立透明图层。默认 false。 |
响应对象结构
任务生命周期为 pending → processing → success(或 failed / canceled)。完成后,image_url 与 images[] 返回持久化公网图片地址,seedream-5-5-layers 同时返回包含层级与坐标信息的 layers[] 数组。
{
"id": "8f3b2c1a-4d5e-4f6a-9b7c-1234567890ab",
"object": "seedream.generation",
"model": "seedream-5-5",
"mode": "text-to-image",
"status": "pending",
"prompt": "Minimalist matte-black ceramic pour-over coffee dripper centered on a clean studio backdrop...",
"aspect_ratio": "1:1",
"resolution": "1.5K",
"output_format": "png",
"background": "transparent",
"max_images": null,
"text_recognition": null,
"cost_credits": 6,
"credits_refunded": false,
"image_url": null,
"images": [],
"layers": null,
"error": null,
"webhook_url": "https://your-app.example.com/webhooks/seedream",
"created_at": "2026-11-27T00:00:00.000Z",
"updated_at": "2026-11-27T00:00:01.000Z"
}{
"id": "4c9a1e2b-7f3d-4a5b-8c1e-abcdef123456",
"object": "seedream.generation",
"model": "seedream-5-5-layers",
"mode": "layer-decomposition",
"status": "success",
"prompt": "Separate headline typography, foreground subject, and studio backdrop.",
"aspect_ratio": "auto",
"resolution": "1.5K",
"output_format": "png",
"background": null,
"max_images": 6,
"text_recognition": true,
"cost_credits": 19,
"credits_refunded": false,
"image_url": "https://cdn.example.com/seedream/layers/task/0.png",
"images": [
"https://cdn.example.com/seedream/layers/task/0.png",
"https://cdn.example.com/seedream/layers/task/1.png",
"https://cdn.example.com/seedream/layers/task/2.png"
],
"layers": [
{
"index": 0,
"url": "https://cdn.example.com/seedream/layers/task/0.png",
"z_index": 0,
"name": "background",
"description": "Studio backdrop",
"size": "1536x1536",
"bounding_box": {
"absolute": [0, 0, 1536, 1536],
"normalized": [0, 0, 1, 1]
}
}
],
"error": null,
"webhook_url": "https://your-app.example.com/webhooks/seedream",
"created_at": "2026-11-27T00:00:00.000Z",
"updated_at": "2026-11-27T00:00:24.000Z"
}WEBHOOK 回调
创建任务时传入 webhook_url 即可免去高频轮询。任务进入终态(success、failed 或 canceled)后,系统将立即向你的服务端发送 HTTPS POST 回调。
{
"event": "generation.completed",
"timestamp": 1764201618,
"data": {
"id": "8f3b2c1a-4d5e-4f6a-9b7c-1234567890ab",
"object": "seedream.generation",
"model": "seedream-5-5",
"mode": "text-to-image",
"status": "success",
"aspect_ratio": "1:1",
"resolution": "1.5K",
"output_format": "png",
"background": "transparent",
"cost_credits": 6,
"credits_refunded": false,
"image_url": "https://cdn.example.com/seedream/image/task-0.png",
"images": ["https://cdn.example.com/seedream/image/task-0.png"],
"layers": null,
"error": null,
"created_at": "2026-11-27T00:00:00.000Z",
"updated_at": "2026-11-27T00:00:18.000Z"
}
}import crypto from "node:crypto";
export function verifySeedreamSignature({ rawBody, timestamp, signature, secret }) {
const expected =
"sha256=" +
crypto
.createHmac("sha256", secret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
const a = Buffer.from(signature || "", "utf8");
const b = Buffer.from(expected, "utf8");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}积分计费说明
所有 Seedream API 请求均沿用网页工作台的真实计费公式,直接从同一账号积分余额扣除。
| 模型 | 分辨率 | 基础积分 | 参考图与图层计费公式 |
|---|---|---|---|
| seedream-5-5 | 1K / 1.5K | 6 积分 | 文生图 6 积分;图生图按 6 + floor(参考图数 × 1.5) 计费(1–10 张)。 |
| seedream-5-5 | 2K | 12 积分 | 文生图 12 积分;图生图按 12 + floor(参考图数 × 1.5) 计费(1–10 张)。 |
| seedream-5-5-layers | 1K / 1.5K (2K / auto) | 6(或 12)/ 层 | 提交时预扣 max_images × 单层积分 + 1;完成后按实际图层数结算并自动退还多余预扣积分。 |
| seedream-5-pro | 1K / 2K | 7 / 14 积分 | 首张参考图免费;第 2–10 张参考图每张加收 1 积分。 |
错误处理
所有错误响应均返回统一的 JSON 结构:{"error": {"code": "...", "message": "..."}}。
| HTTP | 错误码 | 含义与排查建议 |
|---|---|---|
| 400 | invalid_model / invalid_parameters / invalid_webhook_url | 请确认 model 属于 Seedream 系列、提示词长度与分辨率有效、透明背景已选 PNG,且图片/回调 URL 为公网地址。 |
| 401 | unauthorized | 缺少、格式错误或已失效的 Bearer API 密钥。 |
| 402 | insufficient_credits | 账号剩余积分不足以支付本次模型、分辨率及输入图数量所需费用,请前往套餐页充值。 |
| 403 | paid_account_required | 调用 API 需具备有效付费权限(订阅或积分包购买记录)。 |
| 404 | not_found | 指定的 Seedream 任务 ID 不存在、非 Seedream 任务或不属于当前账号。 |
| 409 | idempotency_conflict | 相同的 Idempotency-Key 被复用于不同的模型或生成模式。 |
| 502 | upstream_error | 任务提交失败,系统已自动全额退回预扣积分。 |
常见问题
API 严格限定开放 Seedream 系列模型:seedream-5-5(文生图/图生图)、seedream-5-5-layers(图层拆解)和 seedream-5-pro(文生图/图生图),无法通过此 API 调用站内其他非 Seedream 模型。
完全互通。API 请求直接从你现有的 FIFO 积分账本扣费,且每条通过 API 创建的记录都会同步展示在「个人中心 → 历史记录」中。
拥有有效付费权限(任意有效订阅或已购买积分包)的账号均可调用。你可以在「个人中心 → API 密钥」创建 sk- 密钥。
任务创建时按 max_images 预扣积分(再加 1 积分输入费)。任务完成后系统会自动按实际返回的图层数量结算,并将未使用的预扣积分原路退回。
创建任务时同时传入 webhook_url 和 16–256 位 webhook_secret。收到回调后,使用密钥对 "{X-Seedream-Timestamp}.{rawBody}" 计算 HMAC-SHA256,并与请求头 X-Seedream-Signature 做恒定时间比对即可。
在 POST /api/v1/seedream/generations 请求头中传入唯一的 Idempotency-Key。使用相同 Key 重试会返回 HTTP 200 及原任务结果,不会重复创建任务或二次扣费。
几秒内创建你的 API 密钥,将 Seedream 5.5 文生图、多图编辑、透明资产与图层拆解能力无缝接入你的产品。