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.77s
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)

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

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. 1
    POST /v2/faceswap-comic

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

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