Segmind FaceSwap Comic v1 Serverless API
FaceSwap Comic v1 is an AI-powered face swapping model designed to blend real faces into illustrated or cartoon-style images while preserving the target’s artistic look. Ideal for personalized children’s storybooks and stylized content, it offers fine control over facial expression, realism, and stylistic adaptation.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/faceswap-comic"
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/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
12 "target_image": "https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
13 "face_strength": 0.8,
14 "style_strength": 0.8,
15 "seed": 63255,
16 "steps": 10,
17 "cfg": 1.5,
18 "output_format": "jpeg",
19 "output_quality": 95,
20 "base64": false
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/faceswap-comic"
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/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
12 "target_image": "https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
13 "face_strength": 0.8,
14 "style_strength": 0.8,
15 "seed": 63255,
16 "steps": 10,
17 "cfg": 1.5,
18 "output_format": "jpeg",
19 "output_quality": 95,
20 "base64": false
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text)API Endpoint
https://api.segmind.com/v1/faceswap-comicParameters
source_imagerequiredstring (uri)The source image for face swapping
target_imagerequiredstring (uri)The target image for face swapping
base64optionalbooleanOutput as base64
falsecfgoptionalnumberClassifier-free guidance scale
1.6Range: 0.1 - 10face_strengthoptionalnumberStrength of face preservation
0.8Range: 0 - 1grow_maskoptionalintegerExpands the mask region outward by the specified number of pixels.
0Range: 0 - 100mask_imageoptionalstring (uri)Optional mask image to control the face swap region
output_formatoptionalstringOutput image format
"jpeg""jpeg""png""webp"output_qualityoptionalintegerOutput image quality
95Range: 1 - 100promptoptionalstringOptional prompt used to guide facial expressions or moods (such as happy, crying, sleeping, or closed eyes)
""seedoptionalintegerSeed number for reproducible results
63255stepsoptionalintegerNumber of inference steps. Increase to improve details and overall output quality.
10Range: 1 - 50style_strengthoptionalnumberStrength of style adaptation
0.8Range: 0 - 2Response Type
Returns: Image
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