eachlabs-face-swap
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEachLabs Face Swap
EachLabs 人脸互换
Swap faces between images and videos using the EachLabs Predictions API.
使用EachLabs Predictions API实现图片和视频间的人脸互换。
Authentication
身份验证
Header: X-API-Key: <your-api-key>Set the environment variable. Get your key at eachlabs.ai.
EACHLABS_API_KEYHeader: X-API-Key: <your-api-key>设置环境变量。可在eachlabs.ai获取你的密钥。
EACHLABS_API_KEYAvailable Models
可用模型
| Model | Slug | Best For |
|---|---|---|
| AI Face Swap V1 | | Image face swap |
| Eachlabs Face Swap | | Image face swap |
| Face Swap (legacy) | | Image face swap |
| Faceswap Video | | Video face swap |
| 模型 | 标识(Slug) | 适用场景 |
|---|---|---|
| AI Face Swap V1 | | 图片人脸互换 |
| Eachlabs Face Swap | | 图片人脸互换 |
| Face Swap (legacy) | | 图片人脸互换 |
| Faceswap Video | | 视频人脸互换 |
Examples
示例
Image Face Swap with AI Face Swap V1
使用AI Face Swap V1进行图片人脸互换
bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "aifaceswap-face-swap",
"version": "0.0.1",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg"
}
}'bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "aifaceswap-face-swap",
"version": "0.0.1",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg"
}
}'Image Face Swap with Eachlabs
使用Eachlabs进行图片人脸互换
bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "each-faceswap-v1",
"version": "0.0.1",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg"
}
}'bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "each-faceswap-v1",
"version": "0.0.1",
"input": {
"target_image": "https://example.com/target-photo.jpg",
"swap_image": "https://example.com/source-face.jpg"
}
}'Video Face Swap
视频人脸互换
bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "faceswap-video",
"version": "0.0.1",
"input": {
"target_video": "https://example.com/target-video.mp4",
"swap_image": "https://example.com/source-face.jpg"
}
}'bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "faceswap-video",
"version": "0.0.1",
"input": {
"target_video": "https://example.com/target-video.mp4",
"swap_image": "https://example.com/source-face.jpg"
}
}'Alternative: Using GPT Image v1.5 Edit
替代方案:使用GPT Image v1.5 Edit
For prompt-based face replacement:
bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "gpt-image-v1-5-edit",
"version": "0.0.1",
"input": {
"prompt": "Replace the face in image 1 with the face from image 2. Keep the same pose, lighting, and expression. Maintain natural skin tone and seamless blending.",
"image_urls": [
"https://example.com/target-photo.jpg",
"https://example.com/source-face.jpg"
],
"quality": "high"
}
}'基于提示词的人脸替换方法:
bash
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "gpt-image-v1-5-edit",
"version": "0.0.1",
"input": {
"prompt": "Replace the face in image 1 with the face from image 2. Keep the same pose, lighting, and expression. Maintain natural skin tone and seamless blending.",
"image_urls": [
"https://example.com/target-photo.jpg",
"https://example.com/source-face.jpg"
],
"quality": "high"
}
}'Prediction Flow
预测流程
- Check model — validates the model exists and returns the
GET https://api.eachlabs.ai/v1/model?slug=<slug>with exact input parameters. Always do this before creating a prediction to ensure correct inputs.request_schema - POST with model slug, version
https://api.eachlabs.ai/v1/prediction, and input matching the schema"0.0.1" - Poll until status is
GET https://api.eachlabs.ai/v1/prediction/{id}or"success""failed" - Extract the output image URL from the response
- 检查模型 — 验证模型是否存在,并返回包含准确输入参数的
GET https://api.eachlabs.ai/v1/model?slug=<slug>。创建预测前务必执行此步骤,以确保输入参数正确。request_schema - 发送POST请求 ,携带模型标识(slug)、版本
https://api.eachlabs.ai/v1/prediction,以及符合schema的输入参数"0.0.1" - 轮询查询 ,直到状态变为
GET https://api.eachlabs.ai/v1/prediction/{id}或"success""failed" - 提取结果 从响应中获取输出图片的URL
Tips for Best Results
获得最佳效果的小贴士
- Use high-quality source images with clear, well-lit faces
- The source face image should be a clear frontal or near-frontal portrait
- Matching lighting conditions between source and target produces more natural results
- Specify "seamless blending" and "natural skin tone" in prompts
- For the target image, faces should be clearly visible and not heavily occluded
- 使用清晰、光线充足的高质量源图片
- 源人脸图片应为清晰的正面或近正面肖像
- 源图和目标图的光线条件匹配,效果更自然
- 在提示词中指定“无缝融合”和“自然肤色”
- 目标图片中的人脸应清晰可见,且无严重遮挡