alibaba/head-swap
Head Swap replaces the head in a target image with the head from a source image, producing a realistic head-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/head-swapInput Schema
3 parameters · 2 required · 1 optional
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Required | The target image whose head will be replaced (URL or Base64-encoded string). Maximum file size is 50 MB. |
head_image | string | Required | The image containing the head 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/head-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
Head Swap
Head Swap replaces the entire head in a target image with the head from a source image — including face, head shape, and hairstyle. Priced at $0.013 per image.
Highlights
Full head replacement — Replaces the face, head shape, and hairstyle together for a complete identity transfer.
Dual-image input — Provide a source head and a target image; automatic seamless blending is applied.
Realistic compositing — Maintains consistent lighting, skin tone, and perspective with the target body.
Low cost — At $0.013 per image, suitable for high-volume creative and commercial workflows.
Pricing
| Metric | Price |
|---|---|
| Per image | $0.013 |
When to Use
| ✅ Good fit | ❌ Consider alternatives |
|---|---|
| Full identity transfer across images | Face-only swap preserving original hairstyle (use Face Swap) |
| Casting previews and lookbooks | Style or background editing (use Qwen Image Edit Exp0622) |
| Character design and creative compositing | Video head swap |
| E-commerce model replacement | New image generation from scratch (use Z-Image Exp0622) |
Technical Specs
| Spec | Value |
|---|---|
| Input | Source image (head) + target image (URL or Base64, max 50 MB each) |
| Output | Head-swapped image (PNG/JPEG) |
| Swapped region | Full head (face, head shape, and hairstyle) |
| Execution | Async (submit → poll for result) |

