Head Swap (Image)

namifusion/head-swap/image-edit

Swap the head in a photo with the head from a reference image. Upload the target photo first, then the head reference.

Parameters

NameTypeDefaultConstraintsDescription
images *Imagesimage_upload_group2–2 itemsExactly 2 images: [0] target photo, [1] head reference

Output fields

FieldTypeDescription
imagesarray<string>

API

Call this model through one unified REST API. Get a key on the API Keys page.

cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/namifusion/head-swap/image-edit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "images": [
      "https://example.com/input.jpg"
    ]
  }
}'

# 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/image-edit",
    headers=HEADERS,
    json={
        "input": {
            "images": [
                "https://example.com/input.jpg"
            ]
        }
    },
)
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 600s server-side.
deadline = time.time() + 660
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/image-edit", {
  method: "POST",
  headers: { ...HEADERS, "Content-Type": "application/json" },
  body: JSON.stringify({
    "input": {
      "images": [
        "https://example.com/input.jpg"
      ]
    }
  }),
});
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 600s server-side.
const deadline = Date.now() + 660 * 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);

Documentation

Head Swap (Image)

Swaps the head in a photo with the head from a reference image.

Input

FieldTypeRequiredNotes
imagesarray of exactly 2 image URLsyes[0] target photo, [1] head reference

The order matters: upload the target photo first, then the head reference image second.

Output

  • images[0]: the edited image URL (1024x1024)

Pricing: 15 credits per image.

Related models

Nami Qwen I2I Spicy
Image to Image

Nami Qwen I2I Spicy

Edit a reference image with natural-language instructions while preserving the parts you do not ask to change.

from $0.040 / per run
Nano Banana Image Edit
Image to ImageGoogle

Nano Banana Image Edit

Fast & Affordable Editing. Intuitive object replacement and style transfer without manual masking.

from $0.040 / per run
Nano Banana Pro Image Edit
Image to ImageGoogle

Nano Banana Pro Image Edit

4K Semantic Editing.Modifies existing images via natural language with context awareness and multilingual text editing.

from $0.140 / per run
Nano Banana 2 Image Edit
Image to ImageGoogle

Nano Banana 2 Image Edit

4K Semantic Editing.Modifies existing images via natural language with context awareness and multilingual text editing.

from $0.070 / per run
Seedream V5.0 Pro Edit API
Image to ImageDoubao

Seedream V5.0 Pro Edit API

Seedream V5.0 Pro Edit by ByteDance edits and generates images from single-image or multi-reference inputs, supporting up to 10 reference images, aspect ratio selection, and 1K / 2K output tiers. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

from $0.050 / per run
Seedream 5.0 Lite Edit Sequential
Image to ImageDoubao

Seedream 5.0 Lite Edit Sequential

Seedream 5.0 Lite Edit Sequential performs multi-image editing while locking character and object identity across shots. It detects main subjects, preserves continuity, and applies controlled edits with up to 4K output. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

from $0.040 / per run
Seedream 5.0 Edit
Image to ImageDoubao

Seedream 5.0 Edit

Seedream 5.0 Lite Edit by is a state-of-the-art image editing model preserving facial features, lighting, and color tones from reference images. Features high-fidelity editing with professional quality, superior prompt adherence, and up to 4K resolution. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

from $0.040 / per run
Seedream 4.5 Edit Sequential
Image to ImageDoubao

Seedream 4.5 Edit Sequential

Seedream 4.5 Edit Sequential performs multi-image editing while locking character and object identity across shots. It detects main subjects, preserves continuity, and applies controlled edits with up to 4K output. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.

from $0.040 / per run