HeyGen avatar video
One command submits, polls and downloads:
bashnode "<this skill's base directory>/generate-video.js" --script-file /tmp/script.txt --out /tmp/talk.mp4 --caption --json
First-time setup
The presenter is configured once, in ~/.content-skills/.env:
HEYGEN_API_KEYfrom https://app.heygen.com (Settings > API).- Run
node generate-video.js --list-looks. It prints the user's own avatar looks. Ask the user which one, then setHEYGEN_AVATAR_ID=<id>. Prefer a landscape look: video-shorts crops it into split screens. HEYGEN_VOICE_IDcan stay empty (the look's own voice is used). To pick another clone:--list-voices.node generate-video.js --whoamiconfirms what will be used.
If --list-looks is empty, the user has no avatar yet. Point them to https://app.heygen.com/avatars to create
a digital twin (needs a short recording and consent). Do not fall back to a stock avatar without asking.
Hard rules
- Never change the presenter from the task. Do not pass
--avatar-id,--voice-idor similar; the script rejects them. The only way to change the presenter is to edit~/.content-skills/.env, and only when the user asks. - Only call HeyGen through
generate-video.js. - Never invent a script. Given a topic, draft it, show it, and get a yes. Rendering costs credits.
- Keep chat clean. No ids, request bodies or polling chatter. Deliver the file.
Options
| Need | Flag | Default |
|---|---|---|
| Vertical | --aspect 9:16 | 16:9 |
Save locally (+ .srt with --caption) | --out <path.mp4> | not downloaded |
| Captions sidecar / burned in | --caption / --caption burn | off |
| Background | --background "#0f172a" or --background <https url> | the look's own |
| Delivery speed | --speed 0.5-1.5 | 1.0 |
| Calmer gestures | --motion-expressiveness less | default |
| Engine | --engine heygen-avatar-6 or heygen-avatar-6-turbo (older: avatar_v, avatar_iv) | heygen-avatar-6 |
| Resolution | --resolution 2k|1080p | 1080p |
| Check the request without spending | --dry-run | off |
Use --resolution 2k when the clip will be shown full-screen in a 1080x1920 Short: 1080p landscape gets upscaled ~1.8x.
The command blocks until done (1-5 min for a short script). Run it in the background and do not narrate the wait.
Stdout is JSON: video_id, status, video_url (presigned, expires), duration, file, subtitle_file.
Script guidelines
- First person, conversational, as the presenter would say it. Contractions are fine.
- 130-150 words per minute. A 30 second Short is about 70 words. 87 words came out at 36 s.
- Open with the point. End with one clear ask.
- No stage directions, emojis or markdown. It is read verbatim.
- Spell numbers and acronyms the way they should be spoken.
- Apply the Pronunciation list in
~/.content-skills/brand.md(e.g. a product name the voice mispronounces).
Errors
| Symptom | Action |
|---|---|
HEYGEN_AVATAR_ID is not set | Run the first-time setup above. |
401 | Key invalid or revoked. Tell the user. |
429 | Backs off automatically; if it persists, wait and retry once. |
status=failed + failure_code | Report it verbatim. Usually moderation on the script or a bad background URL. |
| Timed out after 20 minutes | Give the dashboard link https://app.heygen.com/videos/<id>; it may still finish. |


