Seedream5.0 Pro 图层分离
本页由 ModelFold 文档站根据上游官方 OpenAPI 文档同步生成。接口路径、参数、示例与官方保持一致;品牌与 API 域名已替换为 ModelFold。
接口
POST /jobs/createTask
完整 URL: https://ai.modelfold.online/v1/jobs/createTask
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
使用 Seedream5.0 Pro 进行图层分离
TIP
底图和每个拆分图层各算一张计费;自动识别模式下层数由模型决定,费用随之变化。当前价格见 ai.modelfold.online/pricing。
查询任务状态
提交任务后,可通过统一的查询端点查看任务进度并获取处理结果:
- 获取任务详情 — 了解如何查询任务状态并获取编辑结果
TIP
生产环境中,建议使用 callBackUrl 参数在生成完成时接收自动通知,而非轮询状态端点。
相关资源
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于执行图层拆分任务的模型名称。必填字段。 - 此端点必须使用 seedream/5-pro-layer-decomposition 默认值:"seedream/5-pro-layer-decomposition"。 可选值:seedream/5-pro-layer-decomposition。 示例:seedream/5-pro-layer-decomposition。 |
callBackUrl | string | 否 | 接收任务完成通知的回调 URL。可选,但建议在生产环境中使用。 - 任务完成后,系统将向此 URL 发送 POST 请求 - 回调内容包含任务状态、生成结果 URL 和任务信息 - 也可以通过获取任务详情接口主动查询任务状态 - 回调签名校验方式请参考 Webhook 校验指南 示例: https://your-domain.com/api/callback。 |
input | object | 是 | 图层拆分任务的输入参数 |
input.prompt | string | 否 | 可选的图层拆分提示词。 - 传入提示词时,模型根据提示词拆分指定元素 - 不传提示词时,模型自动识别图片中的主要元素 - 支持使用 <bbox>x1 y1 x2 y2</bbox> 精确指定元素位置,推荐使用 0–1000 范围的归一化坐标 示例:将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层。 |
input.image_url | string | 是 | 需要进行图层拆分的源图片 URL。 - 必须且只能上传 1 张图片 - 支持格式:PNG、JPEG。 - 图片大小不超过 30 MB - 总像素范围为 262,144–36,000,000 - 宽高比范围为 1:16–16:1 示例: https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png。 |
input.size | string | 是 | 必填。输出分辨率档位:auto、1K、1.5K、2K。auto 按输入图尺寸自动选择。 可选值:auto / 1K / 1.5K / 2K。 示例:2K。 |
input.output_format | string | 否 | 底图的输出格式。该参数仅控制底图格式,所有拆分图层固定输出为 PNG。 默认值:"jpeg"。 可选值:png / jpeg。 示例:jpeg。 |
请求示例
bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream/5-pro-layer-decomposition",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层",
"image_url": "https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png",
"size": "2K"
}
}'json
{
"model": "seedream/5-pro-layer-decomposition",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层",
"image_url": "https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png",
"size": "2K"
}
}响应
200 —
json
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_seedream_1765172101886"
}
}500 — Server error.
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | Response status code - 200: Success - Request has been processed successfully - 401: Unauthorized - Authentication credentials are missing or invalid - 402: Insufficient Credits - Account does not have enough credits to perform the operation - 404: Not Found - The requested resource or endpoint does not exist - 408: Timeout - No result has been returned for over 10 minutes. - 422: Validation Error - The request parameters failed validation checks - 429: Rate Limited - Request limit has been exceeded for this resource - 455: Service Unavailable - System is currently undergoing maintenance - 500: Server Error - An unexpected error occurred while processing the request - 501: Generation Failed - Content generation task failed - 505: Feature Disabled - The requested feature is currently disabled |
msg | string | 是 | Response message, error description when failed |
data | object | 是 | — |
json
{
"code": 500,
"msg": "Server Error - An unexpected error occurred while processing the request",
"data": null
}回调
onImageGenerated
回调地址:{$request.body#/callBackUrl}(即请求体里的 callBackUrl)。
任务成功或失败时发送回调。
回调体参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 否 | 200:成功;501:失败,原因见 data.failCode 与 data.failMsg。 可选值:200 / 501。 示例:200。 |
msg | string | 否 | 状态消息 示例:Playground task completed successfully.。 |
data | object | 否 | — |
data.completeTime | integer | 否 | 任务完成时间,Unix 毫秒时间戳 示例:1786417803000。 |
data.costTime | integer | 否 | 处理耗时(秒),成功和失败回调都会返回。 示例:43。 |
data.createTime | integer | 否 | 任务创建时间,Unix 毫秒时间戳 示例:1786417758000。 |
data.creditsConsumed | number | 否 | 本任务消耗的积分;失败任务为 0。 示例:21。 |
data.model | string | 否 | 图片图层拆分任务使用的模型 示例:seedream/5-pro-layer-decomposition。 |
data.param | string | 否 | 创建任务时提交的参数,JSON 字符串格式 示例:{"input":"{\"size\":\"auto\",\"output_format\":\"jpeg\",\"image_url\":\"https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png\",\"prompt\":\"将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层\"}","callBackUrl":"https://your-domain.com/api/callback","model":"seedream/5-pro-layer-decomposition"}。 |
data.resultJson | string | 否 | 图层拆分结果,JSON 字符串格式。resultObject.layers_data 包含各图层信息,resultUrls 包含所有输出文件的 URL 列表。仅在 state 为 success 时出现。 示例:{"resultObject":{"layers_data":[{"z_index":0,"size":"1080x1080","output_format":"jpeg","url":"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417797749-4ts7v7lh2v9.jpeg"},{"z_index":1,"size":"1179x245","output_format":"png","bounding_box":{"absolute":[202,63,872,202],"normalized":[187,58,806,186]},"name":"Seedream标题文字","description":"提取黄色的Seedream标题文字,只保留文字本体,不包含任何标注框线、背景内容","url":"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417799558-xckcwufhvg.png"},{"z_index":2,"size":"425x995","output_format":"png","bounding_box":{"absolute":[385,331,686,1035],"normalized":[356,306,634,957]},"name":"彩色金刚鹦鹉","description":"提取站在树枝上的红黄绿蓝多色羽毛金刚鹦鹉,只保留鹦鹉本体,不包含任何标注框线、树枝和背景内容","url":"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417801592-m1rf8z5zs0l.png"}]},"resultUrls":["https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417797749-4ts7v7lh2v9.jpeg","https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417799558-xckcwufhvg.png","https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417801592-m1rf8z5zs0l.png"]}。 |
data.state | string | 否 | 任务状态 可选值:success / fail。 示例:success。 |
data.taskId | string | 否 | 任务 ID 示例:d481b8cd378397dce459252764a33621。 |
data.updateTime | integer | 否 | 完成时间请以 completeTime 为准;updateTime 可能与 createTime 相同。 示例:1786417803000。 |
data.failCode | string | 否 | 失败码,数字字符串,如 "400"、"500"。仅在 state 为 fail 时出现。 示例:500。 |
data.failMsg | string | 否 | 失败原因,仅在 state 为 fail 时出现。 示例:<error detail>。 |
成功
json
{
"code": 200,
"msg": "Playground task completed successfully.",
"data": {
"taskId": "d481b8cd378397dce459252764a33621",
"model": "seedream/5-pro-layer-decomposition",
"state": "success",
"param": "{\"input\":\"{\\\"size\\\":\\\"auto\\\",\\\"output_format\\\":\\\"jpeg\\\",\\\"image_url\\\":\\\"https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png\\\",\\\"prompt\\\":\\\"将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/5-pro-layer-decomposition\"}",
"resultJson": "{\"resultObject\":{\"layers_data\":[{\"z_index\":0,\"size\":\"1080x1080\",\"output_format\":\"jpeg\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417797749-4ts7v7lh2v9.jpeg\"},{\"z_index\":1,\"size\":\"1179x245\",\"output_format\":\"png\",\"bounding_box\":{\"absolute\":[202,63,872,202],\"normalized\":[187,58,806,186]},\"name\":\"Seedream标题文字\",\"description\":\"提取黄色的Seedream标题文字,只保留文字本体,不包含任何标注框线、背景内容\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417799558-xckcwufhvg.png\"},{\"z_index\":2,\"size\":\"425x995\",\"output_format\":\"png\",\"bounding_box\":{\"absolute\":[385,331,686,1035],\"normalized\":[356,306,634,957]},\"name\":\"彩色金刚鹦鹉\",\"description\":\"提取站在树枝上的红黄绿蓝多色羽毛金刚鹦鹉,只保留鹦鹉本体,不包含任何标注框线、树枝和背景内容\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417801592-m1rf8z5zs0l.png\"}]},\"resultUrls\":[\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417797749-4ts7v7lh2v9.jpeg\",\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417799558-xckcwufhvg.png\",\"https://tempfile.aiquickdraw.com/seedream5pro-layer/1786417801592-m1rf8z5zs0l.png\"]}",
"completeTime": 1786417803000,
"createTime": 1786417758000,
"costTime": 43,
"creditsConsumed": 21,
"updateTime": 1786417803000
}
}失败
json
{
"code": 501,
"msg": "Playground task failed.",
"data": {
"taskId": "d481b8cd378397dce459252764a33621",
"model": "seedream/5-pro-layer-decomposition",
"state": "fail",
"param": "{\"input\":\"{\\\"size\\\":\\\"auto\\\",\\\"output_format\\\":\\\"jpeg\\\",\\\"image_url\\\":\\\"https://static.aiquickdraw.com/tools/example/1786019968051_cKRYLHHu.png\\\",\\\"prompt\\\":\\\"将标题文字 <bbox>179 58 809 197</bbox> 和鹦鹉 <bbox>330 274 641 991</bbox> 拆分为独立图层\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/5-pro-layer-decomposition\"}",
"failCode": "500",
"failMsg": "<error detail>",
"completeTime": 1786417803000,
"createTime": 1786417758000,
"costTime": 43,
"creditsConsumed": 0,
"updateTime": 1786417803000
}
}