功能 · 批量隐形模特
批量隐形模特 API 适用于完整商品目录
一句话总结
Photta 的批量隐形模特 endpoint 接收服装照片数组,并返回一个批次 id 以及每张图像对应的项目 id。整批所需的 credits 会在前期预扣;轮询该批次即可获取聚合状态。
- 常规耗时: 1.5–4 min per image
- Credits: 2K 分辨率 4 credits · 4K 分辨率 5 credits
- 处理方式: 异步,轮询
- 限制: 600 次请求/分钟
- 身份验证: Bearer key
本页所有数据均来自 Photta API 文档 · 已验证
RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/ghost-mannequin/batch \
-H "Authorization: Bearer $PHOTTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id')const res = await fetch("https://api.photta.app/api/v1/ghost-mannequin/batch", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PHOTTA_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}),
});
const { data } = await res.json(); // data.id, data.statusimport os, requests
res = requests.post(
"https://api.photta.app/api/v1/ghost-mannequin/batch",
headers={"Authorization": f"Bearer {os.environ['PHOTTA_API_KEY']}"},
json={
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
},
)
data = res.json()["data"] # data["id"], data["status"]
概览
概览
- 端点
- POST /api/v1/ghost-mannequin/batch
- 身份验证
- Bearer API 密钥
- 处理方式
- 异步 — 轮询状态端点
- 常规耗时
- 1.5–4 min per image
- Credits
- 2K 分辨率 4 credits · 4K 分辨率 5 credits
- 宽高比
- 3:4 · 1:1 · 4:3 · 9:16 · 16:9
- 输入限制
- 单张图片最大 10 MB;支持 JPEG, PNG, WebP
- 幂等性
- 否
请求与响应
请求
RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/ghost-mannequin/batch \
-H "Authorization: Bearer $PHOTTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id')const res = await fetch("https://api.photta.app/api/v1/ghost-mannequin/batch", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PHOTTA_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
}),
});
const { data } = await res.json(); // data.id, data.statusimport os, requests
res = requests.post(
"https://api.photta.app/api/v1/ghost-mannequin/batch",
headers={"Authorization": f"Bearer {os.environ['PHOTTA_API_KEY']}"},
json={
"product_images": [
{
"image": "https://cdn.yourstore.com/products/jacket-front.jpg",
"back_image": "https://cdn.yourstore.com/products/jacket-back.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/shirt-front.jpg",
"image_side": "front"
},
{
"image": "https://cdn.yourstore.com/products/trousers-front.jpg",
"image_side": "front"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"user_instruction": "closed front, buttoned up",
"brand_label_id": "7cc9f988-068b-44cd-8004-22f486b10e67"
},
)
data = res.json()["data"] # data["id"], data["status"]202 Accepted / 已完成
{
"data": {
"batch_id": "gmb_x7y8z9",
"status": "processing",
"total": 3,
"completed": 0,
"failed": 0,
"items": [
{
"id": "gm_p1q2r3",
"status": "processing"
},
{
"id": "gm_s4t5u6",
"status": "processing"
},
{
"id": "gm_v7w8x9",
"status": "processing"
}
],
"style": "3d",
"background_color": "white",
"resolution": "2K",
"aspect_ratio": "3:4",
"credits_reserved": 12,
"created_at": "2026-04-10T16:05:00Z"
},
"request_id": "req_gmb001"
}{
"data": {
"batch_id": "gmb_x7y8z9",
"status": "completed",
"total": 3,
"completed": 3,
"failed": 0,
"processing": 0,
"credits_reserved": 12,
"credits_used": 12,
"credits_refunded": 0,
"items": [
{
"id": "gm_p1q2r3",
"status": "completed",
"output_url": "https://cdn.photta.app/generated/gm_p1q2r3.jpg",
"thumbnail_url": "https://cdn.photta.app/generated/gm_p1q2r3-thumb.jpg",
"credits_used": 4,
"completed_at": "2026-04-10T16:06:42Z",
"duration_ms": 102000
},
{
"id": "gm_s4t5u6",
"status": "completed",
"output_url": "https://cdn.photta.app/generated/gm_s4t5u6.jpg",
"thumbnail_url": "https://cdn.photta.app/generated/gm_s4t5u6-thumb.jpg",
"credits_used": 4,
"completed_at": "2026-04-10T16:08:18Z",
"duration_ms": 96000
},
{
"id": "gm_v7w8x9",
"status": "completed",
"output_url": "https://cdn.photta.app/generated/gm_v7w8x9.jpg",
"thumbnail_url": "https://cdn.photta.app/generated/gm_v7w8x9-thumb.jpg",
"credits_used": 4,
"completed_at": "2026-04-10T16:09:50Z",
"duration_ms": 92000
}
],
"created_at": "2026-04-10T16:05:00Z",
"completed_at": "2026-04-10T16:09:50Z"
},
"request_id": "req_gmbs002"
}请求参数
product_images类型: array[object]必填
Array of image objects. Each object contains "image" (URL or base64), optional "back_image", and optional "image_side". API batch caps (5× the dashboard limit): Free/Hobby/Hobby v2 5, Seller/Starter 10, Brand/Pro 25, Studio/Premium 50.
angle类型: string
Applied to all images. "side" reconstructs the side view from each front photo (plus back_image when provided) — see the single-generate endpoint for details.
= straight
取值:straightbacksidestyle类型: string
Applied to all images.
= 3d
取值:3dflat_laybackground_color类型: string
Applied to all images.
= white
取值:whitegraybeigeblackresolution类型: string
Applied to all images. "2K" = 4 credits each. "4K" = 5 credits each. 4K is produced natively in a single generation per item — pick it upfront; the resolution cannot be changed after creation. Note: 4K cannot be combined with aspect_ratio 1:1 — that combination returns 400.
= 2K
取值:2K4Kaspect_ratio类型: string
Applied to all images. Note: 1:1 is not available at 4K resolution — 1:1 combined with 4K returns 400.
= 3:4
取值:3:41:14:39:1616:9user_instruction类型: string
Batch-level: one note applied to every item. Optional free-form string, max 400 characters (anything longer is silently truncated). A guarded steer for ambiguous rendering choices — e.g. "closed front", "cream interior lining", "buttoned up" — it never overrides the source garment, brand label, or structural reconstruction, and it is explicitly NOT a determinism/seed control.
brand_label_id类型: string
Applied to all images. Brand label UUID returned by the Brand Labels API. API v1 request fields use snake_case; use brand_label_id.
错误
- 400
invalid_request_error - The request is malformed or contains invalid parameters.
- 401
authentication_error - The API key is missing, invalid, or expired.
- 402
insufficient_credits_error - Your account does not have enough credits.
- 404
not_found_error - The requested resource does not exist.
- 409
conflict_error - The request conflicts with current state — e.g. your concurrent-batch cap is reached.
- 429
rate_limit_error - Too many requests. Slow down and retry.Retry-After: 30
- 500
api_error - An internal server error occurred. Retry later.
限制
- 每个 API 密钥每分钟 600 次请求 (固定窗口;各套餐限制相同)
- 429 响应包含 Retry-After: 30 秒
- 单张图片最大 10 MB
- 格式:: JPEG, PNG, WebP
- 各套餐并发批处理数:: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- 仅支持轮询 — API 不发送 Webhook。
单次请求,整架服装
组装数组,提交一次,轮询批次,下载每个项目。
步骤 1
生成 API key
批量隐形模特使用与其他 Photta 功能完全相同的凭证与 credit 余额。
步骤 2
组装图像数组
`product_images` 中每件服装对应一个对象:包含 `image`,以及可选的 `back_image` 和 `image_side`。API 批次上限为:Free 和 Hobby 方案 5 张,Seller 方案 10 张,Brand 方案 25 张,Studio 方案 50 张。
步骤 3
POST 提交批次
POST `/api/v1/ghost-mannequin/batch`。`angle`、`style`、`background_color`、`resolution` 和 `aspect_ratio` 应用于所有项目,`user_instruction` 可为全部项目添加一条最多 400 字符的说明。整批的 credits 会在首个项目渲染前完成预扣。
步骤 4
轮询批次
每 3 秒 GET `/api/v1/ghost-mannequin/batch/:id`。响应体包含 `total`、`completed`、`failed` 以及逐项明细,你可以在最后一件服装渲染完成前就开始下载。
步骤 5
下载各项结果
每个完成的项目都包含各自的 `output_url`、`credits_used` 和耗时。失败的项目会退还其预扣的 credits,并记录在 `credits_refunded` 中。
同一个 endpoint 在 Node.js、Python 和 cURL 中的实现
Node.js
在 Node.js 中使用 批量隐形模特 API
在 Node.js 后端中使用原生 fetch 调用 Photta 的 批量隐形模特 API。无需 SDK:存储你的 key、提交任务、轮询获取结果即可。
阅读Python
Python 中的 批量隐形模特 API
在 Python 中使用 requests 库调用 Photta 的 批量隐形模特 API。三十行包装函数,通过 httpx 具备异步亲和性,可在 Django、FastAPI 和 Celery 中开箱即用。
阅读cURL
通过 cURL 调用 批量隐形模特 API
直接在终端中使用 cURL 调用 Photta 的 批量隐形模特 API。提交、轮询、下载——每个代码片段均可搭配 jq 用于自动化流水线脚本。
阅读
开发者运行批次前的常见问题
批量 endpoint 带来了什么?
它允许在单次请求中传入服装照片数组并在后台处理。你将获得用于查看整体进度的批次 id 以及对应每张照片的项目 id,无需单独追踪数十个独立任务。
一个批次最多可容纳多少张图像?
API 批次上限为:Free 和 Hobby 方案 5 张,Seller 方案 10 张,Brand 方案 25 张,Studio 方案 50 张——是控制台限制的五倍。提交超出方案允许额度的批次将返回 400。
批次如何扣除 credits?
整批费用会在前期预扣:图像数量乘以单张单价,2K 为 4 credits,4K 为 5 credits。若余额不足以支付预扣金额,请求将返回 402 且不会渲染任何内容。
当其中一个项目失败时会发生什么?
批次中的其余项目会继续执行。批次响应体会同时返回 `failed` 与 `completed` 数量,失败项目预扣的 credits 会通过 `credits_refunded` 返还。
可以同时运行多少个批次?
进行中的并发批次受方案限制:Free 为 1,Hobby 为 2,Seller 为 3,Brand 为 4,Studio 为 6。超出上限提交将返回 409——请持续轮询进行中的批次直至其结束,然后再重新提交。
如何轮询批次?
每 3 秒 GET `/api/v1/ghost-mannequin/batch/:id` 获取聚合状态,或在需要获取单件服装的详细信息时,通过标准隐形模特状态路径轮询任意单个项目。
相关功能
功能特性
幽灵模特 API 适用于镂空模特商品图
AI 幽灵模特 endpoint。从服装照片中移除模特,完整保留内部细节。支持 3D 或平铺效果,支持批量处理,2K 分辨率 4 credits。
查看 endpoint功能特性
虚拟 try-on API 适用于服装
将服装穿在 AI 模特身上的 REST API。异步处理,1.5–4 分钟生成耗时,2K 分辨率 5 credits,4K 分辨率 6 credits。提供 cURL、Node.js 与 Python 示例代码。
查看 endpoint构建
为您的商品目录实现隐形模特自动提取
每晚目录自动化配方:拉取昨天的商品更新,批量提交至 Photta 的隐形模特 API,轮询父批次,持久化存储到您的数据库。
查看 endpoint对比
Photta vs Pixazo——第一方处理管线还是模型聚合平台
Photta 与 Pixazo 对比:自研时尚管线对比多模型聚合器。涵盖 endpoint、延迟、免费层与架构权衡。数据提取于 2026-04-19。
查看 endpoint快速开始
5 分钟内生成第一张 Photta 图像。
注册、生成 API 密钥、运行第一个 cURL 调用、轮询直至完成、持久化保存结果。共五个步骤,端到端完整记录。
查看 endpoint参考
Photta API 错误
Photta API 错误类型的完整列表及其状态码、错误响应体的结构,以及哪些失败情况值得重试。
查看 endpoint参考
Photta API 速率限制
Photta API 的速率限制、时间窗口、Retry-After 请求头、轮询间隔以及各套餐的并发上限,均取自官方 API 文档。
查看 endpoint
本页所有数据均来自 Photta API 文档 · 已验证
五分钟内上手试用 API
生成 Photta API key,粘贴上方的 cURL 代码片段,咖啡还没煮好,你的第一张模特实穿图就已经生成完毕。
- 1.5–4 min per image
- 2K 分辨率 4 credits · 4K 分辨率 5 credits
- 异步,轮询
- 600 次请求/分钟
- Bearer key