Head Swap – Generate
namifusion/head-swap/generate
namifusion/head-swap/generate. Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API.
Похожие модели
Все параметры, схема вывода и актуальные цены
| Маркетплейс API моделей ИИ | Одна платформа для всего | Самый популярный | Условия | Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API. |
|---|---|---|---|---|
| track_manifest_url *Track manifest URL | text | — | — | |
| mappings *Head mappings | array<object> | — | — | |
| ↳obj_id *Head obj_id | number | — | — | |
| ↳img_urls *Reference images | image_upload | — | 1–3 items | |
| resolutionResolution | select | 720p | 480p | 720p | |
| seedSeed | number | — | — |
Все параметры, схема вывода и актуальные цены
| Подробнее | Одна платформа для всего | Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API. |
|---|---|---|
| videos | array |
API
Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API.
cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/namifusion/head-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/head-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/head-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);Документация API
Head Swap - Generate
Replace selected heads in an analyzed video with reference images while preserving the original audio.
Head Swap Generate is the second stage of the Head Swap workflow. Each item in mappings associates an Analyze obj_id with one to three reference image URLs, making the replacement target explicit. The video_url and track_manifest_url must come from the same Analyze task, and the generation resolution must match the analysis resolution.
Key Features
- Explicit per-head selection: Uses the
obj_idfrom Analyze to avoid replacing the wrong target. - Multiple-target mappings: Assign separate reference images to several heads in one video.
- Multiple reference images: Supply one to three images per target to cover appearance and viewing-angle details.
- Original audio preservation: Keeps the input video's audio track in the completed output.
- 480p and 720p output: Select the quality tier that matches the intended result and existing pricing band.
Technical Specifications
| Item | Details |
|---|---|
| Workflow | Head 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 target |
| Resolution | 480p, 720p (default) |
| Maximum video length | 30 seconds |
| Optional input | seed |
| Output | Video URL with the original audio preserved |
Basic Workflow
- Process the input video with Head Swap Analyze.
- Select the target
obj_idvalues from the previews inobjects. - Pair each ID with its head reference image URLs in
mappings. - Submit the same video and returned 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
Use sharp references that show the full head, ideally with camera angles and lighting close to the target video. When supplying multiple images, keep the person's appearance consistent across them. The video, manifest, and obj_id values must come from the same Analyze result; never mix values from separate tasks.
Похожие модели
Head Swap – Analyze
namifusion/head-swap/analyze. Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API.
Character Swap – Generate
namifusion/character-swap/generate. Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API.
Character Swap – Analyze
namifusion/character-swap/analyze. Выбирайте API моделей для изображений, видео и замены лиц. Испытайте модель и подключите ее через единый REST API.