> ## Documentation Index
> Fetch the complete documentation index at: https://heygen-1fa696a7.mintlify.app/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

<Steps>
  <Step title="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
    ```
  </Step>

  <Step title="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
    ```

    <Info>
      **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."
    </Info>
  </Step>

  <Step title="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](/docs/video-agent#file-input-formats). Then poll for completion.
  </Step>
</Steps>

## 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.
</Warning>

## 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](/cookbook/video-agent/multilingual-content) for international docs

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Content Repurposing" icon="recycle" href="/cookbook/video-agent/content-repurposing">
    Apply the same pattern to blog posts and articles.
  </Card>

  <Card title="Automated Broadcast" icon="tower-broadcast" href="/cookbook/video-agent/automated-broadcast">
    Schedule video generation pipelines.
  </Card>
</CardGroup>
