PromptFlow AI
API docs

nano-2/edit

Nano 2 — Edit details, change outfits/backgrounds, and seamlessly combine multiple subjects with Nano 2 — preserve facial features & natural lighting, 1K – 4K (1K, 2K, 4K) quality, converted directly from original image, multiple aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4...), no prompt character limit.

SV1 (sv1) · healthyid: nano-2/image-outfitcanonical_model: nano-2/edittype: chinh-sua-anh-aioutput: image195đ – 390đ
Các gói & Server (SV) hiện có của model nano-2/editGET /api/v1/models/nano-2/edit/servers

Bảng giá API chi tiết theo từng cấu hình tham số

Đơn giá thực tế (VNĐ) trừ vào ví khi gọi POST /v1/generations (hoặc kiểm tra trước qua POST /v1/generations/estimate).

195đ – 390đ
1K:195đ2K:390đ4K:390đ

Input — request parameters

POST/v1/generations

Gửi JSON theo cấu trúc chuẩn "model": "nano-2/edit", "server": "sv1" and the parameters below at the same level. Parameters not listed in the table are rejected (400).

ParameterTypeSupported valuesDescription
modelrequiredstringnano-2/image-outfitor nano-2/editMã gói sản phẩm trực tiếp hoặc mã dòng model chuẩn (kết hợp cùng tham số chọn SV bên dưới).
serverstringsv1autoChốt máy chủ SV chạy đơn (cũng nhận alias server_id) hoặc auto để tự chọn SV healthy giá tốt nhất. Kiểm tra SV sống qua GET /v1/models/nano-2/edit/servers.
image_urlrequiredstring (URL image)
Model photo (to dress)
garment_urlrequiredstring (URL image)
Outfit / clothing image
outfit_partrequiredenum
fulltopbottomoutershoesaccessory

Default: full

Item to replace
backgroundrequiredenum
Giữ nguyên bối cảnh gốcĐổi sang phông nền studio trắng tinh tếĐổi bối cảnh sang đường phố thời trang ngoài trờiĐổi bối cảnh sang quán cà phê sang trọng ánh sáng ấm

Default: Giữ nguyên bối cảnh gốc

Setting
promptstring
Additional notes (optional)
aspect_ratiorequiredenum
1:116:99:164:33:4adaptive
Aspect ratio
resolutionenum
1K2K4K

Default: 1K

Resolution

Valid combinations: 1K; 2K; 4K

  • File parameters (string URL) accept a public http(s) link — the server downloads it — or a URL returned by the file upload API POST /account/ai/uploads.
  • Bỏ trống tham số không bắt buộc thì dùng giá trị mặc định. Có thể gửi thêm header Idempotency-Key để thử lại an toàn không trừ tiền 2 lần.

Sample request (cURL)

curl -X POST https://promptflow.web.id/api/v1/generations \
  -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \
  -d '{
  "model": "nano-2/edit",
  "server": "sv1",
  "image_url": "https://example.com/image.jpg",
  "garment_url": "https://example.com/image.jpg",
  "outfit_part": "full",
  "background": "Giữ nguyên bối cảnh gốc",
  "prompt": "An astronaut cat",
  "aspect_ratio": "1:1",
  "resolution": "1K"
}'

Complete integration code sample (Upload file → Create job → Poll result)

Python 3

import os, time, requests

BASE = "https://promptflow.web.id/api"
API_KEY = os.environ["API_KEY"]
HEADERS = {"X-API-Key": API_KEY}

with open("./input.jpg", "rb") as f:
    up_res = requests.post(f"{BASE}/account/ai/uploads", headers=HEADERS, files={"file": f}, timeout=120)
up = up_res.json()
if not up_res.ok:
    raise RuntimeError(up.get("message") or up_res.text)

payload = {
    "model": "nano-2/edit",
    "server": "sv1",
    "garment_url": "https://example.com/image.jpg",
    "outfit_part": "full",
    "background": "Giữ nguyên bối cảnh gốc",
    "prompt": "An astronaut cat",
    "aspect_ratio": "1:1",
    "resolution": "1K"
}
payload["image_url"] = up["url"]

r = requests.post(f"{BASE}/v1/generations", headers=HEADERS, json=payload, timeout=60)
gen = r.json()
if not r.ok:
    raise RuntimeError(gen.get("message") or r.text)

while gen.get("status") in ("queued", "processing"):
    time.sleep(5)
    gen = requests.get(f"{BASE}/v1/generations/{gen['id']}", headers=HEADERS, timeout=60).json()

if gen.get("status") != "succeeded":
    raise RuntimeError(gen.get("error") or gen.get("status"))
print("Kết quả:", [f["url"] for f in gen["output"]["files"]])

Node.js (18+)

import fs from "node:fs";
import path from "node:path";

const BASE = "https://promptflow.web.id/api";
const API_KEY = process.env.API_KEY; // lấy tại trang /api-keys

// Bước 1: Upload file đầu vào từ máy lên server (hoặc dùng thẳng link https công khai)
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("./input.jpg")]), path.basename("./input.jpg"));
const upRes = await fetch(`${BASE}/account/ai/uploads`, {
  method: "POST",
  headers: { "X-API-Key": API_KEY },
  body: form,
});
const up = await upRes.json();
if (!upRes.ok) throw new Error(up.message || upRes.statusText);

// Bước 2: Gửi tạo tác vụ kèm URL file vừa tải lên
const createRes = await fetch(`${BASE}/v1/generations`, {
  method: "POST",
  headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    ...{
  "model": "nano-2/edit",
  "server": "sv1",
  "garment_url": "https://example.com/image.jpg",
  "outfit_part": "full",
  "background": "Giữ nguyên bối cảnh gốc",
  "prompt": "An astronaut cat",
  "aspect_ratio": "1:1",
  "resolution": "1K"
},
    image_url: up.url,
  }),
});
let gen = await createRes.json();
if (!createRes.ok) throw new Error(gen.message || createRes.statusText);

// Bước 3: Chờ kết quả
while (["queued", "processing"].includes(gen.status)) {
  await new Promise((r) => setTimeout(r, 5000));
  gen = await fetch(`${BASE}/v1/generations/${gen.id}`, { headers: { "X-API-Key": API_KEY } }).then((r) => r.json());
}
if (gen.status !== "succeeded") throw new Error(gen.error ?? gen.status);
console.log("Kết quả:", gen.output.files.map((f) => f.url));

Output — response

Jobs run asynchronously. POST /v1/generations immediately returns a generation object with status queued or processing; poll GET /v1/generations/{id} every 5–10 seconds until status is succeeded, failed or cancelled.

GET/v1/generations/{id}
{
  "id": "3f1c...-uuid",
  "object": "generation",
  "code": "T8KQ2M4X",
  "model": "nano-2/image-outfit",
  "canonical_model": "nano-2/edit",
  "server_id": "sv1",
  "server_name": "SV1",
  "status": "succeeded",       // queued | processing | succeeded | failed | cancelled
  "progress": 100,
  "cost": 2400,                // amount charged
  "currency": "VND",
  "refunded": false,
  "output": {
    "type": "image",
    "files": [{ "url": "https://promptflow.web.id/uploads/ai/outputs/....png", "type": "image", "name": "image.png" }],
    "text": null
  },
  "error": null,
  "created_at": "2026-10-30T08:00:00.000Z",
  "completed_at": "2026-10-30T08:01:12.000Z"
}
FieldMeaning
model / server_idĐúng mã gói sản phẩm và máy chủ SV đã thực thi tác vụ.
output.files[].urlResult file links — download them to your own system; files on our server may be cleaned up after some time.
output.textText content (only for models that return text).
costAmount in VND charged to your balance; refunded automatically on failure or cancellation (refunded = true).
errorError reason when status = failed.

Get a quote before running

POST/v1/generations/estimate

Cùng body với POST /v1/generations, không chạy và không trừ tiền (tự áp % chiết khấu riêng nếu tài khoản có).

# => {
#   "object": "estimate",
#   "model": "nano-2/image-outfit",
#   "canonical_model": "nano-2/edit",
#   "server_id": "sv1",
#   "server_name": "SV1",
#   "cost": 2400,
#   "currency": "VND"
# }
Get an API key
nano-2/image-outfit · API docs | PromptFlow AI