calesthio/heygen-avatar-video
Produce HeyGen avatar videos with Direct Video, Video Agent, Digital Twin, Avatar Realtime, and related avatar/voice/asset APIs. Use for provider routing, avatar and voice selection, script-to-video workflows, lip-sync from audio, backgrounds/scenes, callbacks and polling, consent and rights checks, localization handoffs, artifact custody, QA, and troubleshooting HeyGen avatar-video productions.
npx skills add https://github.com/calesthio/generative-media-skills --skill heygen-avatar-video
Use this skill when the production path is HeyGen and the deliverable involves an AI presenter, digital twin, photo avatar, studio avatar, prompt-composed avatar clip, or real-time streaming avatar. Treat HeyGen as both a creative video tool and a likeness-handling system: lock consent, identity rights, script intent, voice rights, and output custody before generation.
Facts below were verified from official HeyGen documentation and policy pages on 2026-07-10. Recheck the linked docs for volatile fields such as prices, engine support, endpoint shapes, limits, status values, moderation policy, and plan entitlements before a paid run.
Prefer the most controllable API that still fits the brief.
POST /v3/video-agents) when the user wants a complete avatar video from a natural-language brief and accepts HeyGen choosing or composing the script, avatar, voice, and visual style. It is the fastest exploration path and supports one-shot generation or interactive chat-style iteration, but it gives less deterministic scene control.POST /v3/videos, type: "avatar") when the script, avatar look, voice, aspect ratio, background, captions, watermark, output format, or motion prompt must be explicit and repeatable. This is the default for production pipelines, personalized campaigns, compliance-reviewed scripts, and brand-controlled spokesperson videos.POST /v3/videos, type: "cinematic_avatar") only when the output is a short prompt-composed cinematic shot with 1-3 avatar looks and no spoken script. Do not choose it for normal talking-head narration.POST /v3/avatar-realtime) when the user needs a live HLS stream of an avatar speaking in real time. It is for kiosks, live agents, assistants, and broadcasts where the application owns STT/LLM orchestration. It is not a rendered MP4 workflow.Official routing basis: HeyGen's "Choosing the Right Video API" docs distinguish Video Agent as prompt-driven/low-control, Direct Video as structured/high-control, and Cinematic Avatar as prompt + avatar looks with no spoken voice. Official Avatar Realtime docs describe the real-time HLS path as separate from rendered video.
Before generating:
X-Api-Key / x-api-key and bill against the API wallet.GET /v3/avatars/looks; pass the look ID as avatar_id, not the avatar group ID.GET /v3/voices; filter by language, gender, type, and engine when needed. If using the TTS endpoint, HeyGen docs call out engine=starfish voices.HeyGen separates avatar groups from avatar looks. A group is a character identity; a look is the renderable outfit/pose/style. In video creation, avatar_id should be the look ID.
Digital twins depict real identifiable people and require explicit consent handling. HeyGen's consent docs state that digital twins require proof that the depicted person agreed to be cloned, while photo avatars and prompt avatars do not require the same digital-twin consent flow. Available consent levels, verified 2026-07-10:
Production rules:
private or stock/library when known), consent status or consent URL/result where available, and approval source.POST /v3/avatars/{group_id}/consent and wait for completion/approval before generation.For POST /v3/videos avatar renders, HeyGen v3 supports Avatar III, Avatar IV, and Avatar V engines. Verified 2026-07-10:
avatar_iv) is the default when the engine field is omitted. It is the safest default for ordinary Direct Video because it is broadly supported.avatar_v) is higher-fidelity and cross-reference-driven in HeyGen's docs/research, but official docs say to check the avatar look's supported_api_engines via GET /v3/avatars/looks/{look_id} before requesting it. Avatar V support is narrower and documented as Digital Twin-only in pricing/model docs.avatar_iii) is a dedicated photo-to-video pipeline in the current v3 docs. Do not confuse it with older legacy v1/v2 Avatar III endpoints.motion_prompt support depends on both avatar source and engine: official v3 docs list it for photo avatars on either supported engine and for video avatars only when engine.type is avatar_v; it is rejected for video avatars on the default Avatar IV engine. expressiveness is photo-avatar-only, Avatar IV-only, and rejected with Avatar V.Heuristic: for a compliance-reviewed corporate or training presenter, use Avatar IV unless Avatar V is explicitly supported and the user values maximum likeness/motion fidelity or video-avatar gesture prompting enough to pay for it. For photo-avatar experimentation, check whether Avatar III or IV better matches the available look and cost constraints.
Write for a human presenter, not for a voiceover pasted onto a face.
motion_prompt for visible behavior only when the selected avatar/engine combination supports it: posture, hand restraint, warmth, pointing/gesture level, eye-contact style, and energy. Keep it natural and non-choreographic.voice_settings for speed, pitch, volume, locale, and engine settings when the selected voice supports them.Script shape for avatar video:
Avoid:
Use this pattern for controlled rendered videos:
{
"type": "avatar",
"avatar_id": "LOOK_ID",
"voice_id": "VOICE_ID",
"script": "Hi, I'm Maya. In the next thirty seconds, I'll show you how Acme reduces invoice review from days to minutes.",
"title": "Acme invoice review intro",
"resolution": "1080p",
"aspect_ratio": "16:9",
"background": {
"asset_id": "BACKGROUND_ASSET_ID"
},
"caption": {
"file_format": "srt",
"style": "default"
},
"engine": {
"type": "avatar_iv"
},
"callback_url": "https://example.com/webhooks/heygen",
"callback_id": "project-scene-001"
}
Production notes:
audio_url or audio_asset_id instead of script + voice_id when the user supplies approved narration and wants lip-sync to that audio.motion_prompt only when the selected avatar look and engine support it; do not include it for video-avatar or digital-twin renders on default Avatar IV.remove_background or a transparent/background workflow only when the downstream compositor needs the avatar isolated; verify whether the selected endpoint/plan supports the desired output format.callback_id meaningful and unique for custody; mirror it in your local manifest.GET /v3/videos/{video_id} until terminal status.Use Video Agent when speed and creative automation beat exact control. The prompt should still specify business constraints; do not leave brand, audience, duration, or compliance-sensitive claims implicit.
Example prompt:
Create a 45-second avatar-led onboarding video for a B2B SaaS feature launch.
Audience: finance operations managers.
Goal: explain that Acme Review flags duplicate invoices before payment.
Tone: calm, credible, lightly upbeat; no hype.
Structure: 5-second hook, one pain point, three product benefits, one concrete example, CTA to book a demo.
Visual style: clean enterprise software, soft blue/white palette, no exaggerated gestures.
Must say: "duplicate invoice checks run before the payment batch is approved."
Avoid: guarantees of fraud prevention, competitor claims, fake customer quotes, legal advice.
Output: 16:9, captions on.
If the user needs exact wording, do not rely on Video Agent's script writing for final output. Use it to explore concepts, then rebuild as Direct Video with the approved script and explicit assets.
Use Avatar Realtime for live spoken avatars, not MP4 delivery. Official docs describe three speech drivers: tts, audio, and text_stream; sessions are played from HLS.
For text_stream, plan the upstream system:
text_stream.QA for realtime includes startup latency, interruption behavior, stream stability, HLS player compatibility, end_reason/error messages, and whether the avatar's spoken response remains aligned with the user's actual question.
HeyGen Direct Video gives structured control over a single avatar render; do not assume it is a full editor unless the selected route supports scenes/templates. For multi-scene brand videos:
asset_ids.Artifact custody:
video_id, callback_id, avatar look ID, voice ID, asset IDs, engine type, and title.video_url artifacts into the project storage immediately; presigned links are not durable custody.Rendered video generation is asynchronous. Official docs list video statuses including pending, processing, completed, and failed; completed responses include a video_url, and failed responses include failure details. Use callbacks for scale and polling for simple runs.
Failure triage:
401 Unauthorized: API key missing, wrong header, inactive key, or wrong billing/auth path.429 Too Many Requests: rate/concurrency limit. Respect Retry-After; do not tight-loop.motion_prompt for the selected avatar/engine, unsupported expressiveness with Avatar V or a non-photo avatar, missing script/audio/voice field, invalid aspect ratio/resolution, or prompt/script too long.failure_code/failure_message, preserve the request, and test with a minimal script + same avatar/voice to isolate whether the issue is content, asset, engine, or account limit.Retry policy:
HeyGen's current official pages require users to comply with its Terms and Acceptable Use/Moderation Policy and emphasize consent for custom avatars/digital twins. Build your own production gate:
Review the downloaded video before delivery:
Intent: produce a deterministic 30-second product-launch video with an approved company presenter look.
Approach:
GET /v3/avatars/looks/{look_id} for supported engines; use Avatar IV if Avatar V is not listed.Example payload:
{
"type": "avatar",
"avatar_id": "maya_launch_look_01",
"voice_id": "en_us_brand_voice_02",
"script": "Today we're launching Acme Review. It checks every invoice before the payment batch is approved, flags likely duplicates, and gives your team a clear review queue. If you already use Acme Pay, you can turn it on from settings today.",
"title": "Acme Review launch - approved spokesperson",
"resolution": "1080p",
"aspect_ratio": "16:9",
"background": { "asset_id": "asset_office_soft_blue" },
"caption": { "file_format": "srt", "style": "default" },
"engine": { "type": "avatar_iv" },
"callback_url": "https://video.example.com/hooks/heygen",
"callback_id": "acme-review-launch-v1"
}
Why this works: the approved script avoids unverifiable guarantees, Avatar IV is a broad default for a controlled spokesperson render, the callback ID supports custody, and Direct Video preserves exact wording. If the approved digital-twin look supports Avatar V and gesture prompting is important, switch the engine after verifying support and then add a restrained motion_prompt.
Likely failure modes: unsupported private look, pending digital-twin consent, pronunciation of product names, captions colliding with lower thirds, or moderation review if claims imply fraud detection guarantees.
Intent: convert an English HR training presenter into Spanish and French variants while preserving the approved visual identity.
Approach:
Example Spanish script segment:
Hola. En este modulo repasaremos como reportar un conflicto de intereses antes de aprobar una compra. Si tienes dudas, pausa el video y consulta la politica interna en el portal de cumplimiento.
Example payload differences:
{
"voice_id": "es_es_training_voice_01",
"voice_settings": {
"speed": 0.95,
"pitch": 0,
"volume": 1,
"locale": "es-ES"
},
"caption": {
"file_format": "srt",
"style": "default"
}
}
Why this works: the slightly slower speed gives captions and lip-sync more room, while separate scripts preserve compliance language in each market.
Likely failure modes: too-long translated sentences, formal/informal pronoun mismatch, cloned voice not licensed for all regions, and text overflow in captions.
Intent: place an avatar face on a live support assistant in a kiosk.
Approach:
text_stream session.Example initial request:
{
"type": "text_stream",
"avatar_id": "concierge_stock_look_07",
"voice_id": "en_us_warm_support_03",
"text": "Hi, I'm here to help. What can I find for you today?"
}
Example text append:
{
"text": "The returns desk is on level two, near the west elevators."
}
Why this works: Avatar Realtime only handles the talking face and voice stream; the application remains responsible for retrieval accuracy, safety filtering, and conversation state.
Likely failure modes: idle timeout, too many concurrent sessions, HLS playback issues on the kiosk browser, long LLM responses queued after the user changes topics, or the avatar appearing to make commitments the system cannot fulfill.
Take calesthio/heygen-avatar-video from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.