Heygen Avatar IV Serverless API
Transform a single photo into a lifelike talking avatar with customizable speech and gestures.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/heygen-avatar-iv"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image_url": "https://segmind-inference-inputs.s3.amazonaws.com/f858aaa9-26a9-4749-83fc-08ac2240c1e2-148863a50eac17d1990d23b873818afa.png",
12 "video_title": "Hello Avatar",
13 "script": "Hello, this is an avatar demo.",
14 "voice_id": "f80e430f06b34b70b275c9c746436e37",
15 "video_orientation": "landscape",
16 "fit": "cover",
17 "custom_motion_prompt": "Subtle hand movements.",
18 "enhance_custom_motion_prompt": false,
19 "audio_url": "https://segmind-resources.s3.amazonaws.com/input/c8a1403e-d409-481d-b269-5eee0f01581f-0e55863604e421fff17ffbe89992a1cc.wav"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/heygen-avatar-iv"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image_url": "https://segmind-inference-inputs.s3.amazonaws.com/f858aaa9-26a9-4749-83fc-08ac2240c1e2-148863a50eac17d1990d23b873818afa.png",
12 "video_title": "Hello Avatar",
13 "script": "Hello, this is an avatar demo.",
14 "voice_id": "f80e430f06b34b70b275c9c746436e37",
15 "video_orientation": "landscape",
16 "fit": "cover",
17 "custom_motion_prompt": "Subtle hand movements.",
18 "enhance_custom_motion_prompt": false,
19 "audio_url": "https://segmind-resources.s3.amazonaws.com/input/c8a1403e-d409-481d-b269-5eee0f01581f-0e55863604e421fff17ffbe89992a1cc.wav"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/heygen-avatar-ivParameters
image_urlrequiredstring (uri)Provide a URL for the image. Example: a clear face image.
video_titlerequiredstringSpecify the video title. Example: 'Welcome Video'.
audio_urloptionalstring (uri)Link to audio file. Example: 'https://audio.com/hello.wav'.
custom_motion_promptoptionalstringDescribe avatar motion style. Example: 'energetic gestures'.
enhance_custom_motion_promptoptionalbooleanEnhance motions with AI. Example: 'true' for dynamic avatars.
falsefitoptionalstringSelect how avatar fits on screen. Example: 'contain' for full image.
"cover""cover""contain"scriptoptionalstringInput the script text. Example: 'Hello, welcome!'.
video_orientationoptionalstringChoose video orientation. Example: 'portrait' for tall videos.
"landscape""portrait""landscape"voice_idoptionalstringSelect a voice ID. Example: 'Rex - Broadcaster'.
"f80e430f06b34b70b275c9c746436e37""26b2064088674c80b1e5fc5ab1a068ea""6d5ef2eb0cb94193b90dd3cb397ae898""71b0aa6499f6458e8b040818a017db1f""8273e0a033074b5bb98d7ce3ab727bd9""8f0944e10aad4e989bce8f76807b6f36""8f389c2237194f80b50fe7632dcc17b8""9af7667dcc3145b790a5fb1ac226dfe3""5a3cff20eddd491ca1196ffd1a868fdb""9ff7fd2dd9114c3bae005e62aa485e52""acebd7b6419a44a388b9d1620614b29f"Response Type
Returns: Video
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
Model or endpoint 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