Faceswap V3 Multifaceswap Serverless API
Faceswap V3 Multifaceswap enables realistic face swapping in images, preserving lighting and expressions for professional results.
POST /v2/faceswap-v3-multifaceswap · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "faceswap-v3-multifaceswap",
9 source_img="https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg",
10 target_img="https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg",
11 input_faces_index="0,1,2",
12 source_faces_index="0,1,2",
13 face_restore="disable",
14 interpolation="Bilinear",
15 detection_face_order="left-right",
16 facedetection="retinaface_resnet50",
17 detect_gender_input="no",
18 detect_gender_source="no",
19 face_restore_weight=0.75,
20 image_format="jpeg",
21 image_quality=95,
22 base64=False,
23)
24print(result["status"]) # COMPLETED
25print(result.get("output")) # model output (e.g. media URL)
26print(result["metrics"]["inference_time"]) # server compute seconds
27
28# --- Or submit + poll manually (track request_id, control the cadence) ---
29from segmind import SegmindClient, InferenceFailed, InferenceTimeout
30
31client = SegmindClient() # reads SEGMIND_API_KEY
32payload = {
33 "source_img": "https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg",
34 "target_img": "https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg",
35 "input_faces_index": "0,1,2",
36 "source_faces_index": "0,1,2",
37 "face_restore": "disable",
38 "interpolation": "Bilinear",
39 "detection_face_order": "left-right",
40 "facedetection": "retinaface_resnet50",
41 "detect_gender_input": "no",
42 "detect_gender_source": "no",
43 "face_restore_weight": 0.75,
44 "image_format": "jpeg",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("faceswap-v3-multifaceswap", **payload)
49print(job.request_id) # available immediately
50try:
51 result = job.wait(timeout=600, interval=1.0)
52except InferenceTimeout as e:
53 print("still running:", e.request_id)
54except InferenceFailed as e:
55 print("failed:", e.detail) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "faceswap-v3-multifaceswap",
9 source_img="https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg",
10 target_img="https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg",
11 input_faces_index="0,1,2",
12 source_faces_index="0,1,2",
13 face_restore="disable",
14 interpolation="Bilinear",
15 detection_face_order="left-right",
16 facedetection="retinaface_resnet50",
17 detect_gender_input="no",
18 detect_gender_source="no",
19 face_restore_weight=0.75,
20 image_format="jpeg",
21 image_quality=95,
22 base64=False,
23)
24print(result["status"]) # COMPLETED
25print(result.get("output")) # model output (e.g. media URL)
26print(result["metrics"]["inference_time"]) # server compute seconds
27
28# --- Or submit + poll manually (track request_id, control the cadence) ---
29from segmind import SegmindClient, InferenceFailed, InferenceTimeout
30
31client = SegmindClient() # reads SEGMIND_API_KEY
32payload = {
33 "source_img": "https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg",
34 "target_img": "https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg",
35 "input_faces_index": "0,1,2",
36 "source_faces_index": "0,1,2",
37 "face_restore": "disable",
38 "interpolation": "Bilinear",
39 "detection_face_order": "left-right",
40 "facedetection": "retinaface_resnet50",
41 "detect_gender_input": "no",
42 "detect_gender_source": "no",
43 "face_restore_weight": 0.75,
44 "image_format": "jpeg",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("faceswap-v3-multifaceswap", **payload)
49print(job.request_id) # available immediately
50try:
51 result = job.wait(timeout=600, interval=1.0)
52except InferenceTimeout as e:
53 print("still running:", e.request_id)
54except InferenceFailed as e:
55 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/faceswap-v3-multifaceswapParameters
source_imgrequiredstring (uri)URL for your face image. Use high-resolution close-up shots for best results.
"https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg"target_imgrequiredstring (uri)URL of face to swap with. Choose a well-lit image for clarity.
"https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg"base64optionalbooleanToggle base64 encoding of output. 'False' for direct download, enable for embedding.
falsedetect_gender_inputoptionalstringDetect gender of target face. 'No' by default, specify 'female' or 'male'.
"no""no""female""male"detect_gender_sourceoptionalstringDetect gender of input face. Use 'no' or specify 'female'/'male'.
"no""no""female""male"detection_face_orderoptionalstringFace detection order. Use 'large-small' for prominence, 'top-bottom' for order.
"large-small""large-small""small-large""top-bottom""bottom-top""left-right""right-left"face_restoreoptionalstringSelect face restore model. use 'disable' while swapping multiple faces at once
"disable""disable""codeformer-v0.1.0.pth""GFPGANv1.4.pth""GFPGANv1.3.pth"face_restore_weightoptionalnumberAdjust face restore weight. '0.75' for balance, higher for smoothness.
0.75Range: 0 - 1facedetectionoptionalstringSelect face detection model. 'Retinaface_resnet50' for accuracy, 'YOLOv5n' for speed.
"retinaface_resnet50""retinaface_resnet50""retinaface_mobile0.25""YOLOv5l""YOLOv5n"image_formatoptionalstringChoose output image format. 'JPEG' for most use, 'PNG' for transparency.
"jpeg""jpeg""png""webp"image_qualityoptionalintegerSet output image quality. '95' for high detail, reduce to save space.
95Range: 10 - 100input_faces_indexoptionalstringSelect index of detected input face. Use '0' for default, '0,1,2' for multiple.
"0"interpolationoptionalstringChoose interpolation method. 'Bilinear' for most scenarios, 'Lanczos' for detailed.
"Bilinear""Nearest""Bilinear""Bicubic""Lanczos"source_faces_indexoptionalstringSelect index of source face. '0' for first, '0,1' for multiple selections.
"0"Response Type
Returns: Image
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/faceswap-v3-multifaceswapSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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