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.
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) 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
https://api.segmind.com/v1/video-faceswap-by-facefusion-labsParameters
source_imagerequiredstring (uri)Upload the image to be swapped onto the face in the video. Use high-quality images for best results.
target_videorequiredstring (uri)Provide the URL of the video for face swapping. HD videos yield superior face swap results.
face_detector_scoreoptionalnumberSet minimum confidence for face detection accuracy. Recommended 0.4 for diverse angles and conditions.
0.5Range: 0 - 1model_nameoptionalstringSelect the desired model variant for the swap. 'hyperswap_1a' is optimal for general use cases.
"hyperswap_1a""hyperswap_1a""hyperswap_1b""hyperswap_1c"target_face_indexoptionalintegerSelect which face in the target video to swap. Use 0 for the first detected face, 1 for the second, and so on.
0Range: 0 - 10Response Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out