
This ComfyUI workflow demonstrates end-to-end text- and image-to-video generation using the OpenAIVideoSora2 node, with optional synchronized audio. You can start from a text prompt alone or condition the video with a reference image loaded via LoadImage. Because Sora-2 and Sora-2 Pro expect fixed input sizes, the workflow offers two branches to make your image fit: Option 1 uses ResizeAndPadImage to letterbox without cropping, and Option 2 crops to fill the frame. PreviewImage lets you confirm framing before you trigger the API call, and SaveVideo writes the returned video to disk.
Technically, the OpenAIVideoSora2 node is the core of the graph, exposing model selection (Sora-2 or Sora-2 Pro), resolution, and prompt fields. The supported sizes are: Sora-2 (720x1280, 1280x720) and Sora-2 Pro (720x1280, 1280x720, 1024x1792, 1792x1024). The workflow groups keep things organized: Upload image, Option1 - Pad image, and Option 2 - Crop image. MarkdownNote and Note nodes include usage and pricing links for the partner API. ImageScale and ResizeAndPadImage align your image to the chosen video size so the API accepts it, while SaveVideo captures the API’s output, including audio when available. This design helps you iterate quickly—preview the conditioned frame, adjust your prompt, then render.
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
FAQ













