alibaba/face-swap
Face Swap replaces the face in a target image with the face from a source image, producing a realistic face-swapped result.
PNG, JPEG, WebP, or GIF · 20 MiB maximum
PNG, JPEG, WebP, or GIF · 20 MiB maximum
Example output — click Run to generate your own
Send your first request
OpenAI-compatible endpoint with unified authentication and usage tracking.
https://api.sandbase.ai/v1/runalibaba/face-swapInput Schema
3 parameters · 2 required · 1 optional
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Required | The target image whose face will be replaced (URL or Base64-encoded string). Maximum file size is 50 MB. |
face_image | string | Required | The image containing the face to use as the source (URL or Base64-encoded string). Maximum file size is 50 MB. |
seed | integer | Optional | Random seed. Omit for an auto-generated seed. |
Output Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the generation task |
status | string | Task status: pending, running, completed, failed, timeout |
model | string | Model used for the generation |
outputs | array | Array of output items |
outputs[].url | string | URL of the generated artifact |
outputs[].content_type | string | MIME type (e.g. image/png, video/mp4) |
error | object | null | Error details if failed, null on success |
error.type | string | Machine-readable error type code |
error.message | string | Human-readable error description |
Async Workflow
This model uses asynchronous execution. Submit a request and poll for the result.
- Submit — POST to /v1/run, receive an
id - Poll — GET /v1/run/{id} until status is
completed,failed, ortimeout - Retrieve — Read
outputsfrom the completed response
Code Examples
Ready-to-run snippets
# Step 1: Submit
curl -X POST https://api.sandbase.ai/v1/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "alibaba/face-swap",
"prompt": "a beautiful sunset over mountains"
}'
# Step 2: Poll result (replace <id>)
curl https://api.sandbase.ai/v1/run/<id> \
-H "Authorization: Bearer YOUR_API_KEY"API README
Face Swap
Face Swap replaces the face in a target image with the face from a source image. Precisely swaps facial features only — head shape and hairstyle are preserved. Priced at $0.013 per image.
Highlights
Face-only swap — Replaces the face while keeping the original head shape, hair, and body intact for a natural result.
Dual-image input — Provide a source face and a target image; the model handles seamless blending automatically.
High realism — Produces photorealistic results with consistent skin tone, lighting, and edge transitions.
Low cost — At $0.013 per image, suitable for high-volume portrait and creative workflows.
Pricing
| Metric | Price |
|---|---|
| Per image | $0.013 |
When to Use
| ✅ Good fit | ❌ Consider alternatives |
|---|---|
| Portrait retouching and casting previews | Full head replacement (use Head Swap) |
| Entertainment and creative content | Style or background editing (use Qwen Image Edit Exp0622) |
| Product catalog face replacement | Video face swap |
| Gaming and avatar creation | New image generation from scratch (use Z-Image Exp0622) |
Technical Specs
| Spec | Value |
|---|---|
| Input | Source image (face) + target image (URL or Base64, max 50 MB each) |
| Output | Face-swapped image (PNG/JPEG) |
| Swapped region | Face only (head shape and hairstyle preserved) |
| Execution | Async (submit → poll for result) |

