Runway Integration Guide

Technology: runway · Category: ai · Last reviewed: 2026-11-01

Source: https://tech-stack.codeamanilabs.org/guide/runway

Insight:

Runway Dev is one API over Runway's own models (Gen-4.5, Aleph 2.0, Act-Two) and resold third-party video, image and audio models (Kling, Seedance, Veo, WAN, Grok, GPT Image, ElevenLabs), plus real-time Characters, Recipes, Model Routers and Workflows. Generation is asynchronous and there are NO webhooks: you submit, store the task id, poll, then copy the output to your own storage because output URLs expire in 24-48 hours. Request fields change per model, so never reuse a ratio or duration across models. For codeAmani, use the SDK server-side only, never hold a Vercel function open waiting on a render, and gate user prompts first because moderated generations still cost credits and repeated ones can suspend the account.

██████╗ ██╗   ██╗███╗   ██╗██╗    ██╗ █████╗ ██╗   ██╗
██╔══██╗██║   ██║████╗  ██║██║    ██║██╔══██╗╚██╗ ██╔╝
██████╔╝██║   ██║██╔██╗ ██║██║ █╗ ██║███████║ ╚████╔╝
██╔══██╗██║   ██║██║╚██╗██║██║███╗██║██╔══██║  ╚██╔╝
██║  ██║╚██████╔╝██║ ╚████║╚███╔███╔╝██║  ██║   ██║
╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝ ╚══╝╚══╝ ╚═╝  ╚═╝   ╚═╝

Runway Integration Guide

Focus: generate video, images and audio through Runway Dev from a server, without losing work to expiring URLs or credits to moderation, and know when to use a Recipe, a Model Router, a Workflow or real-time Characters instead of a single model call.

Overview

Runway has two products that are easy to confuse:

Runway app Runway Dev (this guide)
Who it's for Creators, in a browser or mobile app Developers, over an API
URL app.runwayml.com Portal: dev.runway.com · API: https://api.dev.runwayml.com
Pays with Runway app plan and credits Project credits at $0.01 each ($10 minimum purchase)
Agent access Generation MCP, mcp.runwayml.com Developer MCP, dev.runwayml.com/mcp

The API surface has six parts:

Which one to reach for:

You want… Use
A polished product ad or similar known output, in one call Recipe
Not to hardcode a model ID that will age, or a hard per-generation price cap Model Router
A multi-step pipeline your creative team edits without a code change Workflow
Full control over one model's parameters Direct model call
A live, talking agent on a page Characters

Official Documentation

Resource URL What it covers
Agent primer https://docs.dev.runwayml.com/ai-context.md Auth, task lifecycle, the whole surface, in one short file
Using the API https://docs.dev.runwayml.com/guides/using-the-api/ Worked Node, Python and HTTP examples
Models https://docs.dev.runwayml.com/guides/models/ Current model IDs; the only safe list
Per-model fields https://docs.dev.runwayml.com/api.md Every endpoint's allowed values by model
OpenAPI spec https://docs.dev.runwayml.com/openapi.json Machine-readable OpenAPI 3.1
Pricing https://docs.dev.runwayml.com/guides/pricing/ Credit costs; the single source of truth
Task failures https://docs.dev.runwayml.com/errors/task-failures/ failureCode values and retry rules
Go-live checklist https://docs.dev.runwayml.com/guides/go-live/ Tiers, autobilling, key handling, monitoring
Changelog https://docs.dev.runwayml.com/api-details/api_changelog/ New models and retirements
Product overview https://runway.com/product The creator-facing product

Every docs page is also available as Markdown by appending .md to its path.

Setup

  1. Create a project at dev.runway.com.
  2. Create one API key per environment and per developer. The key is shown only once. Keys belong to the project, so removing a person does not revoke their key: disable it separately.
  3. Add credits ($10 minimum), then set up autobilling before launch.
npm install @runwayml/sdk
pip install runwayml

The Node SDK needs Node 18+. The Python package requires Python 3.9+ (PyPI metadata for 5.24.0; the SDK docs page still says 3.8). Versions checked on 2026-11-01: @runwayml/sdk 4.24.0, runwayml 5.24.0, @runwayml/avatars and @runwayml/avatars-react 0.17.0.

Environment variable, read automatically by both SDKs. It is server-side only:

RUNWAYML_API_SECRET=your_api_key_here

Quickstart

import RunwayML, { TaskFailedError, TaskTimedOutError } from "@runwayml/sdk";

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

try {
  const task = await client.textToVideo
    .create({
      model: "gen4.5",
      promptText: "A timelapse on a sunny day with clouds flying by",
      ratio: "1280:720",
      duration: 5,
    })
    .waitForTaskOutput({ timeout: 5 * 60 * 1000 });

  console.log(task.output[0]); // temporary URL: download it
} catch (error) {
  if (error instanceof TaskFailedError) {
    const details = error.taskDetails;
    console.error(details.status === "FAILED" ? details.failureCode : details.status);
  } else if (error instanceof TaskTimedOutError) {
    console.error("Still running. The task was not cancelled.");
  } else {
    throw error;
  }
}

Without an SDK, send Authorization: Bearer <key> and X-Runway-Version: 2024-11-06 on every request. A request without the version header fails.

This shape suits scripts. For a web app, use the job pattern in the next section.

Key patterns

Submit, store, poll, re-host

Runway has no webhooks: the docs never mention them and the OpenAPI callbacks object is empty. So the production flow is:

  1. Submit from a route handler and get back { id }. It does not contain the result.
  2. Store the task id immediately, against the user and the job.
  3. Poll tasks.retrieve(id) from a cron or queue worker, with backoff.
  4. On SUCCEEDED, copy the output to your own storage. Output URLs expire within 24-48 hours, and Runway says not to expose them in your product.
Status Meaning Do
PENDING, RUNNING In progress Keep polling
THROTTLED Queued behind your concurrency limit; not an error Keep polling; alert if counts climb
SUCCEEDED Only this status has output Re-host, then mark done
FAILED Has failure and optional failureCode Classify (below)
CANCELLED Cancelled Mark cancelled

Three traps in the convenience helper:

The docs describe no idempotency key, so treat a create call as non-idempotent. See PATTERNS.md for the full job flow.

Request fields are per model

Bodies are discriminated unions on model. Ratios, durations, prompt limits and even which fields are required all change between models:

Model Endpoints Notable limits
gen4.5 text, image to video ratio and duration required; ratio 1280:720 or 720:1280 on text to video; 2-10 s; 1,000-char prompt
gen4_turbo image to video only No text-only mode
aleph2 video to video only Edits existing footage
seedance2_5 text, image, video to video 4-30 s; up to 15,000-char prompt; draft mode
kling_4 text, image, video to video 3-30 s; 720p or 1080p; always has audio
veo3.1_fast text, image to video duration is 4, 6 or 8 only

Look the exact model up in api.md before building a body. Router endpoints differ again: they take aspectRatio: "16:9", not ratio: "1280:720", and the two are not interchangeable.

Retired IDs error out: gen3a_turbo (use gen4.5 or gen4_turbo) and gen4_aleph (use aleph2).

Supplying input media

Method Size limit Use when
HTTPS URL 16 MB image, 32 MB video or audio Media is already hosted
Data URI 5 MB encoded, about 3.3 MB of binary Small images only
Ephemeral upload 200 MB (512-byte minimum); URI valid 24 h Local or large files; reusable
import { createReadStream } from "node:fs";
import RunwayML from "@runwayml/sdk";

const client = new RunwayML();
const { uri } = await client.uploads.createEphemeral({
  file: createReadStream("./clip.mp4"),
});
// uri is runway://... and works anywhere a URL does

Docs bug, checked against SDK 4.24.0: the uploads page shows createEphemeral(myFile), but the method destructures { file }. The bare form fails type checking and has no file to upload, so always pass the object.

Failures and retries

HTTP errors: retry 429, 502, 503 and 504 with exponential backoff and up to 50% jitter (the SDKs do this for you). Never retry 400, 401, 404 or 405. A 429 on task creation means you've hit the rolling 24-hour generation limit. There is no requests-per-minute limit, and excess submissions queue as THROTTLED, so you don't need client-side rate limiting for Runway's sake.

Task failures arrive as status: "FAILED", not as an HTTP error:

failureCode Retry?
SAFETY.INPUT.*, SAFETY.OUTPUT.* No. Credits are not refunded for SAFETY.INPUT.*. Don't show the code to users; it is diagnostic only
INPUT_PREPROCESSING.SAFETY.TEXT No
ASSET.INVALID No. Fix the input's dimensions, duration or format
INTERNAL.BAD_OUTPUT.* After changing the input. Common causes: logos, watermarks or overlaid text in inputs; asking for rendered text; "write a prompt for…"
THIRD_PARTY.UNAVAILABLE Not immediately; wait, then retry
INPUT_PREPROCESSING.INTERNAL, INTERNAL, or null Yes, with a delay

Moderation

Moderated generations cost the same as successful ones, and too many moderated requests suspend the account. That one suspension would take down every app on the project, so screen user prompts before calling Runway. contentModeration.publicFigureThreshold: "low" relaxes public-figure checks; leave it at the default auto unless you have documented consent.

Costs

Reference rates from the pricing page on 2026-11-01. They change often, so check the page before quoting anyone. One credit is $0.01.

Model Credits 5-second video
grok_imagine_1_5_lite 720p 3/s, plus 1 for a start frame 15 ($0.15)
gen4_turbo 5/s 25 ($0.25)
wan3 480p / 720p / 1080p 5 / 10 / 20 per s 25 / 50 / 100
gen4.5 12/s 60 ($0.60)
kling_4 720p, no input video 15.7/s; 12.56/s through 2026-11-30 UTC 64 during the promotion
veo3.1_fast, audio / none 15 / 10 per s 75 / 50
seedance2_5 480p / 720p / 1080p 20 / 30 / 68 per s, 80 minimum, plus input video 100 / 150 / 340
aleph2 28/s, 56 minimum 140 ($1.40)

Also: muse_image 1 credit, gen4_image_turbo 2, gen4_image 5-8 per image. A full 5-minute Characters session is 102 credits (2 upfront, then 2 per 6 seconds). Professional formats add 5 credits/s (prores, png_sequence) or 20-40 credits/s (10-bit and HDR).

Seedance 2.5 draft mode: draft: true renders a 480p preview, and draftTaskId enhances a chosen one to 1080p within 7 days. For a 5-second clip, one preview plus enhance is 440 credits against 340 for going straight to 1080p. Drafts win only once you iterate: two attempts cost 540 against 680.

Limits

Limits are per model, per project, and set by a usage tier that rises automatically with spend. Most models in a modality use the same limit values, each counted separately, and Characters uses the video values. In the docs' example, Tier 3 runs 5 concurrent Gen-4.5 and 5 concurrent Veo 3.1 generations at once. Check your tier before launch: a low one will quietly queue users behind THROTTLED rather than fail.

Model Routers

Create a router in the Developer Portal, then send its configId instead of a model. You pay the chosen model's standard rate, with no surcharge, and each response reports the model and realized cost. Use /v1/generate/video, /image or /audio. A request nothing can satisfy fails with a no-eligible-model error.

import RunwayML from "@runwayml/sdk";

const client = new RunwayML();
const task = await client.generate.video
  .create({
    configId: "preview-fast",
    input: { promptText: "A red panda in a lantern-lit alley", aspectRatio: "16:9", duration: 5 },
  })
  .waitForTaskOutput();

Workflows

Characters (real-time avatars)

An Avatar is a saved persona: one reference image, a voice, a personality and knowledge. A Session is one live WebRTC call, capped at 5 minutes.

npm install @runwayml/avatars-react

The server creates the session and polls until READY, then your client connects. Session credentials can be retrieved only once; if the connection fails afterwards, create a new session. The server-side flow is in PATTERNS.md.

import { AvatarCall } from "@runwayml/avatars-react";
import "@runwayml/avatars-react/styles.css";

export function Call() {
  return <AvatarCall avatarId="your-avatar-id" connectUrl="/api/avatar/connect" />;
}

The connectUrl route can return either { sessionId, sessionKey }, and the SDK consumes the session for you, or { sessionId, serverUrl, token, roomName } if you consume it on the server, which saves a round trip.

MCP and agent tooling

Server URL Purpose Billing
Runway Dev MCP https://dev.runwayml.com/mcp (Claude: /mcp/claude) Look up tasks, manage routers, read docs Developer account
Runway MCP https://mcp.runwayml.com Create media in chat Runway app credits

Both use OAuth with no API key in the client config. For Claude Code:

claude mcp add --transport http --scope user runway-dev-mcp https://dev.runwayml.com/mcp/claude

Then run /mcp, select the server and authenticate in your own browser; Runway asks that agents not automate sign-in. Call whoami to confirm. The /mcp/claude endpoint can't create Characters. Runway also publishes a Runway Dev plugin and an agent skills repo.

codeAmani notes

Official docs: