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.

~21.12s
$0.065 per generation
 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

POSThttps://api.segmind.com/v1/faceswap-comic

Parameters

source_imagerequired
string (uri)

The source image for face swapping

target_imagerequired
string (uri)

The target image for face swapping

base64optional
boolean

Output as base64

Default: false
cfgoptional
number

Classifier-free guidance scale

Default: 1.6Range: 0.1 - 10
face_strengthoptional
number

Strength of face preservation

Default: 0.8Range: 0 - 1
grow_maskoptional
integer

Expands the mask region outward by the specified number of pixels.

Default: 0Range: 0 - 100
mask_imageoptional
string (uri)

Optional mask image to control the face swap region

output_formatoptional
string

Output image format

Default: "jpeg"
Allowed values :
"jpeg""png""webp"
output_qualityoptional
integer

Output image quality

Default: 95Range: 1 - 100
promptoptional
string

Optional prompt used to guide facial expressions or moods (such as happy, crying, sleeping, or closed eyes)

Default: ""
seedoptional
integer

Seed number for reproducible results

Default: 63255
stepsoptional
integer

Number of inference steps. Increase to improve details and overall output quality.

Default: 10Range: 1 - 50
style_strengthoptional
number

Strength of style adaptation

Default: 0.8Range: 0 - 2

Response 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