generateVideo()
Generates videos durably inside a workflow. The helper starts an asynchronous video generation job with a Workflow webhook URL, suspends the workflow until the provider sends a terminal notification, and then retrieves the completed result with one status request.
Unlike experimental_generateVideo
from ai, this helper does not download provider-hosted videos. URL results
remain URLs so your workflow can decide whether to persist, copy, or process
them in another step without serializing the video bytes through workflow step
boundaries.
import { experimental_generateVideo as generateVideo } from '@ai-sdk/workflow/video';
export async function videoWorkflow(prompt: string) { 'use workflow';
// The workflow suspends while the video renders, consuming no compute. const result = await generateVideo({ model: 'klingai/kling-v3.0-t2v', prompt, });
return result.videos;}The selected model must support asynchronous start and status operations and provider webhooks. The helper must be called from a Workflow SDK workflow.
Import
import { experimental_generateVideo as generateVideo } from "@ai-sdk/workflow/video"Parameters
The helper accepts the same parameters as experimental_startVideo from ai,
except webhookUrl and abortSignal. It creates and manages the webhook URL.
model:
prompt:
n?:
aspectRatio?:
resolution?:
duration?:
maxVideosPerCall?:
fps?:
seed?:
frameImages?:
inputReferences?:
generateAudio?:
providerOptions?:
headers?:
maxRetries?:
Returns
Returns the completed status result from the provider. videos contains raw
provider video data discriminated by type:
url: A provider-hosted URL and media typebase64: Base64-encoded video data and media typebinary: AUint8Arrayand media type
Hosted URLs can expire. Handle any video you need to retain in a separate workflow step.