How to generate AI videos automatically using Codex

2026-03-12

+OpenAI
Codex is OpenAI's open-source coding agent that runs in your terminal. If you already use it for development, you can use it to create videos with Program too. Describe what you want, and Codex handles the rest through the Program CLI.

What you need

  • A Program account (free tier works)
  • The Program CLI installed (npm i -g @program-video/cli)
  • Codex CLI installed (npm i -g @openai/codex)
  • A ChatGPT Plus, Pro, or Enterprise account for Codex authentication

Give Codex the context

Codex reads project instructions from AGENTS.md files. Add the following to your project's AGENTS.md:

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 "Codex" button on program.video. Codex re-reads AGENTS.md before every interaction, so you can update instructions without restarting your session.

Approval modes

Codex has three modes that control how much autonomy it has. For video creation, Auto mode (the default) works well. It will read files, run CLI commands, and edit code in your working directory, but ask before anything that reaches outside your project.

If you want Codex to run the full workflow without interruption, you can use Full Access mode, but Auto is recommended for most use cases.

Build a video

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

You: Create a product demo video. Title card first, then three feature highlights with bullet points, and a closing call to action. 30 seconds total, dark theme.

Codex 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
  • What a scene looks like

    Each scene Codex creates 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 }}>
            Lightning Fast
          </h2>
          <ul style={{ color: "#a3a3a3", fontSize: 24, lineHeight: 1.8 }}>
            <li>Sub-second response times</li>
            <li>Global edge network</li>
            <li>Zero cold starts</li>
          </ul>
        </AbsoluteFill>
      );
    }

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

    Tips for better results

    • Be specific about timing. Tell Codex 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.
    • Iterate scene by scene. Ask Codex to read the composition, then tweak individual scenes rather than starting over.
    • 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

    This workflow is best for repeatable content: explainers, changelogs, social clips, product demos. Build a template once, then let Codex produce variations.

    For more on the CLI, see the documentation. For Codex setup, see the Codex CLI docs.