FASHN Virtual Try-On V1.6
集成
模型 id
fashn/tryon/v1.6
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/fashn/tryon/v1.6?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_image": "example",
"garment_image": "example"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/fashn/tryon/v1.6?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"model_image": "example",
"garment_image": "example"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"model_image": "example",
"garment_image": "example",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/fashn/tryon/v1.6", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/zh/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.ru/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "fashn/tryon/v1.6",
"input": {
"model_image": "example",
"garment_image": "example"
}
}
通过 Doitong API 调用 FASHN Virtual Try-On V1.6 模型(fashn/tryon/v1.6)。智能体文档:https://doitong.com/zh/developers/models/fashn/tryon/v1.6.md
POST https://api.doitong.ru/v1/run/fashn/tryon/v1.6?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"model_image": "example",
"garment_image": "example"
}
如果响应状态为 "queued" 或 "running",请轮询 GET https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20,直到状态变为 "succeeded";文件位于 outputs[].url。使用相同请求体 POST https://api.doitong.ru/v1/quote/fashn/tryon/v1.6,可在运行前返回确切价格。
此请求: $0.075 75 API 积分 · ≈ ₽7.85 在此页面运行
你的新 API 密钥。 它仅在此时显示,并且已填入下方的代码和 API 密钥字段中。请妥善保密:切勿将其放入在浏览器中运行的代码。
构建请求
控件根据模型架构生成。更改控件时,代码和价格会同步更新。
POST
/run/fashn/tryon/v1.6?wait=20
报价 → $0.075
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/fashn/tryon/v1.6?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_image": "example",
"garment_image": "example"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/fashn/tryon/v1.6?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"model_image": "example",
"garment_image": "example"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"model_image": "example",
"garment_image": "example",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/fashn/tryon/v1.6", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "fashn/tryon/v1.6",
"input": {
"model_image": "example",
"garment_image": "example"
},
"wait_seconds": 20
}
}
}
关于 FASHN Virtual Try-On V1.6
将`garment_image`中的服装穿到`model_image`中的人物身上,两者均支持URL或base64。`category`接受tops、bottoms、one-pieces或auto,`garment_photo_type`接受model、flat-lay或auto。`mode`为performance、balanced或quality,`num_samples`生成1到4个png或jpeg结果。
参数
名称类型
默认值允许值
描述
model_image必填
类型string
以 URL 或 base64 数据提供的模型图像。
garment_image必填
类型string
以 URL 或 base64 数据提供的服装图像。
category可选
类型enum
默认值auto
topsbottomsone-piecesauto
试穿服装类别,使用 'auto' 请求自动尝试识别类别。
mode可选
类型enum
默认值balanced
performancebalancedquality
速度与质量权衡的运行模式:'balanced' 寻求折中,'quality' 以较慢处理速度提供更好结果,'performance' 运行更快但可能降低质量。
garment_photo_type可选
类型enum
默认值auto
automodelflat-lay
用于调整内部参数的服装照片类别。平铺拍摄和幽灵模特图像使用 'flat-lay';展示模特穿着服装的照片使用 'model'。使用 'auto' 时,系统会尝试自行识别类别。
moderation_level可选
类型enum
默认值permissive
nonepermissiveconservative
服装图像审核策略。使用 'none' 禁用过滤器需要账户授权;没有授权时,该选择会按 'permissive' 处理。在 'permissive' 下仅拦截露骨内容;'conservative' 还会排除内衣和泳装。
seed可选
类型integer | null
用于可复现生成的种子:固定随机性,使相同输入能够生成相同结果;更改种子则会强制生成不同结果。
num_samples可选
类型integer
默认值1
1 – 4
单次运行的图像数量,允许同时进行多次尝试,以提高在生成随机性存在时获得良好结果的概率。
segmentation_free可选
类型boolean
默认值true
禁用对模型图像的人体解析。
output_format可选
类型enum
默认值png
pngjpeg
图像格式选择:'png' 可提供最佳质量,'jpeg' 可加快生成速度。
enable_safety_checker可选
类型boolean
默认值true
调用方获得授权后,可将其设置为 false 以放宽审核。
必填
输出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "fashn/tryon/v1.6",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 75,
"usd": "0.075",
"charged": 75,
"refunded": 0
},
"input": {
"model_image": "example",
"garment_image": "example"
},
"output": {
"images": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
}
]
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
- images
- array of object {url, content_type, file_name, file_size}
其他 FASHN Virtual Try-On 变体
更多模型:图像编辑
对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/fashn/tryon/v1.6.md. 所有模型和指南: https://doitong.com/developers/llms.txt






