Segmind Faceswap v5 Serverless API
Segmind Faceswap v5: Ultra-Fast, Smart Face & Head Swap Model
~9.82s
$0.05 per generation
1import requests
2import json
3
4url = "https://api.segmind.com/v1/faceswap-v5"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "target_image": "https://segmind-resources.s3.amazonaws.com/input/d823dde1-aaae-4231-87b7-1d472bc71cef-faceswap-v5-input.png",
12 "source_image": "https://segmind-inference-inputs.s3.amazonaws.com/48892b17-762c-4de5-b6d8-f99d8e139115-black-man-image.jpeg",
13 "seed": 8005332,
14 "image_format": "png",
15 "quality": 95
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/faceswap-v5"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "target_image": "https://segmind-resources.s3.amazonaws.com/input/d823dde1-aaae-4231-87b7-1d472bc71cef-faceswap-v5-input.png",
12 "source_image": "https://segmind-inference-inputs.s3.amazonaws.com/48892b17-762c-4de5-b6d8-f99d8e139115-black-man-image.jpeg",
13 "seed": 8005332,
14 "image_format": "png",
15 "quality": 95
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
POST
https://api.segmind.com/v1/faceswap-v5Parameters
source_imagerequiredstring (uri)Source image URL
target_imagerequiredstring (uri)Target image URL
additional_promptoptionalstringAdditional prompt for customization
Default:
""image_formatoptionalstringOutput image format
Default:
"png"Allowed values :
"png""jpeg""webp"qualityoptionalintegerOutput image quality
Default:
95Range: 10 - 100seedoptionalintegerRandom seed for reproducibility
Default:
8005332Response Type
Returns: Image
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