HyperSwap: Video Faceswap by FaceFusion Labs Serverless API

Hyperswap enables realistic face swapping in videos using a single identity image, preserving natural expressions and lighting.

~56.57s
~$0.085
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/video-faceswap-by-facefusion-labs"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "source_image": "https://segmind-resources.s3.amazonaws.com/input/8d67068b-dc76-4069-b231-acdbb644ab54-ai-video-swap-ip2.png",
12    "target_video": "https://segmind-resources.s3.amazonaws.com/input/1f234efe-9867-475f-8ef2-81eef026fb50-7eb8f231-ace8-4dbe-bb6a-43ae13d1a89e.mp4",
13    "model_name": "hyperswap_1a",
14    "face_detector_score": 0.5,
15    "target_face_index": 0
16}
17
18response = requests.post(url, headers=headers, json=data)
19
20if response.status_code == 200:
21    result = response.json()
22    print(json.dumps(result, indent=2))
23else:
24    print(f"Error: {response.status_code}")
25    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/video-faceswap-by-facefusion-labs

Parameters

source_imagerequired
string (uri)

Upload the image to be swapped onto the face in the video. Use high-quality images for best results.

target_videorequired
string (uri)

Provide the URL of the video for face swapping. HD videos yield superior face swap results.

face_detector_scoreoptional
number

Set minimum confidence for face detection accuracy. Recommended 0.4 for diverse angles and conditions.

Default: 0.5Range: 0 - 1
model_nameoptional
string

Select the desired model variant for the swap. 'hyperswap_1a' is optimal for general use cases.

Default: "hyperswap_1a"
Allowed values :
"hyperswap_1a""hyperswap_1b""hyperswap_1c"
target_face_indexoptional
integer

Select which face in the target video to swap. Use 0 for the first detected face, 1 for the second, and so on.

Default: 0Range: 0 - 10

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out