eachlabs-face-swap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

EachLabs 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
EACHLABS_API_KEY
environment variable. Get your key at eachlabs.ai.
Header: X-API-Key: <your-api-key>
设置
EACHLABS_API_KEY
环境变量。可在eachlabs.ai获取你的密钥。

Available Models

可用模型

ModelSlugBest For
AI Face Swap V1
aifaceswap-face-swap
Image face swap
Eachlabs Face Swap
each-faceswap-v1
Image face swap
Face Swap (legacy)
face-swap-new
Image face swap
Faceswap Video
faceswap-video
Video face swap
模型标识(Slug)适用场景
AI Face Swap V1
aifaceswap-face-swap
图片人脸互换
Eachlabs Face Swap
each-faceswap-v1
图片人脸互换
Face Swap (legacy)
face-swap-new
图片人脸互换
Faceswap Video
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

预测流程

  1. Check model
    GET https://api.eachlabs.ai/v1/model?slug=<slug>
    — validates the model exists and returns the
    request_schema
    with exact input parameters. Always do this before creating a prediction to ensure correct inputs.
  2. POST
    https://api.eachlabs.ai/v1/prediction
    with model slug, version
    "0.0.1"
    , and input matching the schema
  3. Poll
    GET https://api.eachlabs.ai/v1/prediction/{id}
    until status is
    "success"
    or
    "failed"
  4. Extract the output image URL from the response
  1. 检查模型
    GET https://api.eachlabs.ai/v1/model?slug=<slug>
    — 验证模型是否存在,并返回包含准确输入参数的
    request_schema
    。创建预测前务必执行此步骤,以确保输入参数正确。
  2. 发送POST请求
    https://api.eachlabs.ai/v1/prediction
    ,携带模型标识(slug)、版本
    "0.0.1"
    ,以及符合schema的输入参数
  3. 轮询查询
    GET https://api.eachlabs.ai/v1/prediction/{id}
    ,直到状态变为
    "success"
    "failed"
  4. 提取结果 从响应中获取输出图片的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
  • 使用清晰、光线充足的高质量源图片
  • 源人脸图片应为清晰的正面或近正面肖像
  • 源图和目标图的光线条件匹配,效果更自然
  • 在提示词中指定“无缝融合”和“自然肤色”
  • 目标图片中的人脸应清晰可见,且无严重遮挡