ComfyUI Node

Face Swapper

This Face Swapper Doesn't Swap Faces Locally — It Pays Someone Else To

By 5x00·Created 2 years ago·Updated 2 years ago· 2
Face Swapper
  • Image
  • Face
  • Output
API_Key

The name is half a lie, and the lie is the point

The "Face Swapper" node in 5x00/ComfyUI-PiAPI-Faceswap doesn't run any face-swap model on your machine. It ships your two images to PiAPI's hosted face-swap service, waits for them to finish, and hands the result back as a normal IMAGE tensor. No GPU required, no model weights to download, and the one thing you must bring is a paid API key from piapi.ai.

Why would you pay for something ReActor and Roop do for free? One word: licensing. The KB has this called out as the InsightFace licensing trap: every local swap stack - ReActor, Roop, InstantID, PuLID - is built on InsightFace model weights that are non-commercial by default. Fine for your own projects, a minefield if you want to sell the outputs or run a service. A paid API sidesteps the whole question: you're renting the swap, not redistributing a restricted model. That's exactly what the author's README is selling - "helpful if you're trying to create a workflow that includes faceswap for commercial usage." It's also genuinely handy on a weak machine or a cloud ComfyUI where installing InsightFace (one of the most painful installs in local generation) is more trouble than it's worth.

How it works

Under the hood it's a small REST client. Both input tensors get converted to PIL images, thumbnailed down to a max of 512×512, JPEG'd, and base64'd, then POSTed to api.piapi.ai/api/v1/task with the model Qubico/image-toolkit and task type face-swap. The node then polls the task every 2 seconds for a status change. When the result URL comes back, it downloads the image and converts it to a tensor you can wire anywhere.

The 512px cap matters: whatever you feed in, the API gets a thumbnail, so don't expect source resolution to survive. Feed it a clean, well-lit, front-facing face as the swap source for the best likeness - that's the image whose identity gets pasted onto the target.

The inputs and the output

Three inputs, that's it - no optional panel hiding a "quality" slider:

  • Image (IMAGE) - the base image getting the swap, the one whose body and pose stay.
  • Face (IMAGE) - the image carrying the face you want.
  • API_Key (STRING) - your PiAPI key, pasted straight in. There's no env-var or settings-UI option, so it lives in the workflow.

The single output, Output (IMAGE), plugs into a Save Image or anything else downstream that takes an IMAGE. Note that means the key travels with the workflow file if you export it - don't share that JSON casually.

Installing it

ComfyUI Manager is the easy path: search "ComfyUI-PiAPI-Faceswap" and hit Install. Manual is equally fine:

cd ComfyUI/custom_nodes
git clone https://github.com/5x00/ComfyUI-PiAPI-Faceswap

Then restart ComfyUI and refresh the browser. There's no requirements.txt in the repo and no model downloads - it only uses requests, Pillow, numpy, and torch, which ComfyUI already ships. This is one of the easiest packs in the ecosystem to install, because it does nothing locally.

Where people get burned

The big one is straight from the source code: if the API hasn't answered within 16 seconds of polling, the node doesn't error - it returns a hardcoded placeholder image (an old Flickr photo, of all things). So a wrong key, a rate limit, or a slow queue day silently hands you an unrelated picture as your "swapped" output. If you get nonsense that isn't the face you asked for, suspect the timeout before you suspect the node. That 16-second window is short for a hosted job under load, and PiAPI has a reputation on Reddit for occasional slow or flaky responses (wait times and HTTP 500s get mentioned), so this is a real failure mode.

Everything else is the usual third-party API reality: it costs money per call, your images leave your machine for someone else's server (worth a thought for people's faces), and the service can go down without warning. Check your key, keep the face crop tight, and treat the first run as a cost test - run one image and read your PiAPI dashboard before building a whole batch workflow around it.

For commercial face work specifically, this node is a genuinely clean answer to the InsightFace problem - just audit PiAPI's own terms before you ship, the same way you'd audit any license.

Category5x00

Inputs (3)

NameTypeDefaultDescription
ImageIMAGE
FaceIMAGE
API_KeySTRING

Outputs (1)

NameTypeDescription
OutputIMAGE