Use HeyGen with invideo
HeyGen makes the AI avatar, the talking presenter, from a script. invideo adds what goes around that clip on a real timeline, with b-roll, text, music, captions and a branch for each variant.
When to use both
Use both when the avatar is one part of a bigger edit. The avatar renders in HeyGen. The finish happens in invideo.
- The presenter needs cutaways. Stock or generated b-roll covers the jumps and keeps the viewer's eye moving.
- The video needs a brand look. Titles, lower thirds and logo go on as text and image clips you can change later.
- You test variants. One avatar take, several hooks, shapes or end cards, each on its own branch.
- You want captions you can edit. Captions come from a transcript as a caption track, not burned into the picture.
- People and agents work on the cut together. In HeyGen's Single Editor Mode, one person edits a draft at a time and the others watch and comment. HeyGen's MCP, CLI and API make new videos, and they do not edit a draft a person has open. In invideo, you and your agent work in one cloud project at the same time, and you watch every edit land live.
Hand-off: from HeyGen into invideo
The avatar clip crosses as an MP4. The heygen CLI downloads a finished video by its id:
heygen video download <video-id> --output-path ./avatar.mp4<video-id> is the id HeyGen gives the finished video. HeyGen's CLI can also fetch a version with captions burned in (--asset captioned). Take the clean version, so the captions stay editable in invideo. You can also download the MP4 from the HeyGen app.
Then your agent brings it in:
- A public link.
add_mediawithmedia_url. - A file on your computer.
start_uploadwith thefile_name, a PUT of the bytes to theupload_url, thenadd_mediawith theupload_id. In a terminal,invideo asset upload <project-url> <file>. - A file in a chat app. You drag the file into the chat. It arrives through
fileonadd_media.
Each file becomes a sequence in the project, with its own sequence URL. On a timeline's URL, add_media also puts it in that timeline's media bin.
Then the finish:
- Place the avatar with
place_mediaandlinked_audioset to true, so the voice comes with the picture. - B-roll from
search_libraryinstock_video, or fromseedance_2_5.frameswithgenerate. The agent places it on the track above withplace_mediamodeplace_on_top. - Text with
add_text, styled withset_text_style. - Music from
search_libraryinstock_music, under the voice with theduckeraudio effect. - Captions with
mediaaudio.transcripton the avatar clip, thenadd_captionswith slides and words.
Hand-off: from invideo to HeyGen
The way back is an MP4. export with format video renders the timeline. Use the file wherever HeyGen takes an uploaded video, as HeyGen's own docs describe. For a project in Premiere Pro, Final Cut Pro or DaVinci Resolve instead, see Export to Premiere Pro, DaVinci Resolve or Final Cut Pro.
Steps
Your agent sets up with invideo for AI agents first. Then it runs these steps on a branch.
Edits and exports are free. Generation and transcripts cost credits. Paid stock costs a small credit charge, or one of your workspace's iStock licenses. Your agent runs a dry run first and tells you the price before it spends anything.
Your agent runs a dry run first. For any call that costs 1 credit or more, it tells you the price and waits for your yes. A call under 1 credit runs without asking, and your agent tells you what it cost.
Bring in the avatar clip
The agent calls
start_uploadandadd_mediaon the timeline URL. Expected result: a sequence URL and a media bin id.Lay down the presenter
The agent creates a branch with
timeline_history, then places the clip withplace_mediaandlinked_audio. Expected result: one video clip and its linked sound.Add b-roll, text and music
The agent searches
stock_videoandstock_musicwithsearch_library, tells you the cost of any paid item, adds the picks withadd_media, and places them withedit_timeline. Expected result: cutaways over the jumps, titles on screen, music under the voice.Pick and price the cutaway
The agent runs
find_modelswith the cutaway in words, picks one, and reads its inputs withget_model. A good pick isseedance_2_5.frames. Your agent can search for others withfind_models. It callsgeneratewithdry_run: trueand the real inputs, and tells you the price. Expected result: a price and no charge.Make the cutaway
For a price of 1 credit or more, the agent waits for your yes. Then it calls
generatewithmax_creditsset to that price and anidempotency_key. Expected result: a thread URL, then a sequence URL when the cutaway lands. The agent reads that URL withread, and never callsgenerateagain to check.Caption the voice
The agent prices
audio.transcriptwithdry_run, starts it, and calls again afterretry_after_sfor the words. Then it sendsadd_captions. Expected result: a caption clip with each word timed.Make the variants
The agent creates a branch per variant with
timeline_historyand changes the hook, shape or end card on each. Expected result: one branch URL per variant.Check and export
The agent calls
captureandcheck_timelineon each branch, thenexport. Expected result: an export card with statuscompletedper variant.
A missing shot from a terminal:
invideo agent register <project-url> --name <name>export INVIDEO_AS=<name>invideo gen models <project-url> --query "office cutaway, hands typing"invideo gen model <project-url> --model seedance_2_5.framesinvideo gen run <page-url> --model seedance_2_5.frames --dry-run \ -i prompt="office cutaway, hands typing"invideo gen run <page-url> --model seedance_2_5.frames \ -i prompt="office cutaway, hands typing" \ --max-credits <price> --idempotency-key shot-1<project-url> comes from invideo project new or list_projects. <name> is the name you choose in invideo agent register. <page-url> is a page that invideo notebook show <project-url> lists. <price> is the price the dry run returns.
The quick case, inside invideo
When you need a short talking clip and no HeyGen account, invideo runs HeyGen models and other avatar models with generate. Your agent prices each with dry_run first and follows the same steps as the cutaway.
heygen_photo_avatarturns one still photo and one audio clip into a talking video.heygen_video_1.generateis HeyGen Video as a model.heygen_lipsyncreplaces a video's sound and re-animates the speaker's lips to match.
The voice for a photo avatar comes from elevenlabs_text_to_speech.elevenlabs_tts_v4 with generate, priced with dry_run first.
When to stay in HeyGen
Stay in HeyGen when the job is the avatar itself.
- Your own trained avatar. HeyGen's Digital Twin is trained on your footage.
- Translation with the same face. HeyGen video translation translates and dubs its own avatar videos.
- Compositing elsewhere. HeyGen renders avatar videos with a transparent background as WebM.
- A new avatar video from a script. HeyGen's MCP, CLI and API make new avatar videos.
If something goes wrong
The table lists the failures this hand-off is known for.
| Symptom | Fix |
|---|---|
add_media with media_url is refused | The link must be public. Download the file, then upload it with start_upload and add_media with the upload_id. |
| Captions show twice on the avatar clip | The HeyGen download has captions burned in. Download the clean version, without --asset captioned. |
get_model or generate refuses the model as not found | Models retire. Run find_models with the job in words, use the best match, and tell the person which model you used. |
Avoid: call generate again to check on a run | Instead: read the thread or sequence URL with read. A second generate starts a second paid run. |