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.
POST /v2/faceswap-comic · 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-comic",
9 source_image="https://segmind-resources.s3.amazonaws.com/input/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
10 target_image="https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
11 face_strength=0.8,
12 style_strength=0.8,
13 seed=63255,
14 steps=10,
15 cfg=1.5,
16 output_format="jpeg",
17 output_quality=95,
18 base64=False,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "source_image": "https://segmind-resources.s3.amazonaws.com/input/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
30 "target_image": "https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
31 "face_strength": 0.8,
32 "style_strength": 0.8,
33 "seed": 63255,
34 "steps": 10,
35 "cfg": 1.5,
36 "output_format": "jpeg",
37 "output_quality": 95,
38 "base64": False,
39}
40job = client.submit_async("faceswap-comic", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 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-comic",
9 source_image="https://segmind-resources.s3.amazonaws.com/input/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
10 target_image="https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
11 face_strength=0.8,
12 style_strength=0.8,
13 seed=63255,
14 steps=10,
15 cfg=1.5,
16 output_format="jpeg",
17 output_quality=95,
18 base64=False,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "source_image": "https://segmind-resources.s3.amazonaws.com/input/217bc1e2-dfec-4c4c-9f65-221666072a59-2cb41fda-f443-42ec-9048-2a8f4a355d30_1.png",
30 "target_image": "https://segmind-resources.s3.amazonaws.com/input/44e264ec-4ae7-4d90-bb3a-fb6215fcd359-29570e4d-b67e-4612-bbb6-ae4802b672a1_1.png",
31 "face_strength": 0.8,
32 "style_strength": 0.8,
33 "seed": 63255,
34 "steps": 10,
35 "cfg": 1.5,
36 "output_format": "jpeg",
37 "output_quality": 95,
38 "base64": False,
39}
40job = client.submit_async("faceswap-comic", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 print("failed:", e.detail)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
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-comicSubmit — 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