HeyGen Avatar 6 Image to Video API
Turn a photo into a lip-synced talking avatar video.
POST /v2/heygen-avatar-6-image-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_image": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-image-to-video-ref-f37b689c.jpg",
11 "script": "We shipped three things this month. First, the panels fold completely flat. Second, each one weighs under two kilos. And third — my favorite — they still charge in full shade.",
12 "voice_id": "4270665fc47f44aa989c093bb3dc2b99",
13 "motion_prompt": "Keep steady eye contact with the camera and use small, natural hand gestures; count on her fingers one, two, three as she says first, second, third; lean in slightly and smile warmly on the last line.",
14 "tier": "standard",
15 "resolution": "1080p",
16}
17job = client.submit_async("heygen-avatar-6-image-to-video", **payload)
18print(job.request_id) # available immediately
19try:
20 result = job.wait(timeout=900, interval=2.0)
21 print(result["status"]) # COMPLETED
22 print(result.get("output")) # model output (e.g. video URL)
23except InferenceTimeout as e:
24 print("still running:", e.request_id) # re-poll later with this id
25except InferenceFailed as e:
26 print("failed:", e.detail)
27
28# Fast models (<=600s) can use the one-liner instead:
29# result = segmind.run("heygen-avatar-6-image-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_image": "https://segmind-resources.s3.amazonaws.com/input/heygen-avatar-6-image-to-video-ref-f37b689c.jpg",
11 "script": "We shipped three things this month. First, the panels fold completely flat. Second, each one weighs under two kilos. And third — my favorite — they still charge in full shade.",
12 "voice_id": "4270665fc47f44aa989c093bb3dc2b99",
13 "motion_prompt": "Keep steady eye contact with the camera and use small, natural hand gestures; count on her fingers one, two, three as she says first, second, third; lean in slightly and smile warmly on the last line.",
14 "tier": "standard",
15 "resolution": "1080p",
16}
17job = client.submit_async("heygen-avatar-6-image-to-video", **payload)
18print(job.request_id) # available immediately
19try:
20 result = job.wait(timeout=900, interval=2.0)
21 print(result["status"]) # COMPLETED
22 print(result.get("output")) # model output (e.g. video URL)
23except InferenceTimeout as e:
24 print("still running:", e.request_id) # re-poll later with this id
25except InferenceFailed as e:
26 print("failed:", e.detail)
27
28# Fast models (<=600s) can use the one-liner instead:
29# result = segmind.run("heygen-avatar-6-image-to-video", **payload)API Endpoint
https://api.segmind.com/v1/heygen-avatar-6-image-to-videoParameters
reference_imagerequiredstring (uri)Photo of the person or character to animate, up to 32 MB. Use one clear, front-facing face.
audiooptionalstring (uri)Your own speech to lip-sync instead of a Script: WAV, MP3 or M4A, up to 50 MB.
languageoptionalstringOptional language code for the Script, like en or pt-BR. Leave empty to auto-detect.
motion_expressivenessoptionalstringdefault for natural movement; less for calmer, steadier delivery. Use less for formal clips.
"default""default""less"motion_promptoptionalstringDirection for gestures, expression and posture, up to 1,200 characters. Tie an action to a phrase.
output_heightoptionalintegerOptional output height in pixels, even number, set with Output Width. Leave empty to keep the reference shape.
output_widthoptionalintegerOptional output width in pixels, even number, set with Output Height. Leave empty to keep the reference shape.
resolutionoptionalstringOutput resolution, 1080p or 2k. Choose 2k for large screens or fine detail.
"1080p""1080p""2k"scriptoptionalstringWords for the avatar to speak, up to 5,000 characters. Use this or Audio, not both; needs a Voice.
tieroptionalstringstandard gives full Avatar 6 quality; turbo renders faster. Use turbo for quick drafts.
"standard""standard""turbo"voice_idoptionalstringHeyGen stock voice that reads the Script. Pick one from the Voice dropdown.
voice_speedoptionalnumberScript speaking speed, 0.5 to 2, stock voices only. Keep near 1 for a natural 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-image-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