Heygen Avatar IV Serverless API

Transform a single photo into a lifelike talking avatar with customizable speech and gestures.

~195.48s
~$2.216
 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

POSThttps://api.segmind.com/v1/heygen-avatar-iv

Parameters

image_urlrequired
string (uri)

Provide a URL for the image. Example: a clear face image.

video_titlerequired
string

Specify the video title. Example: 'Welcome Video'.

audio_urloptional
string (uri)

Link to audio file. Example: 'https://audio.com/hello.wav'.

custom_motion_promptoptional
string

Describe avatar motion style. Example: 'energetic gestures'.

enhance_custom_motion_promptoptional
boolean

Enhance motions with AI. Example: 'true' for dynamic avatars.

Default: false
fitoptional
string

Select how avatar fits on screen. Example: 'contain' for full image.

Default: "cover"
Allowed values :
"cover""contain"
scriptoptional
string

Input the script text. Example: 'Hello, welcome!'.

video_orientationoptional
string

Choose video orientation. Example: 'portrait' for tall videos.

Default: "landscape"
Allowed values :
"portrait""landscape"
voice_idoptional
string

Select a voice ID. Example: 'Rex - Broadcaster'.

Default: "f80e430f06b34b70b275c9c746436e37"
Allowed values (61 total):
Onyx"26b2064088674c80b1e5fc5ab1a068ea"
Coral"6d5ef2eb0cb94193b90dd3cb397ae898"
Nova"71b0aa6499f6458e8b040818a017db1f"
Shimmer"8273e0a033074b5bb98d7ce3ab727bd9"
Lukas in car"8f0944e10aad4e989bce8f76807b6f36"
Lea in car"8f389c2237194f80b50fe7632dcc17b8"
Lea inside"9af7667dcc3145b790a5fb1ac226dfe3"
DARAN INSIDE 2 with mic"5a3cff20eddd491ca1196ffd1a868fdb"
Daran outside sitting"9ff7fd2dd9114c3bae005e62aa485e52"
Gail inside standing"acebd7b6419a44a388b9d1620614b29f"
+51 more

Response Type

Returns: Video

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

Model or endpoint 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