# How to add AI video generation to your app

> Add AI video generation to your app: use an API, pick models from several labs, plan for image inputs, run tasks in the background and compare platforms.

Author: Runway · Published: 2026-10-30 · Updated: 2026-10-30 · Source: https://dev.runway.com/learn/add-ai-video-generation-to-your-app

## Summary

You add AI video generation to an app by calling a video generation API from your backend and running each generation as a background task.\
\
The harder part is choosing the models: the leading video models come from different labs, and many clips also need an image model for their first frame.\
\
Runway Dev serves those video and image models on one API key, among them Seedance 2.5, Gemini Omni Flash 1.1, Kling and GPT Image 2.5, with the tools your coding agent needs to build the integration.\
\
This article walks through each decision, then what to look for in an AI video generation API.

An app with AI video lets its users turn something they already have into a clip: a sentence typed into a box, a product photo, a selfie or a video they uploaded. The same feature can make a different video for every user, every product or every market, on demand, where the app used to show a stock clip or nothing at all.

Here's a clip made from one sentence:

![A low-angle view of a wave breaking on an empty beach at sunrise, its foam rushing up the wet sand toward the camera](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/add-ai-video-generation-to-your-app-code-output-wave-900bd99c.mp4 'One text-to-video request to Seedance 2.5, with the sound generated with the picture.')

```text
Low-angle shot of a wave curling and breaking on an empty beach at sunrise, the foam rushing up the wet sand toward the camera. Audio: the wave crashing, the hiss of foam on the sand.
```

## AI video in an app runs on an API, not a self-hosted model

The leading video models, such as Seedance 2.5, Gemini Omni Flash 1.1, Kling and Veo 3.1, are offered only through an API: their makers don't publish the weights.

Self-hosting an open-weight video model is a project of its own. It takes GPUs sized for video and engineers who can serve, scale and queue a model, and the model often needs fine-tuning on your own data before its output is good enough to ship. Each new model version starts that work again.

An API moves all of that to the provider. Your backend sends a request, the provider renders the clip and you pay for the seconds generated. A new model becomes a new value in the request instead of a new server.

## Choose an AI video API with models from every major lab

The video models teams build with today come from different labs: [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api) from ByteDance, [Gemini Omni Flash 1.1](https://dev.runway.com/learn/gemini-omni-flash-1-1-api) and [Veo 3.1](https://dev.runway.com/learn/veo-3-1-api) from Google, [Kling](https://dev.runway.com/learn/kling-4-0-api) from Kuaishou, [Wan 3.0](https://dev.runway.com/learn/wan-3-0-api) from Alibaba and [MiniMax H3](https://dev.runway.com/endpoints/image_to_video?modelId=hailuo3) from MiniMax. Each one is strongest on different work, and every new release changes which one a team picks.

Calling each lab's own API means one account, one key, one bill and one request format per lab, and a new integration each time a different model fits better. An API platform that serves several labs' models puts them behind one key, so trying the next model is a change of model name.

For a business, every lab also means its own contract, data terms, IP coverage, security review and invoice, repeated with each new model. A [Runway Dev Enterprise](https://dev.runway.com/enterprise) agreement covers every model at once, new ones included on launch day: no training on your data across every provider, uncapped [IP indemnification](https://dev.runway.com/learn/ip-indemnification) that extends to other labs' models and zero data retention, with one security review and one invoice.

## Each use case in your app calls for different video models

Video models are not interchangeable. They differ in quality on a given job, in price per second, in clip length and resolution, in whether they make sound and in what they accept as input: a first and last frame, reference images or a video to edit. Each one also takes its own request body, so values that work for one model can fail on another.

The gaps are wide. Seedance 2.5 takes up to 30 reference images in one request, Wan 3.0 and Kling 4.0 take 10 and Gemini Omni Flash 1.1 takes 5, so a product shot from every angle or a full cast of characters fits on one model and not on another. Clip length varies as much: Veo 3.1 returns 4, 6 or 8 seconds and Gemini Omni Flash 1.1 up to 10, while Seedance 2.5, Wan 3.0 and Kling 4.0 go up to 30 seconds in one request.

Here, one Seedance 2.5 request took three reference images and put them in one shot:

![A classic red 1960s coupe with chrome bumpers on a plain gray studio floor](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/images/add-ai-video-generation-to-your-app/ref-car-170b819e.jpg '@Image1') ![An empty road winding along green sea cliffs above the ocean at golden hour](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/images/add-ai-video-generation-to-your-app/ref-road-cfd2c81b.jpg '@Image2') ![A white lighthouse with a red lantern room on a grassy headland above the sea](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/images/add-ai-video-generation-to-your-app/ref-lighthouse-15e9f24b.jpg '@Image3')

![Seen from a drone high behind it, the red coupe drives along the cliff road at golden hour toward the lighthouse on the far headland](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/add-ai-video-generation-to-your-app-references-coupe-a0d67081.mp4 'Three reference images, one Seedance 2.5 image-to-video request.')

```text
Drone shot from high behind: the red coupe from @Image1 drives along the cliff road from @Image2 at golden hour, following its curves toward the lighthouse from @Image3 on the far headland. The camera keeps the car small in the frame as it climbs the last bend. Audio: the engine humming, wind, waves on the rocks below.
```

Start from what your app should make for its users, then shortlist the models built for it:

| Use case                                                        | What your app makes                                                                             | Models to start with                                                                                                                                                                                               |
| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Product videos at scale](https://dev.runway.com/learn/generate-product-videos)       | A video for every product in a catalog, from its photos                                         | [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api), [Aleph 2.0](https://dev.runway.com/endpoints/video_to_video?modelId=aleph2), [Wan 3.0](https://dev.runway.com/learn/wan-3-0-api)                                                                |
| [UGC-style video ads](https://dev.runway.com/learn/generate-ugc-videos)               | A creator presenting the product to camera, in every hook and language                          | [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api), [Kling 4.0](https://dev.runway.com/learn/kling-4-0-api)                                                                                                                                         |
| [Real estate listing videos](https://dev.runway.com/learn/real-estate-listing-videos) | A video tour of a home from its listing photos, plus staged rooms and dusk views                | [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api), [Gemini Omni Flash 1.1](https://dev.runway.com/learn/gemini-omni-flash-1-1-api), [Nano Banana Pro](https://dev.runway.com/endpoints/text_to_image?modelId=gemini_image3_pro)                    |
| [Editing your users' videos](https://dev.runway.com/learn/edit-and-finish-video-api)  | A restyled, extended, dubbed or upscaled version of a clip someone uploads                      | [Gemini Omni Flash 1.1](https://dev.runway.com/learn/gemini-omni-flash-1-1-api), [Aleph 2.0](https://dev.runway.com/endpoints/video_to_video?modelId=aleph2), [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api), [Kling 4.0](https://dev.runway.com/learn/kling-4-0-api) |
| Cinematic content                                               | Film-grade shots, trailers and brand films, delivered as HDR masters                            | [Seedance 2.5](https://dev.runway.com/learn/seedance-2-5-api), with [Ruby](https://dev.runway.com/learn/what-is-hdr-video) converting the result to HDR                                                                                                        |
| Personalized videos                                             | A clip made for each user from their own photo or prompt, such as a greeting or a profile video | [MiniMax H3](https://dev.runway.com/endpoints/image_to_video?modelId=hailuo3), [Wan 3.0](https://dev.runway.com/learn/wan-3-0-api), [Gemini Omni Flash 1.1](https://dev.runway.com/learn/gemini-omni-flash-1-1-api)                                            |

Choosing the right model is a full-time job: it means testing every model on each of your use cases with your own inputs, and testing again whenever a new model ships, since a model that leads a benchmark can still lose on your content. Without a [Model Router](https://dev.runway.com/learn/choosing-the-right-model), it's impossible to know which model each request should go to. A Model Router on Runway Dev picks the model for each request from rules you set, such as what to optimize for (cost, quality or latency), a credit ceiling and the models allowed.

We see teams default to Seedance 2.5 for every request. In Runway's [double-blind study of 250 image-to-video prompts](https://runway.com/news/developers/evaluating-runway-model-router), that default meant paying too much for no significant jump in quality: a Model Router set to optimize for quality spent 29% less than Seedance 2.5 on every prompt for the same top-model quality, and adding a $1 cost cap cut spend by 66% at 95% of that quality.

## AI video often starts from an image, so plan for image generation

A video model does its best work when an image tells it what the scene looks like. Apps use image generation for:

- **The first frame**, generated from the user's text, then animated.
- **The first and last frame**, so the clip lands exactly where it should.
- **Reference images** that keep a product, a character or a brand style the same from one clip to the next.
- **Edits before animating**, such as a new background behind a product photo.
- **Storyboards**, one still per shot, approved before any video is rendered.

That makes image models part of the video feature, and they need to sit in the same API. Here, [GPT Image 2.5](https://dev.runway.com/endpoints/text_to_image?modelId=gpt_image_2_5_sunburst) made the first frame and Seedance 2.5 animated it:

![A white paper boat resting in a rain-filled cobblestone gutter on an overcast morning](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/images/add-ai-video-generation-to-your-app/boat-first-frame-39213bf0.jpg 'First frame')

![The paper boat drifts along the rain-filled gutter, rocking over ripples as raindrops land around it](https://d3phaj0sisr2ct.cloudfront.net/devportal/learn/add-ai-video-generation-to-your-app-first-frame-boat-264051de.mp4 'A GPT Image 2.5 still, animated by Seedance 2.5 from that first frame.')

```text
The paper boat drifts along the gutter with the flowing rainwater, rocking over small ripples as raindrops land in the puddles around it. The camera follows it low to the ground. Audio: steady rain, trickling water.
```

## Video generation runs as a background task

A clip can take minutes to render, longer than a web request should stay open. Video APIs are asynchronous for that reason: the request returns a task ID right away, and the backend collects the video when the task finishes.

On Runway Dev, the request handler starts the task and saves its ID, and a worker waits for it and stores the file. The official SDKs for Node.js (`@runwayml/sdk`) and Python (`runwayml`) wait for you with `waitForTaskOutput()` and `wait_for_task_output()`:

```js
import RunwayML from '@runwayml/sdk';

const client = new RunwayML(); // reads RUNWAYML_API_SECRET

// In the request handler: start the task and answer at once with its id.
export async function startVideo(promptText) {
  const { id } = await client.textToVideo.create({
    model: 'seedance2_5',
    promptText,
    ratio: '1280:720',
    duration: 5,
  });
  return id; // save it with the job, then respond
}

// In a worker, or after a restart: pick the task up again from its id.
export async function finishVideo(id) {
  // A queued or long task can outlast the default 10-minute wait. If it still
  // times out, TaskTimedOutError is thrown: retry the job later.
  const task = await client.tasks
    .retrieve(id)
    .waitForTaskOutput({ timeout: 30 * 60 * 1000 });
  // Output URLs expire, so copy the file to your own storage here.
  const response = await fetch(task.output[0]);
  if (!response.ok) throw new Error(`Download failed: ${response.status}`);
  return Buffer.from(await response.arrayBuffer());
}
```

Four details keep the feature reliable:

- **Store the file, not the link.** Output URLs expire within 24 to 48 hours.
- **Treat `THROTTLED` as queued.** A task beyond your project's concurrency limit waits its turn and starts on its own, so a batch can go out all at once.
- **Handle `FAILED` by its `failureCode`.** Content moderation shows up as a failed task, and the [task failures guide](https://docs.dev.runwayml.com/errors/task-failures/) says which codes are worth a retry.
- **Poll every five seconds or more** if you poll `GET /v1/tasks/{id}` yourself, since a task's status doesn't update faster than that.

## Know what each video will cost before it runs

AI video pricing is rarely one number. Each model sets its own rules, and the same model can be priced differently from one platform to the next, so the cost of a clip is hard to predict before it runs:

- **Resolution changes the rate.** Most video models charge more per second at higher resolutions.
- **Sound can cost extra.** Some models charge more per second when they generate audio with the picture.
- **Inputs can add charges.** Some models bill reference videos by the second or add a charge for each reference image, on top of the output.
- **Minimums apply.** Many models bill a minimum duration, so a clip shorter than that minimum is charged as if it lasted that long.
- **Platforms price the same model their own way**, per second, per clip or in tokens computed from resolution and length. fal bills Seedance 2.5 in tokens, about $1.16 per second at 1080p, while Runway Dev bills the same model per second at $0.68, so a 10-second 1080p clip costs about $11.64 on fal and $6.80 on Runway Dev, 42% less (prices on November 2, 2026).

Runway Dev bills every video model per second of output, in credits drawn from one balance, and lists every model's rates in the [pricing guide](https://docs.dev.runwayml.com/guides/pricing/). To check a user's quota or your own budget before anything runs, work out the cost from those rates, or ask a Model Router: a `POST /v1/generate/video` request with the router's `configId`, a model-agnostic `input` and `"dryRun": true` returns the model it would pick and the estimated cost in `routing.estimatedCost`, without creating a task or charging anything. Once a generation request is sent, the task is created and returns `estimatedCost`, the most it can charge, and the finished task reports what it charged, which can be lower.

## Build AI video generation into your app with a coding agent

A coding agent such as Claude Code, Codex, Cursor or Grok Bot can write this whole integration, but it starts from what it learned in training, which is months old. Model IDs get retired, request fields differ from one model to the next and new models keep shipping. An agent working from memory can call a model that no longer exists, send fields the model rejects or store output links that expire.

Runway Dev gives the agent what it needs to get those right. Through the [Runway Dev MCP](https://docs.dev.runwayml.com/guides/mcp/), it reads your account live: which models your project can call, the fields and limits each one accepts and what each costs today, so its requests match what each model accepts. When a task fails, it looks up the reason and fixes the cause instead of retrying blind. The Runway Dev skills teach it the patterns from this article, such as running generation as a background task and copying each output to your storage. The [Runway Dev plugin](https://docs.dev.runwayml.com/guides/plugin/) installs the MCP and the skills together.

Because every lab's models sit behind the same key, the agent doesn't have to hardcode one model into your app. It can set up a Model Router through the MCP so each request goes to the right model under your rules, or call a Recipe or a Workflow where one already does the job.

## What to look for in an AI video generation API

Compare AI video generation APIs on what your app will need once it's live. Runway Dev covers each:

- **Video, image and audio models from every lab.** Seedance 2.5, Gemini Omni Flash 1.1, Kling 4.0, Veo 3.1, Wan 3.0 and MiniMax H3 for video, with Runway's own Aleph 2.0 for editing existing video. GPT Image 2.5, [Nano Banana 2.1](https://dev.runway.com/learn/nano-banana-2-1-api) and Seedream 5 for first frames and references. ElevenLabs voices and sound effects for audio. All on one key, one credit balance and one bill.
- **Automatic model selection.** [Model Routers](https://dev.runway.com/model-routers) pick the model for each request from your rules and report which model they picked and its estimated cost.
- **Coding agent support.** Any coding agent that connects to MCP servers can use the Runway Dev MCP and skills to build the integration against your live account.

Your app can now offer AI video built on the best model for each job, through one API.

## FAQ

**How do I add AI video generation to my app?**

Call a video generation API from your backend, run each generation as a background task and store the video. With Runway Dev, one API key reaches Seedance 2.5, Gemini Omni Flash 1.1, Kling, Veo 3.1 and the image models, and a coding agent builds it through the Runway Dev MCP.

**Can a coding agent add AI video generation to my app for me?**

Yes. Connect Claude Code, Codex, Cursor or Grok Bot to the Runway Dev MCP, install the Runway Dev skills and describe the feature. The agent picks the model against your live catalog, writes the background task and storage and looks up a failed task's reason itself.

**How much does it cost to add AI video generation to an app?**

You pay per second of video, at a rate that depends on the model, resolution and sound. The [pricing guide](https://docs.dev.runwayml.com/guides/pricing/) lists every model's rate, and a Model Router dry run returns the estimated cost of a request without creating a task. Each created task reports `estimatedCost`, its maximum charge.

**Do I need separate APIs for AI images and AI video?**

On Runway Dev, the same API key and credit balance cover video, image and audio models, so a first frame from GPT Image 2.5 or Nano Banana 2.1 feeds a Seedance 2.5 clip in the same integration.

**Can I change video models later without rewriting my app?**

Yes. On Runway Dev, changing models is a different `model` value, and its request fields are listed for each model. With a Model Router, your code sends the router's `configId` and a model-agnostic `input` to `POST /v1/generate/video` instead, and you change the models it may use in the router.
