MODELLIX editorial cover reading Face Swap API over the subtitle Integration Guide, Pricing and Code, with a glass API gateway, two face thumbnails feeding an exchange node, and a poll loop

Every face swap API on the market sells you the same operation: you hand over a face and a target image or video, and the service composites one onto the other. The differences that actually decide your integration are the route you pick — dedicated hosted API, model marketplace, self-hosted stack, or aggregator — and what one swap really costs. Page one of Google won’t answer either in a comparable form: it is a wall of single-vendor pages with incompatible pricing, plus a Reddit thread asking which API is best.

This guide covers the request shape every provider shares, compares the four routes with prices pulled on September 9, 2026, walks one complete face swap API integration end to end (REST and Python), and closes with the error modes, the consent line, and a three-question decision framework. Everything priced here carries its source and access date — re-verify before you commit budget, because per-image rates and tiers move.

Every face swap API shares one request shape

Learn the shape once and any vendor’s docs become readable in minutes. A face swap call has two image inputs: the source (the face to use — some providers call it swap_image, others source_image) and the target (the image or video where the face lands). Behind the scenes the pipeline is detection → swap → blend, often with an enhancement pass such as CodeFormer-style restoration — which is why similar inputs can produce visibly different quality across providers.

Delivery is where contracts diverge, and it is the first thing to check in any docs page:

  • Synchronous: one request returns the finished image URL. AI Engine’s API, listed on RapidAPI, works this way — “single synchronous request, result in seconds.”
  • Asynchronous (the norm): you submit a task, get a task_id, then either poll a status endpoint until it completes or register a webhook. PiAPI, Akool, Replicate, and most aggregators use this shape. Video swaps are always async in practice because a job processes many frames.
  • Output retention: results are usually deleted after a window — PiAPI stores outputs on its CDN for three days; Modellix task results live about seven days. Download promptly or regenerate.

Multi-face handling is the other axis: Akool’s docs cap swaps at 8 faces per job (code 1007), AI Engine targets one of up to 5 faces by index, and some APIs map each detected face to a different identity. If your product swaps a single face into photos, any of these work; group-photo or per-face mapping needs explicit multi-face support — check it before you integrate.

Face swap API lifecycle: a source face and target image enter a task queue; the client polls the task endpoint until done, then retrieves the result URL

Figure: the submit–poll–retrieve lifecycle behind nearly every face swap API. Concept diagram generated for this article, not a screenshot of any vendor’s console.

Face swap API options: the four routes and what they cost

Prices below are what each provider’s page or docs showed on September 9, 2026, and they are not directly comparable by design — that is the point of listing them side by side. PiAPI and AI Engine quote per-image or per-tier numbers; Magic Hour and Akool sell credits; self-hosting costs GPU time; Replicate prices per model run. “Which is cheapest” is only answerable for your volume and quality bar, so treat the table as a starting map, then verify on the live pages.

Route Example Entry price (as of 2026-09-09) Best for Watch out
Dedicated hosted face swap APIs PiAPI — $0.02 per image swap; AI Engine — free 100 req/mo, Pro $12.99/mo for 10,000 req (RapidAPI); Magic Hour — $19–$99/mo credit subscriptions PiAPI $0.02/image; AI Engine ≈$0.0013/request at full Pro-tier usage (derived from tier math) Simple, predictable per-unit cost; fastest time to first request Per-unit price says nothing about quality; video and multi-face are separate tiers or products
Suites with image + video + multi-face Akool Face Swap Plus credit-based; per-unit not published on the docs page Video swaps, multi-face mapping, image and video behind one auth Per-unit cost opaque; v3 endpoints need a face-detect pre-call for landmarks
Model-marketplace runtimes Replicate’s face-swap collection per-run, per-model pricing on Replicate Running ready-made community face-swap models (image and multi-face workflows) without owning GPUs Cost per run varies by model; you assemble the pipeline yourself
Self-hosted open source ashleykleynhans/faceswap-api — 14 models (inswapper, simswap, ghost, and more), insightface-based GPU time: ~5.3 GB of weights; the project’s own benchmark is ~11.6 s per swap on a 4090 Runpod pod Full control, data privacy, no per-call fees at very high volume You run and secure the infra; quality depends on the model you pick
Aggregator image-edit route Modellix face swap collection Kling V3 Omni Image $0.0224–$0.0448/image (same-day) Face swap as one feature in a multi-vendor media pipeline Not a dedicated face-swap model — see the route section below

One honest note on the derived numbers: AI Engine’s ≈$0.0013/request only holds if you fully consume the Pro tier every month. Magic Hour’s and Akool’s credit systems tie per-swap cost to tier and output length — the exact reason a straight “price per swap” comparison is the gap this table only partially fills. When volume matters, put your own images through each shortlist candidate and divide the test bill by completed swaps.

Integration example: one face swap request, end to end

The worked example uses PiAPI because its contract is public, its price is a flat $0.02 per image swap, and its submit–poll shape is the one most providers and aggregators share. You need a PiAPI account and API key (sign-up includes trial credits) plus two image URLs: the face you want to use and the target photo.

The current REST contract, per PiAPI’s docs, is a generic task endpoint rather than a face-swap-specific route:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
API_KEY="your_piapi_key"

# 1. Submit the swap and capture the task id
curl -X POST "https://api.piapi.ai/api/v1/task" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qubico/image-toolkit",
"task_type": "face-swap",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg"
}
}'
# → { "code": 200, "data": { "task_id": "9d5a…", "status": "pending" } }

# 2. Poll the task endpoint until it completes
curl -X GET "https://api.piapi.ai/api/v1/task/9d5a…" \
-H "X-API-Key: $API_KEY"

The same flow in Python with requests:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import time
import requests

API_KEY = "your_piapi_key"
BASE = "https://api.piapi.ai"
headers = {"X-API-Key": API_KEY, "Content-Type": "application/json"}

# 1. Submit
resp = requests.post(
f"{BASE}/api/v1/task",
headers=headers,
json={
"model": "Qubico/image-toolkit",
"task_type": "face-swap",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg",
},
},
).json()
task_id = resp["data"]["task_id"]

# 2. Poll (task statuses PiAPI documents: "pending" on submit, "completed" when done)
while True:
data = requests.get(f"{BASE}/api/v1/task/{task_id}", headers=headers).json()["data"]
if data["status"] == "completed":
break
time.sleep(3)

print(data) # completed tasks return the result under data["output"]

The response object follows the same envelope as the submit call: code, data (with task_id, status, and an output object), and message. PiAPI’s docs example shows the output object empty, so log the response once during development and read the actual field names rather than hard-coding a path — task types differ across PiAPI’s catalog. On completion you get result image URLs that expire from PiAPI’s CDN after three days.

Parameter Where it lives Notes
model body Qubico/image-toolkit for face swap on PiAPI’s current task API
task_type body face-swap selects the operation
target_image input URL of the photo receiving the face
swap_image input URL of the source face
X-API-Key header PiAPI workspace key; credits are consumed per completed swap

Cost accounting is the part most guides skip: at $0.02 per image swap, 1,000 swaps are $20 and 10,000 are $200 — no subscription tier to overshoot. PiAPI’s credits expire 180 days after purchase and refunds are not offered, which matters if you prepay for a project that stalls. For video output, check the vendor’s video endpoint instead: PiAPI documents a separate video faceswap task, and Akool’s Face Swap Plus handles image and video on one API.

When the aggregator route makes sense

Full disclosure up front: Modellix publishes this blog and has a commercial interest in you using its API. The facts below are a same-day snapshot of Modellix’s own pages, verified September 9, 2026 — not a claim that the aggregator route beats any provider.

The honest starting point is that Modellix does not list a dedicated face-swap model in the inswapper sense. Its face swap collection — headlined “Best Face Swap AI Models in 2026,” four models — routes the task through multi-reference image-edit models: the closest fit is kling/kling-v3-omni-image, which accepts several reference images with <<<image_N>>> placeholders and is built for fusing a reference identity into a new image. Same-day list prices on that collection: Kling V3 Omni Image $0.0224–$0.0448 per image, Wan 2.7 Image Pro Edit $0.0675, Seedream 5.0 Lite Edit $0.0350, GPT Image 2 Edit $0.0360–$0.2250. An edit-model route is not identical to a purpose-built swapper, so test with the actual faces and angles your product will see before committing.

The aggregator route earns its place when face swap is one feature among several in a media pipeline — avatar generation, lip sync, virtual try-on, image upscaling — and you want all of them behind one API key and one bill instead of a vendor account per model. Modellix runs the same submit–poll lifecycle shown above, with per-call cost logging, so “what did this feature actually cost us” stays answerable per request. If you are deciding whether a single-key architecture fits your stack at all, our unified AI API explainer covers the trade-offs in depth.

Modellix REST API documentation

See the async task routes, model IDs, and per-call pricing for face-swap-capable image models behind one Modellix key.

View Docs

The failures that cost time on a first face swap integration are predictable. Auth errors mean a bad key or expired session; quota errors mean an empty credit balance; parameter errors are usually a wrong field name or an input URL the service cannot fetch. Face-count limits bite on group photos — Akool rejects jobs over 8 faces (code 1007), and AI Engine targets one of up to 5 faces by index. A failed status usually means an obscured or heavily angled face in the target; the fix is well-lit, front-facing, high-resolution inputs.

Retention windows deserve a place in your error handling: PiAPI deletes outputs after three days, Modellix task results last about seven days, and self-hosted stacks keep everything until you delete it. If your pipeline stores results, download from the provider’s CDN into your own storage inside that window and treat provider URLs as temporary.

Then there is the line that is not an error code. Swap only faces you have the right to use — your own likeness, or someone who consented to the specific use — and do not build features whose purpose is deception, harassment, or fraud. This is not legal advice, and obligations vary by jurisdiction as deepfake and likeness laws evolve; the practical version for a developer is: put a consent step in your product flow, keep an audit trail of which faces were used for what, and read your app store and platform policies before shipping. It is also a business decision — the vendors that make the news for non-consensual swaps are the ones whose APIs get restricted.

Which face swap API should a new integration pick?

Three questions decide the route. What media types does the feature need? Image-only lets you pick any dedicated API or the aggregator route; video and GIF support narrows you to suite providers (Akool, Magic Hour) or a video-specific endpoint. What is your volume and cost model? At a few thousand swaps a month, per-unit pricing like PiAPI’s $0.02/image is trivially predictable; at hundreds of thousands, negotiate volume pricing or price a self-hosted stack — the faceswap-api project’s own benchmark of ~11.6 seconds per swap on a 4090-class pod is the number to start from, plus ~5.3 GB of model weights and the ops time. How much control and privacy do you need? Faces are biometric-adjacent data; if your contracts require data residency or zero third-party retention, self-hosting is the only route that guarantees it.

For most first integrations: prototype on a dedicated hosted API with trial credits, measure real quality on your own images, and move to volume pricing or self-hosting only when the numbers justify the ops. If face swap is one feature in a larger AI media product, weigh the aggregator route before multiplying API accounts — one key and one bill is a feature of its own. And if the actual goal is generating avatars or identities from a face rather than swapping into a target, our AI avatar API guide covers that adjacent problem.

Start building with face-swap-capable models

Log in to Modellix to call image-edit models and 210+ other image and video models through one API key.

Login

Frequently Asked Questions

Is there a free face swap API?

Most hosted providers give trial credits on signup rather than a permanent free tier — PiAPI includes credits with a new workspace, and Magic Hour offers free credits on signup with watermarked output on free usage. Trial credits are enough to validate quality; production-scale free tiers are rare, so budget from day one.

How much does a face swap API cost per image?

As of September 9, 2026: PiAPI lists $0.02 per image swap with pay-as-you-use credits; AI Engine’s RapidAPI tiers work out to roughly $0.0013 per request at the $12.99/mo Pro tier only if fully consumed; Magic Hour and Akool sell credit subscriptions whose per-swap cost depends on tier and output; self-hosting costs GPU time. All figures are same-day snapshots — check the live pages.

Can I call a face swap API from Python?

Yes — the integration example above is a complete Python flow (submit with requests, poll the task endpoint, read the output). Some vendors also ship SDKs: Magic Hour publishes Python, Node.js, Go, and Rust clients.

Can I run face swap models myself instead of paying per call?

Yes. The open-source faceswap-api project linked in the route table packages 14 models — inswapper, simswap, ghost, hififace, and others — behind a FastAPI service with a serial GPU queue, CodeFormer restoration, and ~5.3 GB of downloads. You supply the GPU: its own benchmark is roughly 11.6 seconds per swap on a 4090-class pod. Marketplace runtimes such as Replicate’s face-swap collection sit in between — community models without you owning the GPU.

Does a face swap API support video and GIF?

Some do. Magic Hour handles photos, videos, and GIFs in one API; Akool’s Face Swap Plus covers image and video with multi-face mapping; PiAPI documents a separate video faceswap task. Video jobs process frame by frame, so they run longer and cost more than stills — check the video tier before promising your users real-time turnaround.

How long do face swap results stay available?

Typically days, not forever: PiAPI deletes outputs from its CDN after three days, and Modellix task results are retained about seven days. Download results into your own storage inside the retention window and treat provider URLs as temporary links.

Is it legal to offer face swapping in my product?

That depends on consent, likeness rights, and jurisdiction — this is not legal advice. The working rule for developers: only use faces you have permission to use for the specific purpose, add a consent step to your product flow, and check platform policies, since deepfake and likeness regulation is evolving in several regions.


Provider details and pricing reflect public information as of September 9, 2026 and change frequently — per-image rates, credit systems, retention windows, and model IDs all move. Validate against each provider’s live pricing and docs before committing. Modellix, which publishes this article and has a commercial interest in its own route, verified its model prices on the same date; the third-party integration material above is vendor-neutral. Access image and video models, including the leading Chinese models, through a single API key at modellix.ai.