支持最多 100 张产品图、可选 1 张参考图,并可通过 count 批量生成洗图结果。
提交任务
提交批量洗图任务。平台会根据产品图、参考图和 count 自动生成多个洗图任务。
POST/api/third-party/imageWash/generate
请求头
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| X-API-Token | string | 是 | 平台提供的调用凭证,用于识别当前账号或租户。 |
| Content-Type | string | 是 | 提交任务时固定使用 application/json。 |
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 否 | 模型,可传 nanoBanana2 或 nanoBananaPro。 |
| prompt | string | 是 | 洗图指令,建议明确替换内容、保留内容和最终画面风格。 |
| productImages | string[] | 是 | 产品图 URL 列表,最多 100 张。 |
| referenceImages | string[] | 否 | 参考图 URL 列表,当前建议最多 1 张。 |
| resolution | string | 否 | 输出分辨率,可传 1k、2k、4k。 |
| aspectRatio | string | 否 | 输出比例,如 auto、1:1、4:3。 |
| count | number | 否 | 每组输入生成张数;最终子任务数会乘以 count。 |
请求示例
bash
curl -X POST "https://yunfanzhilian.com/api/third-party/imageWash/generate" \
-H "X-API-Token: your_token" \
-H "Content-Type: application/json" \
-d '{
"model": "nanoBanana2",
"prompt": "以产品图为主体,可参考参考图的风格/服装/场景进行洗图,保持产品信息与电商主图质感",
"productImages": [
"https://your-cdn.com/product-1.jpg",
"https://your-cdn.com/product-2.jpg"
],
"referenceImages": [
"https://your-cdn.com/reference.jpg"
],
"resolution": "2k",
"aspectRatio": "auto",
"count": 2
}'响应字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| code | number | - | 业务状态码,200 表示请求成功。 |
| message | string | - | 本次请求的结果说明。 |
| data.taskId | string | - | 任务 ID。提交成功后请保存,用于查询生成结果。 |
| data.recordId | string | - | 生成记录 ID,可用于问题排查和记录追踪。 |
| data.status | string | - | 任务初始状态,通常为 pending 或 processing。 |
| timestamp | string | - | 响应时间,ISO 8601 格式。 |
响应示例
json
{
"code": 200,
"message": "批量洗图任务已提交",
"data": {
"taskId": "task_xxxxxxxx",
"status": "pending",
"totalTasks": 4,
"submittedTasks": 4,
"failedSubmissions": 0,
"estimatedTime": "30-120秒",
"cost": {
"unitCoins": 4,
"chargedCoins": 16,
"refundedCoins": 0
},
"items": [
{
"childTaskId": "task_xxxxxxxx_1",
"recordId": "67f0c1d6f4a0d2b4d1d0c003",
"status": "pending",
"productImage": "https://your-cdn.com/product-1.jpg",
"referenceImage": "https://your-cdn.com/reference.jpg"
}
]
},
"timestamp": "2026-03-31T09:33:00.000Z"
}注意事项
- 单次最多生成 100 个子任务,超出后建议拆批提交。
- 达到服务端并发提交上限时,子任务会进入等待队列;等待超时或队列满时返回 429,请稍后重试。
- partial_failed 表示部分子任务成功,调用方可优先展示成功结果。
