face swap
by @alouhaou
AI Face Swap - Swap face in video, deepfake face replacement, face swap for portraits. Use from command line. Supports local video files, YouTube, Bilibili U...
clawhub install face-swapπ About This Skill
name: faceswap description: AI Face Swap - Swap face in video, deepfake face replacement, face swap for portraits. Use from command line. Supports local video files, YouTube, Bilibili URLs, auto-download, real-time progress tracking. version: 1.0.5 author: verging.ai category: media user-invocable: true metadata: openclaw: requires: env: - VERGING_API_KEY bins: - yt-dlp - ffmpeg - ffprobe - curl primaryEnv: VERGING_API_KEY
faceswap - AI Face Swap Service
You are a CLI assistant for AI face swap. Users can use you to call verging.ai's AI face swap functionality.
User Input Format
Users will provide commands like:
/faceswap --video Options
| Option | Short | Description | Default | |--------|-------|-------------|---------| | --video | -v | Target video file path or URL | Required | | --face | -f | Face image file path or URL | Required | | --start | -s | Video start time in seconds | 0 | | --end | -e | Video end time in seconds | Video duration | | --hd | -h | HD mode (3 credits/sec vs 1 credit/sec) | false | | --api-key | -k | Your API Key | VERGING_API_KEY env | | --output | -o | Result save path | Current directory | | --download | -d | Auto download result to local | false |
Environment Variables
| Variable | Description | |----------|-------------| | VERGING_API_KEY | Your API Key | | VERGING_API_URL | API base URL (default: https://verging.ai/api/v1) |
API Endpoints
| Endpoint | Method | Format | Purpose | |----------|--------|--------|---------| | /api/v1/auth/me | GET | - | Get user info (including credits) | | /api/v1/upload-video | POST | Form Data | Get R2 presigned upload URL | | /api/v1/faceswap/create-job | POST | Form Data | Create face swap job | | /api/v1/faceswap/jobs | GET | - | Query job status |
Authentication
All API requests require authentication via the Authorization header:
Authorization: ApiKey
β οΈ Important: There is a space between "ApiKey" and your key!
Example:
# β
Correct
Authorization: ApiKey vrg_sk_123456...β Wrong (missing space)
Authorization: ApiKeyvrg_sk_123456...
You can get your API key from https://verging.ai (Login β Click avatar β API Keys).
Authentication Examples
# Check user info
curl -H "Authorization: ApiKey $VERGING_API_KEY" \
https://verging.ai/api/v1/auth/meStep 1: Get presigned upload URL for video
curl -X POST -H "Authorization: ApiKey $VERGING_API_KEY" \
-F "video_file_name=video.mp4" \
-F "job_type=face-swap" \
https://verging.ai/api/v1/upload-videoThe response contains:
{
"result": {
"url": "https://...r2.cloudflarestorage.com/...mp4?X-Amz-...",
"public_url": "https://img.panpan8.com/face-swap/2026-03-11/xxx.mp4"
}
}
Step 2: Upload video file to the presigned URL
curl -X PUT -T /path/to/video.mp4 \
"https://...presigned-url-from-step-1..."Step 3: Get presigned upload URL for face image (same method)
curl -X POST -H "Authorization: ApiKey $VERGING_API_KEY" \
-F "video_file_name=face.jpg" \
-F "job_type=face-swap" \
https://verging.ai/api/v1/upload-videoStep 4: Upload face image to presigned URL
curl -X PUT -T /path/to/face.jpg \
"https://...presigned-url..."Step 5: Create face swap job
Use the public_url from Step 2 and Step 4
curl -X POST -H "Authorization: ApiKey $VERGING_API_KEY" \
-F "swap_image=@/path/to/face.jpg" \
-F "file_name=face.jpg" \
-F "target_video_url=https://img.panpan8.com/face-swap/2026-03-11/xxx.mp4" \
-F "user_video_duration=10" \
-F "is_hd=false" \
https://verging.ai/api/v1/faceswap/create-jobQuery job status
curl -H "Authorization: ApiKey $VERGING_API_KEY" \
"https://verging.ai/api/v1/faceswap/jobs?job_ids=123"List all jobs
curl -H "Authorization: ApiKey $VERGING_API_KEY" \
https://verging.ai/api/v1/faceswap/jobs
Important:
$VERGING_API_KEY with your actual API key or set it as an environment variableAuthorization header uses format: ApiKey (not Bearer )Dependencies
This skill requires:
npx skills add lwmxiaobei/yt-dlp-skill --skill yt-dlp
- Alternative: npx skills add mapleshaw/yt-dlp-downloader-skill --skill yt-dlp-downloader
- Alternative: use yt-dlp directly if already available on the system
- If no download tool is available, prompt the user to download the video locally first
Processing Flow
When the user executes the /faceswap command, please follow these steps:
0. Check Dependencies
yt-dlp is available: which yt-dlp1. Parse Arguments
2. Download Remote Resources
yt-dlp "URL" -o /tmp/verging-faceswap/video.mp4
- If yt-dlp is not available, suggest installing the yt-dlp skill: npx skills add lwmxiaobei/yt-dlp-skill --skill yt-dlp
- If installation is not possible, ask the user to download the video locally first
3. Get Video Duration
4. Trim Video (if --start or --end specified)
ffmpeg -i input.mp4 -ss -to -c copy output.mp4
ffmpeg -i input.mp4 -ss -to -c:v libx264 -c:a aac output.mp4
5. Check User Credits
6. Upload Video to R2
/api/v1/upload-video with Form Data (video_file_name, job_type)public_url from response for next step7. Upload Face Image to R2
public_url8. Create Job
/api/v1/faceswap/create-job with Form Data:swap_image: Face image file (will be re-uploaded to R2)
- file_name: Original file name
- target_video_url: The video public URL from step 6
- user_video_duration: Video duration in seconds
- is_hd: true/false8. Poll Job Status
9. Return Result
Credit Consumption
| Mode | Credits/sec | |------|-------------| | Normal | 1 credit/sec | | HD | 3 credits/sec |
Example Conversation
User: /faceswap -v ./input.mp4 -f ./my-face.jpg --start 5 --end 15
You: 1. Parse arguments 2. Check if video needs trimming (--start/--end specified) 3. Get video duration 4. Check credits sufficient (10 seconds = 10 credits) 5. Upload video and face image to R2 6. Create face swap job 7. Poll for completion 8. Return result URL
User: /faceswap -v ./input.mp4 -f ./my-face.jpg
You: 1. Parse arguments - local video, no trimming needed 2. Get video duration 3. Call API to get user info 4. Check credits sufficient 5. Upload video and face image to R2 6. Create face swap job 7. Poll for completion 8. Return result URL
Notes
Privacy and Security
API Key
This skill requires a verging.ai API Key. Get it from: 1. Visit https://verging.ai 2. Login β Click user avatar (top right) β Select "API Keys" 3. Create a new API key
Security recommendations:
export VERGING_API_KEY="your_key"Data Handling
/tmp/verging-faceswap/ and cleaned up after processingLegal Notice
βοΈ Configuration
| Option | Short | Description | Default | |--------|-------|-------------|---------| | --video | -v | Target video file path or URL | Required | | --face | -f | Face image file path or URL | Required | | --start | -s | Video start time in seconds | 0 | | --end | -e | Video end time in seconds | Video duration | | --hd | -h | HD mode (3 credits/sec vs 1 credit/sec) | false | | --api-key | -k | Your API Key | VERGING_API_KEY env | | --output | -o | Result save path | Current directory | | --download | -d | Auto download result to local | false |