Segmind Doppler Serverless API
Hear one line in four accents. Segmind Doppler films one AI speaker saying your line in each accent and cuts a labelled reel to test or localise an ad.
~6m 5s
~$1.5342
1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/v2/6b092dfae7d2a48ad622599c-v1"
7
8data = {
9 "character": "A friendly woman in her early 30s with short curly hair and a mustard knit sweater, sitting by the window of a bright neighbourhood café, medium close-up, relaxed, as if talking to a friend just off camera.",
10 "line": "Okay, I didn't expect this to actually work. But it does.",
11 "accent_1": "Scottish, from Glasgow",
12 "accent_2": "Texan, from Austin",
13 "accent_3": "Nigerian English, from Lagos",
14 "accent_4": "Indian English, from Mumbai",
15 "aspect_ratio": "9:16",
16 "resolution": "720p"
17}
18
19def poll_for_result(poll_url):
20 """Poll the API until the generation is complete"""
21 while True:
22 response = requests.get(
23 poll_url,
24 headers={'x-api-key': api_key}
25 )
26 result = response.json()
27
28 if result['status'] == 'COMPLETED':
29 # Parse the output (it's a JSON string)
30 outputs = json.loads(result['output'])
31 return outputs
32 elif result['status'] == 'FAILED':
33 raise Exception(result.get('error', 'Generation failed'))
34
35 # Wait 7 seconds before polling again
36 time.sleep(7)
37
38# Make the initial request
39response = requests.post(
40 url,
41 json=data,
42 headers={
43 'x-api-key': api_key,
44 'Content-Type': 'application/json'
45 }
46)
47
48if response.status_code == 200:
49 result = response.json()
50 print('Request queued:', result)
51
52 # Start polling for results
53 outputs = poll_for_result(result['poll_url'])
54 print('Generation complete:', outputs)
55else:
56 print(f"Error: {response.status_code}")
57 print(response.text) 1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/v2/6b092dfae7d2a48ad622599c-v1"
7
8data = {
9 "character": "A friendly woman in her early 30s with short curly hair and a mustard knit sweater, sitting by the window of a bright neighbourhood café, medium close-up, relaxed, as if talking to a friend just off camera.",
10 "line": "Okay, I didn't expect this to actually work. But it does.",
11 "accent_1": "Scottish, from Glasgow",
12 "accent_2": "Texan, from Austin",
13 "accent_3": "Nigerian English, from Lagos",
14 "accent_4": "Indian English, from Mumbai",
15 "aspect_ratio": "9:16",
16 "resolution": "720p"
17}
18
19def poll_for_result(poll_url):
20 """Poll the API until the generation is complete"""
21 while True:
22 response = requests.get(
23 poll_url,
24 headers={'x-api-key': api_key}
25 )
26 result = response.json()
27
28 if result['status'] == 'COMPLETED':
29 # Parse the output (it's a JSON string)
30 outputs = json.loads(result['output'])
31 return outputs
32 elif result['status'] == 'FAILED':
33 raise Exception(result.get('error', 'Generation failed'))
34
35 # Wait 7 seconds before polling again
36 time.sleep(7)
37
38# Make the initial request
39response = requests.post(
40 url,
41 json=data,
42 headers={
43 'x-api-key': api_key,
44 'Content-Type': 'application/json'
45 }
46)
47
48if response.status_code == 200:
49 result = response.json()
50 print('Request queued:', result)
51
52 # Start polling for results
53 outputs = poll_for_result(result['poll_url'])
54 print('Generation complete:', outputs)
55else:
56 print(f"Error: {response.status_code}")
57 print(response.text)API Endpoint
POST
https://api.segmind.com/workflows/v2/6b092dfae7d2a48ad622599c-v1Parameters
characteroptionalstringCharacter
Default:
"A friendly woman in her early 30s with short curly hair and a mustard knit sweater, sitting by the window of a bright neighbourhood café, medium close-up, relaxed, as if talking to a friend just off camera."lineoptionalstringLine
Default:
"Okay, I didn't expect this to actually work. But it does."accent_1optionalstringAccent 1
Default:
"Scottish, from Glasgow"accent_2optionalstringAccent 2
Default:
"Texan, from Austin"accent_3optionalstringAccent 3
Default:
"Nigerian English, from Lagos"accent_4optionalstringAccent 4
Default:
"Indian English, from Mumbai"aspect_ratiooptionalstringAspect Ratio
Default:
"9:16"resolutionoptionalstringResolution
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