|Docs

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_media with media_url.
  • A file on your computer. start_upload with the file_name, a PUT of the bytes to the upload_url, then add_media with the upload_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 file on add_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_media and linked_audio set to true, so the voice comes with the picture.
  • B-roll from search_library in stock_video, or from seedance_2_5.frames with generate. The agent places it on the track above with place_media mode place_on_top.
  • Text with add_text, styled with set_text_style.
  • Music from search_library in stock_music, under the voice with the ducker audio effect.
  • Captions with media audio.transcript on the avatar clip, then add_captions with 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.

  1. Bring in the avatar clip

    The agent calls start_upload and add_media on the timeline URL. Expected result: a sequence URL and a media bin id.

  2. Lay down the presenter

    The agent creates a branch with timeline_history, then places the clip with place_media and linked_audio. Expected result: one video clip and its linked sound.

  3. Add b-roll, text and music

    The agent searches stock_video and stock_music with search_library, tells you the cost of any paid item, adds the picks with add_media, and places them with edit_timeline. Expected result: cutaways over the jumps, titles on screen, music under the voice.

  4. Pick and price the cutaway

    The agent runs find_models with the cutaway in words, picks one, and reads its inputs with get_model. A good pick is seedance_2_5.frames. Your agent can search for others with find_models. It calls generate with dry_run: true and the real inputs, and tells you the price. Expected result: a price and no charge.

  5. Make the cutaway

    For a price of 1 credit or more, the agent waits for your yes. Then it calls generate with max_credits set to that price and an idempotency_key. Expected result: a thread URL, then a sequence URL when the cutaway lands. The agent reads that URL with read, and never calls generate again to check.

  6. Caption the voice

    The agent prices audio.transcript with dry_run, starts it, and calls again after retry_after_s for the words. Then it sends add_captions. Expected result: a caption clip with each word timed.

  7. Make the variants

    The agent creates a branch per variant with timeline_history and changes the hook, shape or end card on each. Expected result: one branch URL per variant.

  8. Check and export

    The agent calls capture and check_timeline on each branch, then export. Expected result: an export card with status completed per 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_avatar turns one still photo and one audio clip into a talking video.
  • heygen_video_1.generate is HeyGen Video as a model.
  • heygen_lipsync replaces 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.

SymptomFix
add_media with media_url is refusedThe 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 clipThe HeyGen download has captions burned in. Download the clean version, without --asset captioned.
get_model or generate refuses the model as not foundModels 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 runInstead: read the thread or sequence URL with read. A second generate starts a second paid run.