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.
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) 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
https://api.segmind.com/workflows/v2/6ae4d7a0c2435043e2e895e0-v2Parameters
clipoptionalstring (uri)Clip
"https://images.segmind.com/public/eba9e0cf485fba186afc51e8d0996a5f.mp4"your_photooptionalstring (uri)Your Photo
"https://images.segmind.com/public/477021e376a5076951bf43fde472ef4d.jpeg"whooptionalstringWho
"the young man with dark hair"outfitoptionalstringOutfit
"keep the exact clothes from the video and ignore the clothes in the photo"resolutionoptionalstringResolution
"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.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Workflow not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out