Face Swap
Pricing
from $0.00005 / actor start
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
Maintained by CommunityActor stats
2
Bookmarked
107
Total users
2
Monthly active users
17 days ago
Last modified
Categories
Features
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
| Field | Type | Required | Description |
|---|---|---|---|
sourceUrl | string | Yes | URL of image containing the face to use for swapping |
targetUrl | string | Yes | URL of image where the face will be applied |
outputFormat | string | No | Output 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
- Open the Actor page on Apify Store and click Start Actor.
- Paste the URL of the image with the face you want to use into
sourceUrl. - Paste the URL of the image where the face should be applied into
targetUrl. - Choose
PNGorJPEGoutput and run the Actor; download the swapped image fromresultUrl.
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 requestsresponse = 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
- Download Images — both source and target images are fetched from provided URLs
- Face Detection — AI analyzes both images to locate and extract faces
- Face Swapping — the source face is mapped onto the target face using deep learning
- 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
| Event | Description | Price |
|---|---|---|
| Face Swap Result | Successful face swap with delivered output | $0.025 |
| Face Swap Error | Failed 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?
| Capability | AI Face Swap | Manual editing |
|---|---|---|
| Time per swap | 10-30 seconds | Minutes to hours |
| Realism | AI blending and lighting match | Skill-dependent |
| Cloud storage links | Auto-converted | Manual download |
| Output options | PNG / JPEG presets | Manual export |
| API / batch automation | Built in | Not 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
| Specification | Value |
|---|---|
| Runtime | Python 3.11 |
| Memory | 1GB - 4GB |
| Models | InsightFace Buffalo-L, Inswapper 128 ONNX |
| CPU | Optimized for 2 threads |
| Timeout | 120 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.
Related Actors
If you need more image transformation tools from Apify, check out my other Apify Actors:
- AI Background Remover - HD & Transparent
- AI Image Upscaler & Face Enhancer
- Analyze Image
- AI Image Generator - Text to Image
- Frame Image Converter
Built and maintained by akash9078 on the Apify platform.