Branch #05 docs/api/05-piapi.md

07. PiAPI Router (Faceswap / Kling-VTO)

Branch #05 — Mở rộng video/image workflow chuyên biệt.

Endpoints

POST
https://bizgpt.vn/wp-json/piapi/router/v1/faceswap

Faceswap workflow

Auth: Bearer

POST
https://bizgpt.vn/wp-json/piapi/router/v1/kling-vto

Virtual try-on

Auth: Bearer

GET
https://bizgpt.vn/wp-json/piapi/router/v1/task/{id}

Task result

Auth: Bearer

GET
https://bizgpt.vn/wp-json/piapi/router/v1/health

Health check

Auth: Public

Method Path Auth Mô tả
POST https://bizgpt.vn/wp-json/piapi/router/v1/faceswap Bearer Faceswap workflow
POST https://bizgpt.vn/wp-json/piapi/router/v1/kling-vto Bearer Virtual try-on
GET https://bizgpt.vn/wp-json/piapi/router/v1/task/{id} Bearer Task result
GET https://bizgpt.vn/wp-json/piapi/router/v1/health Public Health check

Query Examples

POST Faceswap workflow
curl -X POST "https://bizgpt.vn/wp-json/piapi/router/v1/faceswap" -H "Authorization: Bearer biz-YOUR_KEY" -H "Content-Type: application/json" -d '{"sample":true}'
const res = await fetch('https://bizgpt.vn/wp-json/piapi/router/v1/faceswap', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer biz-YOUR_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"sample":true}),
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/piapi/router/v1/faceswap"
headers = {'Authorization': 'Bearer biz-YOUR_KEY', 'Content-Type': 'application/json'}
payload = '{"sample":true}'
res = requests.request("POST", url, headers=headers, data=payload)
print(res.json())
POST Virtual try-on
curl -X POST "https://bizgpt.vn/wp-json/piapi/router/v1/kling-vto" -H "Authorization: Bearer biz-YOUR_KEY" -H "Content-Type: application/json" -d '{"sample":true}'
const res = await fetch('https://bizgpt.vn/wp-json/piapi/router/v1/kling-vto', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer biz-YOUR_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"sample":true}),
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/piapi/router/v1/kling-vto"
headers = {'Authorization': 'Bearer biz-YOUR_KEY', 'Content-Type': 'application/json'}
payload = '{"sample":true}'
res = requests.request("POST", url, headers=headers, data=payload)
print(res.json())
GET Task result
curl -X GET "https://bizgpt.vn/wp-json/piapi/router/v1/task/{id}" -H "Authorization: Bearer biz-YOUR_KEY"
const res = await fetch('https://bizgpt.vn/wp-json/piapi/router/v1/task/{id}', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer biz-YOUR_KEY',
  },
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/piapi/router/v1/task/{id}"
headers = {'Authorization': 'Bearer biz-YOUR_KEY'}
res = requests.get(url, headers=headers)
print(res.json())
GET Health check
curl -X GET "https://bizgpt.vn/wp-json/piapi/router/v1/health"
const res = await fetch('https://bizgpt.vn/wp-json/piapi/router/v1/health', {
  method: 'GET',
});
const data = await res.json();
console.log(data);
import requests
url = "https://bizgpt.vn/wp-json/piapi/router/v1/health"
headers = {}
res = requests.get(url, headers=headers)
print(res.json())

Use Cases

  • Tạo thử đồ ảo cho thương mại điện tử.
  • Xây dựng trải nghiệm profile/avatar cá nhân hóa.
  • Ghép vào funnel sáng tạo nội dung hình ảnh/video tự động.

Implementation Steps

  1. Validate input media URL trước khi submit.
  2. Giới hạn kích thước và định dạng để tránh lỗi provider.
  3. Kết hợp với Image Templates để chuẩn hóa output.

Quick Start cURL

bash
curl -X POST https://bizgpt.vn/wp-json/piapi/router/v1/faceswap -H "Authorization: Bearer biz-YOUR_KEY" -H "Content-Type: application/json" -d "{\"swap_image\":\"https://example.com/a.jpg\",\"target_image\":\"https://example.com/b.jpg\"}"
Canonical Spec

docs/api/05-piapi.md