Seedream5.0 Flash 图层分离
本页由 ModelFold 文档站根据上游官方 OpenAPI 文档同步生成。接口路径、参数、示例与官方保持一致;品牌与 API 域名已替换为 ModelFold。
接口
POST /jobs/createTask
完整 URL: https://ai.modelfold.online/v1/jobs/createTask
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
使用 Seedream 5.0 Flash 进行图层分离
TIP
底图和每个拆分图层各算一张计费;自动识别模式下层数由模型决定,费用随之变化。当前价格见 ai.modelfold.online/pricing。
查询任务状态
提交任务后,可通过统一的查询端点查看任务进度并获取处理结果:
- 获取任务详情 — 了解如何查询任务状态并获取编辑结果
TIP
生产环境中,建议使用 callBackUrl 参数在生成完成时接收自动通知,而非轮询状态端点。
相关资源
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于执行图层拆分任务的模型名称。必填字段。 - 此端点必须使用 seedream/5-flash-layer-decomposition 默认值:"seedream/5-flash-layer-decomposition"。 可选值:seedream/5-flash-layer-decomposition。 示例:seedream/5-flash-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 范围的归一化坐标- 长度 4–5000 字符 示例: 将标题文字 <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:1K 分辨率档位- 1.5K:1.5K 分辨率档位- 2K: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-flash-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",
"output_format": "jpeg"
}
}'json
{
"model": "seedream/5-flash-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",
"output_format": "jpeg"
}
}响应
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)。
Sent when the task succeeds or fails.
回调体参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 否 | 200: success. 501: failure; see data.failCode and data.failMsg. 可选值:200 / 501。 示例:200。 |
msg | string | 否 | Status message 示例:Playground task completed successfully.。 |
data | object | 否 | — |
data.taskId | string | 否 | Task ID 示例:79e8e9c3012235f2277ce118f19d930a。 |
data.model | string | 否 | Model used for the image layer decomposition task 示例:seedream/5-flash-layer-decomposition。 |
data.state | string | 否 | Task status 可选值:success / fail。 示例:success。 |
data.param | string | 否 | Parameters submitted when creating the task, in JSON string format 示例:{"input":"{\"size\":\"auto\",\"output_format\":\"png\",\"image_url\":\"https://static.aiquickdraw.com/tools/example/1790672695524_2ISGVaOd.png\",\"prompt\":\"Split the content in the image into 3 layers by combining some text elements:\\nLayer 1: Text <bbox>67 34 944 164</bbox>, <bbox>76 181 285 199</bbox>, <bbox>815 181 946 199</bbox>\\nLayer 2: 1 arctic fox <bbox>219 310 873 696</bbox>\\nLayer 3: Text <bbox>77 797 941 880</bbox>, <bbox>175 899 855 923</bbox>\",\"nsfw_checker\":true}","callBackUrl":"https://your-domain.com/api/callback","model":"seedream/5-flash-layer-decomposition"}。 |
data.resultJson | string | 否 | JSON string of the generation result. Present only when state is success. After parsing: resultUrls lists the base image first, followed by each separated layer; resultObject.layers_data describes each layer (z_index 0 is the base image and has no bounding_box/name/description). 示例:{"resultObject":{"layers_data":[{"z_index":0,"size":"1024x1536","output_format":"png","url":"https://tempfile.aiquickdraw.com/seedream5flash/1791456820549-y4diwaen2p.png"},{"z_index":1,"size":"1321x265","output_format":"png","bounding_box":{"absolute":[82,1239,944,1412],"normalized":[80,807,921,919]},"name":"Bottom caption text","description":"Extract the bottom caption text elements including 'ARCTIC QUIET' and 'BEAUTY IN THE STILLNESS', no other content included.","url":"https://tempfile.aiquickdraw.com/seedream5flash/1791456821060-yw7wmtc7saq.png"},{"z_index":2,"size":"821x720","output_format":"png","bounding_box":{"absolute":[228,482,897,1070],"normalized":[223,314,875,696]},"name":"Arctic fox","description":"Extract the full body of the standing white arctic fox, no background elements included.","url":"https://tempfile.aiquickdraw.com/seedream5flash/1791456821475-egwgijina1s.png"},{"z_index":3,"size":"1314x373","output_format":"png","bounding_box":{"absolute":[74,51,950,300],"normalized":[72,33,927,195]},"name":"Top header text","description":"Extract the top header text elements including 'ModelFold AI', 'FIELD NOTES' and 'VOL. 01', no other content included.","url":"https://tempfile.aiquickdraw.com/seedream5flash/1791456822084-cnlvwfwro2g.png"}]},"resultUrls":["https://tempfile.aiquickdraw.com/seedream5flash/1791456820549-y4diwaen2p.png","https://tempfile.aiquickdraw.com/seedream5flash/1791456821060-yw7wmtc7saq.png","https://tempfile.aiquickdraw.com/seedream5flash/1791456821475-egwgijina1s.png","https://tempfile.aiquickdraw.com/seedream5flash/1791456822084-cnlvwfwro2g.png"]}。 |
data.completeTime | integer | 否 | Task completion time, represented as a Unix timestamp in milliseconds 示例:1791456822552。 |
data.costTime | integer | 否 | Processing time in seconds. Present on both success and failure callbacks. 示例:34。 |
data.createTime | integer | 否 | Task creation time, represented as a Unix timestamp in milliseconds 示例:1791456787658。 |
data.creditsConsumed | number | 否 | Credits consumed by the task; 0 for failed tasks. 示例:12.96。 |
data.updateTime | integer | 否 | Use completeTime as the completion time; updateTime may equal createTime. 示例:1791456822552。 |
data.failCode | string | 否 | Failure code, a numeric string such as "400" or "500". Present only when state is fail. 示例:500。 |
data.failMsg | string | 否 | Failure reason. Present only when state is fail. 示例:<error detail>。 |
Success
json
{
"code": 200,
"msg": "Playground task completed successfully.",
"data": {
"taskId": "79e8e9c3012235f2277ce118f19d930a",
"model": "seedream/5-flash-layer-decomposition",
"state": "success",
"param": "{\"input\":\"{\\\"size\\\":\\\"auto\\\",\\\"output_format\\\":\\\"png\\\",\\\"image_url\\\":\\\"https://static.aiquickdraw.com/tools/example/1790672695524_2ISGVaOd.png\\\",\\\"prompt\\\":\\\"Split the content in the image into 3 layers by combining some text elements:\\\\nLayer 1: Text <bbox>67 34 944 164</bbox>, <bbox>76 181 285 199</bbox>, <bbox>815 181 946 199</bbox>\\\\nLayer 2: 1 arctic fox <bbox>219 310 873 696</bbox>\\\\nLayer 3: Text <bbox>77 797 941 880</bbox>, <bbox>175 899 855 923</bbox>\\\",\\\"nsfw_checker\\\":true}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/5-flash-layer-decomposition\"}",
"resultJson": "{\"resultObject\":{\"layers_data\":[{\"z_index\":0,\"size\":\"1024x1536\",\"output_format\":\"png\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5flash/1791456820549-y4diwaen2p.png\"},{\"z_index\":1,\"size\":\"1321x265\",\"output_format\":\"png\",\"bounding_box\":{\"absolute\":[82,1239,944,1412],\"normalized\":[80,807,921,919]},\"name\":\"Bottom caption text\",\"description\":\"Extract the bottom caption text elements including 'ARCTIC QUIET' and 'BEAUTY IN THE STILLNESS', no other content included.\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5flash/1791456821060-yw7wmtc7saq.png\"},{\"z_index\":2,\"size\":\"821x720\",\"output_format\":\"png\",\"bounding_box\":{\"absolute\":[228,482,897,1070],\"normalized\":[223,314,875,696]},\"name\":\"Arctic fox\",\"description\":\"Extract the full body of the standing white arctic fox, no background elements included.\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5flash/1791456821475-egwgijina1s.png\"},{\"z_index\":3,\"size\":\"1314x373\",\"output_format\":\"png\",\"bounding_box\":{\"absolute\":[74,51,950,300],\"normalized\":[72,33,927,195]},\"name\":\"Top header text\",\"description\":\"Extract the top header text elements including 'ModelFold AI', 'FIELD NOTES' and 'VOL. 01', no other content included.\",\"url\":\"https://tempfile.aiquickdraw.com/seedream5flash/1791456822084-cnlvwfwro2g.png\"}]},\"resultUrls\":[\"https://tempfile.aiquickdraw.com/seedream5flash/1791456820549-y4diwaen2p.png\",\"https://tempfile.aiquickdraw.com/seedream5flash/1791456821060-yw7wmtc7saq.png\",\"https://tempfile.aiquickdraw.com/seedream5flash/1791456821475-egwgijina1s.png\",\"https://tempfile.aiquickdraw.com/seedream5flash/1791456822084-cnlvwfwro2g.png\"]}",
"completeTime": 1791456822552,
"createTime": 1791456787658,
"costTime": 34,
"creditsConsumed": 12.96,
"updateTime": 1791456822552
}
}Failure
json
{
"code": 501,
"msg": "Playground task failed.",
"data": {
"taskId": "79e8e9c3012235f2277ce118f19d930a",
"model": "seedream/5-flash-layer-decomposition",
"state": "fail",
"param": "{\"input\":\"{\\\"size\\\":\\\"auto\\\",\\\"output_format\\\":\\\"png\\\",\\\"image_url\\\":\\\"https://static.aiquickdraw.com/tools/example/1790672695524_2ISGVaOd.png\\\",\\\"prompt\\\":\\\"Split the content in the image into 3 layers by combining some text elements:\\\\nLayer 1: Text <bbox>67 34 944 164</bbox>, <bbox>76 181 285 199</bbox>, <bbox>815 181 946 199</bbox>\\\\nLayer 2: 1 arctic fox <bbox>219 310 873 696</bbox>\\\\nLayer 3: Text <bbox>77 797 941 880</bbox>, <bbox>175 899 855 923</bbox>\\\",\\\"nsfw_checker\\\":true}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/5-flash-layer-decomposition\"}",
"failCode": "500",
"failMsg": "<error detail>",
"completeTime": 1791456822552,
"createTime": 1791456787658,
"costTime": 34,
"creditsConsumed": 0,
"updateTime": 1791456822552
}
}