Run a workflow

Start a workflow and wait for the finished video.

A workflow runs the full generation pipeline and creates a VideoGen project. This is the first step of every video. Pick the workflow that matches your input, start it with one call, then wait for the run to finish.

WorkflowInputEndpoint
Script to videoA scriptPOST /v1/workflows/script-to-video
Voiceover to videoAn uploaded audio filePOST /v1/workflows/voiceover-to-video
Slideshow to videoAn uploaded PDF or slideshowPOST /v1/workflows/slideshow-to-video

Start and wait

Start the workflow, then poll the run until status is terminal. The SDK helpers pollWorkflowRun (TS) and poll_workflow_run (Python) loop for you.

import { VideoGen, pollWorkflowRun } from "@videogen/sdk";
const client = new VideoGen({ apiKey: "sk_videogen_live_..." });
const { workflowRunId, projectId } = await client.workflows.scriptToVideo({
script:
"Staying hydrated keeps your body and mind running at their best. Drinking enough water boosts your energy, focus, and mood. Keep a water bottle nearby and sip throughout the day.",
visualStyle: {
type: "AI_IMAGE",
aiStyle: "Loose watercolor illustration, visible brushstrokes, soft color bleeds, paper texture, muted palette. A clear uncluttered subject centered in the frame, occupying only the middle half of the image, with generous empty margins on all four sides, no background clutter.",
},
quality: "HIGH",
autoExport: true,
remixActions: [
{ type: "ENABLE_CAPTIONS" },
{
type: "CONVERT_IMAGES_TO_VIDEOS",
motionPrompt: "slow cinematic push-in",
muteOutputVideos: true,
quality: "HIGH",
},
],
});
const run = await pollWorkflowRun({ client, workflowRunId });
console.log(run.downloadUrl);

The start response returns immediately with { workflowRunId, projectId, projectUrl, remixActionIds } and 202 Accepted. With autoExport: true, poll GET /v1/workflows/runs/{workflowRunId} until status is succeeded, then use downloadUrl for the MP4. projectId is for later remix or a second export. projectUrl is optional: a link to open the project in the VideoGen editor for manual review (team members and project collaborators only; see Workflows).

Choosing a visual style

Script and voiceover workflows accept a visualStyle: { type: "AI_IMAGE", aiStyle } for AI-generated images, where aiStyle is a free-form description of the look (see AI styles for example descriptions), { type: "STOCK" } for stock footage, or { type: "AI_IMAGE", entityId } to match a VISUAL_STYLE entity’s reference images.

Next steps