Character Swap – Generate
namifusion/character-swap/generate
namifusion/character-swap/generate. Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất.
Đầy đủ tham số, lược đồ đầu ra và giá hiện tại
| Chợ API mô hình AI | Một nền tảng cho mọi thứ | Phổ biến nhất | Điều khoản | Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất. |
|---|---|---|---|---|
| track_manifest_url *Track manifest URL | text | — | — | |
| mappings *Character mappings | array<object> | — | — | |
| ↳obj_id *Character obj_id | number | — | — | |
| ↳img_urls *Reference images | image_upload | — | 1–3 items | |
| resolutionResolution | select | 720p | 480p | 720p | |
| seedSeed | number | — | — |
Đầy đủ tham số, lược đồ đầu ra và giá hiện tại
| Tìm hiểu thêm | Một nền tảng cho mọi thứ | Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất. |
|---|---|---|
| videos | array |
API
Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất.
cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/namifusion/character-swap/generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"track_manifest_url": "ANALYZE_OUTPUT.track_manifest_url",
"mappings": [
{
"obj_id": 0,
"img_urls": [
"https://assets-public.namifusion.com/marketplace/images/2026-06-12/638e1ee18ac7.jpeg"
]
}
],
"resolution": "720p"
}
}'
# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
-H "Authorization: Bearer YOUR_API_KEY"Python
import time, requests
API_KEY = "YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1) Submit
resp = requests.post(
"https://www.namifusion.com/api/v1/marketplace/run/namifusion/character-swap/generate",
headers=HEADERS,
json={
"input": {
"track_manifest_url": "ANALYZE_OUTPUT.track_manifest_url",
"mappings": [
{
"obj_id": 0,
"img_urls": [
"https://assets-public.namifusion.com/marketplace/images/2026-06-12/638e1ee18ac7.jpeg"
]
}
],
"resolution": "720p"
}
},
)
resp.raise_for_status() # 401/402/429/5xx stop here instead of polling a bad task
task = resp.json()
# 2) Poll until a terminal state (completed / failed / cancelled).
# This model is allowed up to 7200s server-side.
deadline = time.time() + 7260
while task.get("status") not in ("completed", "failed", "cancelled"):
if time.time() > deadline:
raise TimeoutError(f"still {task.get('status')} — keep the task_uuid and poll later")
time.sleep(3)
poll = requests.get(f"https://www.namifusion.com/api/v1/marketplace/run/tasks/{task['task_uuid']}", headers=HEADERS)
poll.raise_for_status()
task = poll.json()
print(task["status"], task.get("output"))JavaScript
const API_KEY = "YOUR_API_KEY";
const HEADERS = { Authorization: `Bearer ${API_KEY}` };
// 1) Submit
const resp = await fetch("https://www.namifusion.com/api/v1/marketplace/run/namifusion/character-swap/generate", {
method: "POST",
headers: { ...HEADERS, "Content-Type": "application/json" },
body: JSON.stringify({
"input": {
"track_manifest_url": "ANALYZE_OUTPUT.track_manifest_url",
"mappings": [
{
"obj_id": 0,
"img_urls": [
"https://assets-public.namifusion.com/marketplace/images/2026-06-12/638e1ee18ac7.jpeg"
]
}
],
"resolution": "720p"
}
}),
});
if (!resp.ok) throw new Error(`submit failed: ${resp.status} ${await resp.text()}`);
let task = await resp.json();
// 2) Poll until a terminal state (completed / failed / cancelled).
// This model is allowed up to 7200s server-side.
const deadline = Date.now() + 7260 * 1000;
while (!["completed", "failed", "cancelled"].includes(task.status)) {
if (Date.now() > deadline) throw new Error(`still ${task.status} — keep the task_uuid and poll later`);
await new Promise((r) => setTimeout(r, 3000));
const poll = await fetch(`https://www.namifusion.com/api/v1/marketplace/run/tasks/${task.task_uuid}`, { headers: HEADERS });
if (!poll.ok) throw new Error(`poll failed: ${poll.status}`);
task = await poll.json();
}
console.log(task.status, task.output);Tài liệu API
Character Swap - Generate
Replace selected people in an analyzed video with reference characters while preserving the original audio.
Character Swap Generate is the second stage of the two-step workflow. It uses the track_manifest_url and obj_id values returned by Analyze, then assigns one to three reference images to each selected person through mappings. The video_url must identify the same video used for analysis, and the resolution must match across both stages.
Key Features
- Per-person replacement: Select each target explicitly with the
obj_idreturned by Analyze. - Multiple-character mappings: Add multiple entries to
mappingsto configure several people independently. - One to three reference images: Provide multiple appearance references per person to cover useful angles and details.
- Original audio preservation: Keeps the input video's audio track in the generated result.
- 480p and 720p output: Choose the output tier that fits the intended quality and existing pricing band.
Technical Specifications
| Item | Details |
|---|---|
| Workflow | Character Swap step 2 |
| Required inputs | video_url, track_manifest_url, mappings |
mappings format | Array of {obj_id, img_urls} objects |
| Reference images | 1-3 URLs per person |
| Resolution | 480p, 720p (default) |
| Maximum video length | 30 seconds |
| Optional input | seed |
| Output | Video URL with the original audio preserved |
Basic Workflow
- Process the source video with Character Swap Analyze.
- Select the target
obj_idvalues from the returnedobjectslist. - Pair each ID with its reference image URLs in
mappings. - Submit the same video and Analyze manifest, then poll until generation completes.
Pricing
The existing Marketplace rates are 40 credits per 5-second unit at 480p and 75 credits per 5-second unit at 720p. Videos are limited to 30 seconds. This documentation update does not change pricing.
Best Practices
For each person, use sharp reference images with a clear view of the character and, when possible, include slightly different angles. The obj_id, video, and manifest must all come from the same Analyze result. Do not change resolution between stages or reuse a manifest created for another video.
Mô hình liên quan
Head Swap – Generate
namifusion/head-swap/generate. Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất.
Head Swap – Analyze
namifusion/head-swap/analyze. Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất.
Character Swap – Analyze
namifusion/character-swap/analyze. Duyệt API mô hình ảnh, video và đổi khuôn mặt. Thử mô hình rồi tích hợp qua một API REST thống nhất.