HeyGen Avatar 6 Reference to Video API
Lip-sync animated characters, with gestures, from a reference clip.
POST /v2/heygen-avatar-6-reference-to-video · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "reference_video": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-reference-to-video-refvideo-5b29b86a.mp4",
11 "reference_image": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-reference-to-video-refimage-a735e29f.jpg",
12 "script": "Hello there, and welcome! Did you know a red fox makes over twenty different sounds? My three favourites are a yip, a bark, and a happy little gekker - listen closely!",
13 "voice_id": "c30ecab014cb4a8d816d07f6b2b625c8",
14 "motion_prompt": "The fox waves a friendly open paw on 'Hello there, and welcome'. On 'three favourites' it holds up three claws and counts them off one by one. On 'listen closely' it leans in slightly and cups a paw near its ear. Warm, cheerful expression with small natural head movements; keep both paws visible.",
15 "tier": "standard",
16 "resolution": "1080p",
17 "motion_expressiveness": "default",
18}
19job = client.submit_async("heygen-avatar-6-reference-to-video", **payload)
20print(job.request_id) # available immediately
21try:
22 result = job.wait(timeout=900, interval=2.0)
23 print(result["status"]) # COMPLETED
24 print(result.get("output")) # model output (e.g. video URL)
25except InferenceTimeout as e:
26 print("still running:", e.request_id) # re-poll later with this id
27except InferenceFailed as e:
28 print("failed:", e.detail)
29
30# Fast models (<=600s) can use the one-liner instead:
31# result = segmind.run("heygen-avatar-6-reference-to-video", **payload) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "reference_video": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-reference-to-video-refvideo-5b29b86a.mp4",
11 "reference_image": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-reference-to-video-refimage-a735e29f.jpg",
12 "script": "Hello there, and welcome! Did you know a red fox makes over twenty different sounds? My three favourites are a yip, a bark, and a happy little gekker - listen closely!",
13 "voice_id": "c30ecab014cb4a8d816d07f6b2b625c8",
14 "motion_prompt": "The fox waves a friendly open paw on 'Hello there, and welcome'. On 'three favourites' it holds up three claws and counts them off one by one. On 'listen closely' it leans in slightly and cups a paw near its ear. Warm, cheerful expression with small natural head movements; keep both paws visible.",
15 "tier": "standard",
16 "resolution": "1080p",
17 "motion_expressiveness": "default",
18}
19job = client.submit_async("heygen-avatar-6-reference-to-video", **payload)
20print(job.request_id) # available immediately
21try:
22 result = job.wait(timeout=900, interval=2.0)
23 print(result["status"]) # COMPLETED
24 print(result.get("output")) # model output (e.g. video URL)
25except InferenceTimeout as e:
26 print("still running:", e.request_id) # re-poll later with this id
27except InferenceFailed as e:
28 print("failed:", e.detail)
29
30# Fast models (<=600s) can use the one-liner instead:
31# result = segmind.run("heygen-avatar-6-reference-to-video", **payload)API Endpoint
https://api.segmind.com/v1/heygen-avatar-6-reference-to-videoParameters
reference_videorequiredstring (uri)Clip of an animated or illustrated character, at least 2 seconds, up to 50 MB. Videos of real people are not accepted; for a person, use heygen-avatar-6-image-to-video.
audiooptionalstring (uri)Speech to lip-sync instead of a Script: WAV, MP3 or M4A, up to 50 MB. The video runs as long as the audio.
languageoptionalstringScript language code like en or pt-BR. Leave empty to auto-detect.
motion_expressivenessoptionalstringdefault for natural movement, less for a calmer, steadier delivery.
"default""default""less"motion_promptoptionalstringDirect gestures, expression and head movement, up to 1,200 characters. Cue actions to words.
output_heightoptionalintegerOptional output height in pixels, even number. Set with output width.
output_widthoptionalintegerOptional output width in pixels, even number. Set with output height.
reference_imageoptionalstring (uri)Optional still of the same character to sharpen its look, up to 32 MB.
resolutionoptionalstringOutput resolution, 1080p or 2k. Use 2k for hero placements.
"1080p""1080p""2k"scriptoptionalstringWords for the avatar to speak, up to 5,000 characters. Use this or Audio, not both; needs a Voice.
tieroptionalstringstandard for full Avatar 6 quality, turbo for faster renders.
"standard""standard""turbo"voice_idoptionalstringHeyGen stock voice for the script. Pick one from the voice dropdown.
voice_speedoptionalnumberScript speaking speed, 0.5 to 2. Use 1 for a normal pace.
Response Type
Returns: Video
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/heygen-avatar-6-reference-to-videoSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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