AI SDK 7 Provider with Video Generation
@llmgateway/ai-sdk-provider 4.0 targets Vercel AI SDK 7 and adds llmgateway.video() for experimental_generateVideo: the provider submits a gateway video job, the SDK polls it, and you get the MP4 bytes back, with image-to-video, first and last frames, reference inputs, and audio control. Stay on 3.x for AI SDK 6.

Generating video through the gateway from an AI SDK app meant dropping out of the SDK: call POST /v1/videos yourself, poll the job, fetch the content endpoint, and stitch the bytes back into your code. Version 4.0 of @llmgateway/ai-sdk-provider targets AI SDK 7 and brings video into the SDK's own API, next to text, images, tools, and structured output.
Generate Video in the SDK
1pnpm add @llmgateway/ai-sdk-provider@4 ai zod1pnpm add @llmgateway/ai-sdk-provider@4 ai zod1import { writeFile } from "node:fs/promises";2import { llmgateway } from "@llmgateway/ai-sdk-provider";3import { experimental_generateVideo as generateVideo } from "ai";4
5const { video } = await generateVideo({6 model: llmgateway.video("seedance-2-0"),7 prompt: "A cinematic aerial view of ocean waves at sunrise",8 duration: 8,9 resolution: "1280x720",10 poll: { intervalMs: 5_000, timeoutMs: 600_000 },11});12
13await writeFile("video.mp4", video.uint8Array);1import { writeFile } from "node:fs/promises";2import { llmgateway } from "@llmgateway/ai-sdk-provider";3import { experimental_generateVideo as generateVideo } from "ai";4
5const { video } = await generateVideo({6 model: llmgateway.video("seedance-2-0"),7 prompt: "A cinematic aerial view of ocean waves at sunrise",8 duration: 8,9 resolution: "1280x720",10 poll: { intervalMs: 5_000, timeoutMs: 600_000 },11});12
13await writeFile("video.mp4", video.uint8Array);The provider creates the job, the SDK polls its status, and the result is downloaded through the authenticated content endpoint. Failed, canceled, and expired jobs throw. The job ID is available in providerMetadata.llmgateway.videos, and experimental_startVideo plus experimental_getVideoStatus let another process pick a job up later. Model IDs are plain strings, so new gateway video models work without a provider update.
Every Gateway Video Input
| SDK option | Gateway field |
|---|---|
duration | seconds (required) |
resolution | size, which also sets the aspect ratio |
generateAudio | audio |
prompt.image | image for image-to-video |
frameImages | image and last_frame |
inputReferences | reference_images, reference_videos |
n | One independent job per video |
providerOptions.llmgateway | Any other field, such as callback URLs |
aspectRatio, fps, and seed are not forwarded and produce unsupported-setting warnings instead of silent drops. Supported sizes and durations depend on the model; the gateway validates them and returns 400 for combinations a provider cannot serve.
What Changed Under the Hood
Chat, completion, and image models now implement the SDK's v4 interfaces, including tagged file inputs and outputs, and completion models get corrected default tool-choice handling and text-stream lifecycle events. The package ships as ESM with shared runtime classes across its entry points.
Breaking: 4.x requires Node.js 22 or later, ESM imports, and AI SDK 7.0.93 or later. Projects on AI SDK 6 should stay on @llmgateway/ai-sdk-provider@3.