Vercel AI SDK

Drop VideoGen tools into any Vercel AI SDK agent.

@videogen/ai-tool is the official Vercel AI SDK tool package for VideoGen. One call returns the full set of VideoGen tools in AI SDK format, ready to drop into generateText, streamText, or an Agent. Your agent can turn a script into a finished narrated video, plus generate standalone images, video clips, voiceovers, sound effects, music, and talking-head avatars.

Every tool wraps the official @videogen/sdk and runs as the team that owns your API key.

Install

$npm install @videogen/ai-tool ai zod

ai (the Vercel AI SDK) and zod are peer dependencies.

Setup

Get an API key from app.videogen.io/developers and set it as VIDEOGEN_API_KEY:

$export VIDEOGEN_API_KEY="sk_videogen_live_..."

Usage

1import { openai } from "@ai-sdk/openai";
2import { generateText, stepCountIs } from "ai";
3import { createVideogenTools } from "@videogen/ai-tool";
4
5const tools = createVideogenTools();
6
7const result = await generateText({
8 model: openai("gpt-4o"),
9 tools,
10 stopWhen: stepCountIs(10),
11 prompt: "Make a short narrated video explaining why staying hydrated matters.",
12});
13
14console.log(result.text);

By default each tool blocks until the workflow run or tool execution reaches a terminal state (succeeded, failed, or cancelled) and returns the finished result.

Options

createVideogenTools reads VIDEOGEN_API_KEY from the environment by default. Pass options to override:

1import { VideoGen } from "@videogen/sdk";
2import { createVideogenTools } from "@videogen/ai-tool";
3
4const tools = createVideogenTools({
5 client: new VideoGen({ apiKey: process.env.VIDEOGEN_API_KEY }),
6 wait: false,
7 include: ["scriptToVideo", "generateImage", "textToSpeech"],
8});
OptionDefaultDescription
clientA pre-configured VideoGen.
apiKeyVIDEOGEN_API_KEYAPI key used to build a client when client is omitted.
baseUrlVIDEOGEN_BASE_URL or https://api.videogen.ioOverride the API base URL.
waittrueBlock until the operation finishes and return the result. Set false to return immediately with the run/execution id.
pollIntervalMsHow often to poll while waiting, in milliseconds.
timeoutMsMaximum time to wait for a terminal state before giving up, in milliseconds.
includeall toolsRestrict the returned tool set to these tool names.

When wait is false, use the matching get* tool (e.g. getWorkflowRun, getToolExecution) to poll the returned id yourself.

Tools

The package returns 34 tools. Tool names are camelCase (e.g. scriptToVideo, generateImage); parameters match the corresponding VideoGen SDK method.

  • Workflows (end-to-end video): scriptToVideo, voiceoverToVideo, slideshowToVideo, storyboardToVideo, listWorkflowRuns, getWorkflowRun, cancelWorkflowRun
  • Media generation: generateImage, generateVideoClip, textToSpeech, generateSoundEffect, generateMusic, generateMotionGraphic, generateAvatar, vectorizeImage, removeImageBackground, removeVideoBackground, upscaleImage, upscaleVideo, image3dEffect, listToolExecutions, getToolExecution, cancelToolExecution
  • Projects: listProjects, getProject, exportProject, remixProject, listProjectRemixActions
  • Files: uploadFile, getFile, listFiles
  • Resources & account: listAvatarPresenters, listTtsVoices, listLanguages, getMe

For the full parameter list of each tool, see the MCP server reference — the same tools are exposed there — and the REST API reference.