For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
    • Overview
    • Usage for Agents
  • TypeScript SDK
    • Overview
      • Analytics
      • APIKeys
      • Byok
      • Chat
      • Credits
      • Embeddings
      • Endpoints
      • Generations
      • Guardrails
      • OAuth
      • Observability
      • Organization
      • Presets
      • Providers
      • Rerank
      • Beta.Responses
      • Transcriptions
      • Speech
      • VideoGeneration
      • Workspaces
  • Python SDK
    • Overview
  • Go SDK
  • DevTools
    • Overview
    • Migrating to @openrouter/agent
LogoLogo
ModelsChatRankingsDocs
On this page
  • Overview
  • Available Operations
  • generate
  • Example Usage
  • Standalone function
  • Parameters
  • Response
  • Errors
  • getGeneration
  • Example Usage
  • Standalone function
  • Parameters
  • Response
  • Errors
  • getVideoContent
  • Example Usage
  • Standalone function
  • Parameters
  • Response
  • Errors
  • listVideosModels
  • Example Usage
  • Standalone function
  • Parameters
  • Response
  • Errors
TypeScript SDKAPI Reference

VideoGeneration - TypeScript SDK

VideoGeneration method reference
Was this page helpful?
Previous

Workspaces - TypeScript SDK

Workspaces method reference
Next
Built with

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Overview

Video Generation endpoints

Available Operations

  • generate - Submit a video generation request
  • getGeneration - Poll video generation status
  • getVideoContent - Download generated video content
  • listVideosModels - List all video generation models

generate

Submits a video generation request and returns a polling URL to check status

Example Usage

1import { OpenRouter } from "@openrouter/sdk";
2
3const openRouter = new OpenRouter({
4 httpReferer: "<value>",
5 appTitle: "<value>",
6 appCategories: "<value>",
7 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
8});
9
10async function run() {
11 const result = await openRouter.videoGeneration.generate({
12 videoGenerationRequest: {
13 aspectRatio: "16:9",
14 duration: 8,
15 model: "google/veo-3.1",
16 prompt: "A serene mountain landscape at sunset",
17 resolution: "720p",
18 },
19 });
20
21 console.log(result);
22}
23
24run();

Standalone function

The standalone function version of this method:

1import { OpenRouterCore } from "@openrouter/sdk/core.js";
2import { videoGenerationGenerate } from "@openrouter/sdk/funcs/videoGenerationGenerate.js";
3
4// Use `OpenRouterCore` for best tree-shaking performance.
5// You can create one instance of it to use across an application.
6const openRouter = new OpenRouterCore({
7 httpReferer: "<value>",
8 appTitle: "<value>",
9 appCategories: "<value>",
10 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
11});
12
13async function run() {
14 const res = await videoGenerationGenerate(openRouter, {
15 videoGenerationRequest: {
16 aspectRatio: "16:9",
17 duration: 8,
18 model: "google/veo-3.1",
19 prompt: "A serene mountain landscape at sunset",
20 resolution: "720p",
21 },
22 });
23 if (res.ok) {
24 const { value: result } = res;
25 console.log(result);
26 } else {
27 console.log("videoGenerationGenerate failed:", res.error);
28 }
29}
30
31run();

Parameters

ParameterTypeRequiredDescription
requestoperations.CreateVideosRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.VideoGenerationResponse>

Errors

Error TypeStatus CodeContent Type
errors.BadRequestResponseError400application/json
errors.UnauthorizedResponseError401application/json
errors.PaymentRequiredResponseError402application/json
errors.NotFoundResponseError404application/json
errors.TooManyRequestsResponseError429application/json
errors.InternalServerResponseError500application/json
errors.OpenRouterDefaultError4XX, 5XX*/*

getGeneration

Returns job status and content URLs when completed

Example Usage

1import { OpenRouter } from "@openrouter/sdk";
2
3const openRouter = new OpenRouter({
4 httpReferer: "<value>",
5 appTitle: "<value>",
6 appCategories: "<value>",
7 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
8});
9
10async function run() {
11 const result = await openRouter.videoGeneration.getGeneration({
12 jobId: "job-abc123",
13 });
14
15 console.log(result);
16}
17
18run();

Standalone function

The standalone function version of this method:

1import { OpenRouterCore } from "@openrouter/sdk/core.js";
2import { videoGenerationGetGeneration } from "@openrouter/sdk/funcs/videoGenerationGetGeneration.js";
3
4// Use `OpenRouterCore` for best tree-shaking performance.
5// You can create one instance of it to use across an application.
6const openRouter = new OpenRouterCore({
7 httpReferer: "<value>",
8 appTitle: "<value>",
9 appCategories: "<value>",
10 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
11});
12
13async function run() {
14 const res = await videoGenerationGetGeneration(openRouter, {
15 jobId: "job-abc123",
16 });
17 if (res.ok) {
18 const { value: result } = res;
19 console.log(result);
20 } else {
21 console.log("videoGenerationGetGeneration failed:", res.error);
22 }
23}
24
25run();

Parameters

ParameterTypeRequiredDescription
requestoperations.GetVideosRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.VideoGenerationResponse>

Errors

Error TypeStatus CodeContent Type
errors.UnauthorizedResponseError401application/json
errors.NotFoundResponseError404application/json
errors.InternalServerResponseError500application/json
errors.OpenRouterDefaultError4XX, 5XX*/*

getVideoContent

Streams the generated video content from the upstream provider

Example Usage

1import { OpenRouter } from "@openrouter/sdk";
2
3const openRouter = new OpenRouter({
4 httpReferer: "<value>",
5 appTitle: "<value>",
6 appCategories: "<value>",
7 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
8});
9
10async function run() {
11 const result = await openRouter.videoGeneration.getVideoContent({
12 jobId: "job-abc123",
13 });
14
15 console.log(result);
16}
17
18run();

Standalone function

The standalone function version of this method:

1import { OpenRouterCore } from "@openrouter/sdk/core.js";
2import { videoGenerationGetVideoContent } from "@openrouter/sdk/funcs/videoGenerationGetVideoContent.js";
3
4// Use `OpenRouterCore` for best tree-shaking performance.
5// You can create one instance of it to use across an application.
6const openRouter = new OpenRouterCore({
7 httpReferer: "<value>",
8 appTitle: "<value>",
9 appCategories: "<value>",
10 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
11});
12
13async function run() {
14 const res = await videoGenerationGetVideoContent(openRouter, {
15 jobId: "job-abc123",
16 });
17 if (res.ok) {
18 const { value: result } = res;
19 console.log(result);
20 } else {
21 console.log("videoGenerationGetVideoContent failed:", res.error);
22 }
23}
24
25run();

Parameters

ParameterTypeRequiredDescription
requestoperations.ListVideosContentRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response

Promise<ReadableStream<Uint8Array>>

Errors

Error TypeStatus CodeContent Type
errors.BadRequestResponseError400application/json
errors.UnauthorizedResponseError401application/json
errors.NotFoundResponseError404application/json
errors.InternalServerResponseError500application/json
errors.BadGatewayResponseError502application/json
errors.OpenRouterDefaultError4XX, 5XX*/*

listVideosModels

Returns a list of all available video generation models and their properties

Example Usage

1import { OpenRouter } from "@openrouter/sdk";
2
3const openRouter = new OpenRouter({
4 httpReferer: "<value>",
5 appTitle: "<value>",
6 appCategories: "<value>",
7 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
8});
9
10async function run() {
11 const result = await openRouter.videoGeneration.listVideosModels();
12
13 console.log(result);
14}
15
16run();

Standalone function

The standalone function version of this method:

1import { OpenRouterCore } from "@openrouter/sdk/core.js";
2import { videoGenerationListVideosModels } from "@openrouter/sdk/funcs/videoGenerationListVideosModels.js";
3
4// Use `OpenRouterCore` for best tree-shaking performance.
5// You can create one instance of it to use across an application.
6const openRouter = new OpenRouterCore({
7 httpReferer: "<value>",
8 appTitle: "<value>",
9 appCategories: "<value>",
10 apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
11});
12
13async function run() {
14 const res = await videoGenerationListVideosModels(openRouter);
15 if (res.ok) {
16 const { value: result } = res;
17 console.log(result);
18 } else {
19 console.log("videoGenerationListVideosModels failed:", res.error);
20 }
21}
22
23run();

Parameters

ParameterTypeRequiredDescription
requestoperations.ListVideosModelsRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.VideoModelsListResponse>

Errors

Error TypeStatus CodeContent Type
errors.BadRequestResponseError400application/json
errors.InternalServerResponseError500application/json
errors.OpenRouterDefaultError4XX, 5XX*/*