Segmind Charm Collider Serverless API

Put yourself in any video with one photo: Segmind Charm Collider swaps the person in a clip and keeps every move, expression, lip movement and camera move. For creators and fans, and for film and ad studios recasting a shot. Up to 1080p, with your clip's sound.

~6m 3s
~$2.8635
 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/v2/6ae4d7a0c2435043e2e895e0-v2"
 7
 8data = {
 9    "clip": "https://images.segmind.com/public/eba9e0cf485fba186afc51e8d0996a5f.mp4",
10    "your_photo": "https://images.segmind.com/public/477021e376a5076951bf43fde472ef4d.jpeg",
11    "who": "the young man with dark hair",
12    "outfit": "keep the exact clothes from the video and ignore the clothes in the photo",
13    "resolution": "720p"
14}
15
16def poll_for_result(poll_url):
17    """Poll the API until the generation is complete"""
18    while True:
19        response = requests.get(
20            poll_url,
21            headers={'x-api-key': api_key}
22        )
23        result = response.json()
24
25        if result['status'] == 'COMPLETED':
26            # Parse the output (it's a JSON string)
27            outputs = json.loads(result['output'])
28            return outputs
29        elif result['status'] == 'FAILED':
30            raise Exception(result.get('error', 'Generation failed'))
31
32        # Wait 7 seconds before polling again
33        time.sleep(7)
34
35# Make the initial request
36response = requests.post(
37    url,
38    json=data,
39    headers={
40        'x-api-key': api_key,
41        'Content-Type': 'application/json'
42    }
43)
44
45if response.status_code == 200:
46    result = response.json()
47    print('Request queued:', result)
48
49    # Start polling for results
50    outputs = poll_for_result(result['poll_url'])
51    print('Generation complete:', outputs)
52else:
53    print(f"Error: {response.status_code}")
54    print(response.text)

API Endpoint

POSThttps://api.segmind.com/workflows/v2/6ae4d7a0c2435043e2e895e0-v2

Parameters

clipoptional
string (uri)

Clip

Default: "https://images.segmind.com/public/eba9e0cf485fba186afc51e8d0996a5f.mp4"
your_photooptional
string (uri)

Your Photo

Default: "https://images.segmind.com/public/477021e376a5076951bf43fde472ef4d.jpeg"
whooptional
string

Who

Default: "the young man with dark hair"
outfitoptional
string

Outfit

Default: "keep the exact clothes from the video and ignore the clothes in the photo"
resolutionoptional
string

Resolution

Default: "720p"

Response Format

Returns: Polling-based asynchronous response

Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.

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

Workflow 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