> ## Documentation Index
> Fetch the complete documentation index at: https://heygen-1fa696a7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Docs to Video

> Convert README files, knowledge base articles, and documentation into avatar-led explainer videos via the HeyGen API. One command, one rendered video.

## The Problem

Documentation is essential but most people don't read it. Video walkthroughs get significantly more engagement — but recording, editing, and keeping them in sync with doc changes costs more than most teams can justify.

## How It Works

```
Doc changes → LLM writes a video prompt → Video Agent renders → Embed or distribute
```

You don't send docs directly to Video Agent. An LLM converts documentation into a structured video prompt — acting as a video producer who reads the source material and writes production direction.

## Build It

**1. Extract the content**

```python theme={null}
# From a file
with open("README.md") as f:
    content = f.read()

# Or from a URL
import requests
content = requests.get(
    "https://raw.githubusercontent.com/your-org/repo/main/README.md"
).text
```

**2. Generate a video prompt with an LLM**

```python theme={null}
import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": f"""You are a video producer. Convert this documentation
into a HeyGen Video Agent prompt.

Structure as 3–5 scenes with timing. Open with a hook explaining what this
does and why it matters. Walk through key points visually. End with a next
step. Target: 60 seconds. Be specific about visuals.

Documentation:
{content}

Output ONLY the Video Agent prompt."""
    }],
)
video_prompt = message.content[0].text
```

> [!NOTE]
>
> **The two-stage pattern:** Content → LLM (writes production prompt) → Video Agent (renders). The LLM bridges the gap between "what the docs say" and "what the video should show."

**3. Submit to Video Agent**

```python theme={null}
resp = requests.post(
    "https://api.heygen.com/v3/video-agents",
    headers={
        "X-Api-Key": HEYGEN_API_KEY,
        "Content-Type": "application/json",
    },
    json={"prompt": video_prompt},
)
video_id = resp.json()["data"]["video_id"]
```

Optionally attach screenshots or diagrams as [file inputs](https://heygen-1fa696a7.mintlify.site/docs/video-agent.md#file-input-formats). Then poll for completion.

## CI/CD Integration

Trigger video generation automatically when documentation changes:

```yaml theme={null}
# .github/workflows/docs-video.yml
name: Generate Doc Video
on:
  push:
    paths: ['docs/**', 'README.md', 'CHANGELOG.md']

jobs:
  generate-video:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Generate video
        env:
          HEYGEN_API_KEY: ${{ secrets.HEYGEN_API_KEY }}
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: python scripts/generate-doc-video.py
```

> [!WARNING]
>
> Store API keys as [GitHub encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets). Never commit them.

## Variations

* **Changelog videos:** "Here's what's new in v2.3" — generate for each release
* **API docs:** Walk through new endpoints or breaking changes visually
* **Onboarding:** Auto-generate "Getting Started" videos from quickstart guides
* **Multi-language:** Generate, then [translate](https://heygen-1fa696a7.mintlify.site/multilingual-content) for international docs

***

## Next Steps

> [card] [Content Repurposing](https://heygen-1fa696a7.mintlify.site/content-repurposing)
>
> Apply the same pattern to blog posts and articles.

> [card] [Automated Broadcast](https://heygen-1fa696a7.mintlify.site/automated-broadcast)
>
> Schedule video generation pipelines.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.