Face Swap avatar

Face Swap

Pricing

from $0.00005 / actor start

Go to Apify Store
Face Swap

Face Swap

Swap faces between images using advanced AI deep learning for natural, high-resolution results. Ideal for dev teams, automated workflows, creators, influencers, and marketers.

Pricing

from $0.00005 / actor start

Rating

5.0

(2)

Developer

Akash Kumar Naik

Akash Kumar Naik

Maintained by Community

Actor stats

2

Bookmarked

107

Total users

2

Monthly active users

17 days ago

Last modified

Features

Limited permissions

Share

AI Face Swap is an Apify Actor that swaps faces between two images automatically using deep learning models from InsightFace. Provide a source image with the face you want to use and a target image where it should be applied, and receive a natural-looking, high-quality result. Works with direct URLs plus Google Drive, Dropbox, OneDrive, iCloud, Box, and MediaFire links.

What Is AI Face Swap?

AI Face Swap is a cloud-based face swap API that automatically replaces faces in images with advanced deep learning technology. The Actor uses the InsightFace Buffalo-L model for face analysis and the Inswapper 128 model for face swapping, ensuring high-quality results with natural-looking transformations. It is optimized for the Apify platform with efficient memory management, fast processing times, and reliable cloud execution.

Key Features

  • Deep Learning Face Swap — advanced AI models for natural, realistic face swapping
  • Cloud Storage Support — works with Google Drive, Dropbox, OneDrive, iCloud, and Box links
  • High Quality Output — PNG lossless or JPEG optimized output formats
  • Memory Optimized — efficient resource management for stable performance
  • Fast Processing — pre-downloaded models for quick execution
  • Graceful Shutdown — automatic state preservation for interrupted runs

Supported Image Sources and Formats

  • Direct image URLs (HTTP/HTTPS)
  • Google Drive sharing links
  • Dropbox sharing links
  • OneDrive sharing links
  • iCloud sharing links
  • Box sharing links
  • MediaFire sharing links

Input images support JPG, JPEG, PNG, and WebP. Output can be PNG (lossless) or JPEG (optimized).

Use Cases

  • Portrait Photography — swap faces for creative photography projects
  • Image Editing — professional face replacement for compositing
  • Content Creation — generate unique images for marketing and social media
  • Film & Video Production — face replacement for visual effects workflows
  • Gaming & Virtual Avatars — create custom character faces

Input Parameters

FieldTypeRequiredDescription
sourceUrlstringYesURL of image containing the face to use for swapping
targetUrlstringYesURL of image where the face will be applied
outputFormatstringNoOutput format: PNG (lossless, default) or JPEG (smaller)

Example input:

{
"sourceUrl": "https://example.com/source-face.jpg",
"targetUrl": "https://example.com/target-image.jpg",
"outputFormat": "PNG"
}

Sample Output

{
"success": true,
"sourceUrl": "https://example.com/source.jpg",
"targetUrl": "https://example.com/target.jpg",
"processingTime": 12.5,
"fileSize": 1048576,
"outputFormat": "PNG",
"resultUrl": "https://api.apify.com/v2/key-value-stores/...",
"timestamp": 1700000000
}

How to Use the AI Face Swap

  1. Open the Actor page on Apify Store and click Start Actor.
  2. Paste the URL of the image with the face you want to use into sourceUrl.
  3. Paste the URL of the image where the face should be applied into targetUrl.
  4. Choose PNG or JPEG output and run the Actor; download the swapped image from resultUrl.

Connect via API

cURL:

curl -X POST "https://api.apify.com/v2/acts/akash9078/ai-face-swap/runs" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sourceUrl":"https://example.com/source-face.jpg","targetUrl":"https://example.com/target-image.jpg","outputFormat":"PNG"}'

Python:

import requests
response = requests.post(
"https://api.apify.com/v2/acts/akash9078/ai-face-swap/runs",
headers={"Authorization": "Bearer YOUR_API_TOKEN"},
json={"sourceUrl": "https://example.com/source-face.jpg", "targetUrl": "https://example.com/target-image.jpg", "outputFormat": "PNG"},
)
print(response.json())

Node.js with the Apify Client:

const { ApifyClient } = require('apify-client');
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('akash9078/ai-face-swap').call({
sourceUrl: 'https://example.com/source-face.jpg',
targetUrl: 'https://example.com/target-image.jpg',
outputFormat: 'PNG',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

How It Works

  1. Download Images — both source and target images are fetched from provided URLs
  2. Face Detection — AI analyzes both images to locate and extract faces
  3. Face Swapping — the source face is mapped onto the target face using deep learning
  4. Result Delivery — output image is stored and URL is returned in dataset

Error Responses

The Actor handles various error conditions:

  • Invalid URL formats
  • Image download failures
  • Private IP address detection (blocked for security)
  • No faces detected in images
  • Processing failures

Failed operations return error dataset items with descriptive messages.

AI Face Swap Pricing

EventDescriptionPrice
Face Swap ResultSuccessful face swap with delivered output$0.025
Face Swap ErrorFailed operation after processing began$0.005

Users set a maximum spending limit per run in Apify Console. The pricing configuration also defines an Actor Start event at $0.00005 that covers platform resource allocation and model loading.

Why Use This Instead of Manual Photo Editing?

CapabilityAI Face SwapManual editing
Time per swap10-30 secondsMinutes to hours
RealismAI blending and lighting matchSkill-dependent
Cloud storage linksAuto-convertedManual download
Output optionsPNG / JPEG presetsManual export
API / batch automationBuilt inNot available

Limitations

  • Processing time typically ranges from 10-30 seconds depending on image size
  • Memory usage is optimized for runs up to 4GB RAM
  • Images over 15MB or larger than 2048px dimension are rejected
  • Private IP addresses are blocked for security
  • If no face is detected, the Actor returns an error item (no charge is applied for this case)
  • Complex lighting or unusual angles may affect quality

Technical Details

SpecificationValue
RuntimePython 3.11
Memory1GB - 4GB
ModelsInsightFace Buffalo-L, Inswapper 128 ONNX
CPUOptimized for 2 threads
Timeout120 seconds default

FAQ

What image formats are supported?

Input supports JPG, JPEG, PNG, and WebP. Output can be PNG (lossless) or JPEG (optimized).

Can I use faces from cloud storage?

Yes, the Actor automatically converts Google Drive, Dropbox, OneDrive, iCloud, Box, and MediaFire sharing links to direct download URLs.

What happens if no face is detected?

The Actor returns an error item with a "No faces detected" message. No charge is applied for this case.

Is there a size limit for images?

Images over 15MB or larger than 2048px dimension are rejected with appropriate error messages.

How accurate is the face swap?

The AI produces natural-looking results with proper lighting and blending. Complex lighting or unusual angles may affect quality.

If you need more image transformation tools from Apify, check out my other Apify Actors:


Built and maintained by akash9078 on the Apify platform.

⌂ 换网址