How to generate AI videos automatically using OpenCode

2026-03-12

+
OpenCode is an open-source coding agent that works with any LLM provider. Claude, OpenAI, Gemini, or local models. If you already use it for development, you can use it to create videos with Program. Add the context to your project and OpenCode handles everything through the CLI.

What you need

  • A Program account (free tier works)
  • The Program CLI installed (npm i -g @program-video/cli)
  • OpenCode installed (curl -fsSL https://opencode.ai/install | bash or npm i -g opencode-ai)
  • An LLM provider (connect via /connect in OpenCode, or set your own API keys)

Give OpenCode the context

OpenCode reads project instructions from AGENTS.md. Run /init in your project to scaffold one if you do not have one yet, then add the Program instructions:

AGENTS.mdAdd this to your project's AGENTS.md
You have access to Program (program.video), an AI video composition platform.
Use the CLI commands below to authenticate the user, manage projects, and build
video compositions.

## Getting Started

1. Run `npx @program-video/cli auth login` to authenticate (opens browser)
2. Run `npx @program-video/cli project create --title "Title"` to create a project
3. Use the tools below to build the video composition

## Commands

You can also copy this context by clicking the "OpenCode" button on program.video. OpenCode will pick this up automatically on the next interaction.

Choose your model

OpenCode is provider-agnostic. Use whatever model you prefer for video creation. Switch models at any time using the model selector in the TUI.

If you want to use OpenCode without managing API keys, their hosted option (OpenCode Zen) provides a curated model list out of the box.

Build a video

Start OpenCode in your project directory and ask it to create a video:

You: Create a product demo video. Title card, three feature highlights with icons, and a closing CTA. 30 seconds, dark minimal style.

OpenCode will:

  • Run auth login to authenticate you with Program
  • Create a new project via the CLI
  • Generate each scene as a React/Remotion component
  • Pass each scene to the CLI using addScene
  • Add voiceover with generateSpeech if you ask for narration
  • Using the Plan agent

    OpenCode has a built-in Plan agent (press Tab to switch) that can analyze your composition without making changes. This is useful for reviewing what has been built before asking the Build agent to make edits:

    You (Plan agent): Read the current composition and tell me what scenes exist and their durations.

    Then switch back to Build to make changes.

    What a scene looks like

    Each scene is a React component:

    import { AbsoluteFill } from "remotion";
    
    export default function FeatureSlide() {
      return (
        <AbsoluteFill
          style={{
            backgroundColor: "#0a0a0a",
            display: "flex",
            flexDirection: "column",
            justifyContent: "center",
            padding: 80,
          }}
        >
          <h2 style={{ color: "white", fontSize: 48, marginBottom: 32 }}>
            Zero Config Deploys
          </h2>
          <p style={{ color: "#a3a3a3", fontSize: 24, lineHeight: 1.8 }}>
            Push to main and your app is live. No build scripts, no CI pipelines, no
            infrastructure to manage.
          </p>
        </AbsoluteFill>
      );
    }

    You never write this yourself. OpenCode generates it from your description.

    Tips for better results

    • Be specific about timing. Tell OpenCode how long each scene should be and the total video length.
    • Describe visual style early. Say "dark background, white text, minimal" in your first message.
    • Use Plan to review. Switch to the Plan agent to analyze the composition before making edits.
    • Iterate scene by scene. Ask OpenCode to read the composition, then tweak individual scenes.
    • Use the desktop app for preview. The Program desktop app gives you a live preview as scenes are added.

    Rendering

    Once your composition is ready, open the Program desktop app or web editor to preview and render.

    On the desktop app, rendering happens locally on your hardware. No cloud queue, no upload wait.

    What comes next

    Since OpenCode works with any model, you can experiment with different providers to see which generates the best Remotion components for your use case. This workflow is best for repeatable content: explainers, changelogs, social clips, product demos.

    For more on the CLI, see the documentation. For OpenCode setup, see opencode.ai.