← Back to dashboard

Runway Integration Guide

What is Runway?

The real model

@runwayml/sdk, server-side only: no webhooks, so submit, store the id, poll from a worker, re-host.

Don't call waitForTaskOutput() in a Vercel handler: it waits up to 10 minutes against a 300-second function default, and aborting it doesn't cancel the task or stop the spend (use tasks.delete). Output URLs expire in 24-48 hours, so copy them to R2 or Blob. Moderation arrives as status FAILED rather than an HTTP error, costs credits, and repeated hits can suspend the project, so screen prompts first. Narrow on status before reading failureCode. For Kenya-targeted products, buy credits in USD, quote KES after conversion, and deliver a compressed 480p or 720p copy for 2G/3G and WhatsApp.

Five Runway primitives

A task is the unit of work; everything else decides who picks the model and how many steps run.

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

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 appRunway Dev (this guide)
Who it's forCreators, in a browser or mobile appDevelopers, over an API
URLapp.runwayml.comPortal: dev.runway.com · API: https://api.dev.runwayml.com
Pays withRunway app plan and creditsProject credits at $0.01 each ($10 minimum purchase)
Agent accessGeneration MCP, mcp.runwayml.comDeveloper MCP, dev.runwayml.com/mcp

The API surface has six parts:

  • Direct generation: 12 core endpoints such as /v1/text_to_video, /v1/image_to_video, /v1/video_to_video, /v1/text_to_image, /v1/character_performance, and the audio endpoints.
  • Recipes: one call for a known job, such as a product ad, product swap, UGC clip, multi-shot video or ad localization.
  • Model Routers: a saved preference (cost, latency or quality) that picks the model for you.
  • Workflows: node graphs built in the Runway app and published as private, versioned endpoints.
  • Characters: real-time, WebRTC conversational avatars, with tool calling and knowledge documents.
  • Organization: credit balance, tier and usage for the project that owns the key.

Which one to reach for:

You want…Use
A polished product ad or similar known output, in one callRecipe
Not to hardcode a model ID that will age, or a hard per-generation price capModel Router
A multi-step pipeline your creative team edits without a code changeWorkflow
Full control over one model's parametersDirect model call
A live, talking agent on a pageCharacters

Official Documentation

ResourceURLWhat it covers
Agent primerhttps://docs.dev.runwayml.com/ai-context.mdAuth, task lifecycle, the whole surface, in one short file
Using the APIhttps://docs.dev.runwayml.com/guides/using-the-api/Worked Node, Python and HTTP examples
Modelshttps://docs.dev.runwayml.com/guides/models/Current model IDs; the only safe list
Per-model fieldshttps://docs.dev.runwayml.com/api.mdEvery endpoint's allowed values by model
OpenAPI spechttps://docs.dev.runwayml.com/openapi.jsonMachine-readable OpenAPI 3.1
Pricinghttps://docs.dev.runwayml.com/guides/pricing/Credit costs; the single source of truth
Task failureshttps://docs.dev.runwayml.com/errors/task-failures/failureCode values and retry rules
Go-live checklisthttps://docs.dev.runwayml.com/guides/go-live/Tiers, autobilling, key handling, monitoring
Changeloghttps://docs.dev.runwayml.com/api-details/api_changelog/New models and retirements
Product overviewhttps://runway.com/productThe 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.
Bash
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:

Bash
RUNWAYML_API_SECRET=your_api_key_here

Quickstart

TypeScript
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.
StatusMeaningDo
PENDING, RUNNINGIn progressKeep polling
THROTTLEDQueued behind your concurrency limit; not an errorKeep polling; alert if counts climb
SUCCEEDEDOnly this status has outputRe-host, then mark done
FAILEDHas failure and optional failureCodeClassify (below)
CANCELLEDCancelledMark cancelled

Three traps in the convenience helper:

  • waitForTaskOutput() waits 10 minutes by default. Vercel functions default to a 300-second limit, so don't wait inside a request handler.
  • A timeout or an aborted signal stops polling only. The task keeps running and billing unless you call tasks.delete(id).
  • DELETE /v1/tasks/{id} cancels a running task or deletes a finished one.

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:

ModelEndpointsNotable limits
gen4.5text, image to videoratio and duration required; ratio 1280:720 or 720:1280 on text to video; 2-10 s; 1,000-char prompt
gen4_turboimage to video onlyNo text-only mode
aleph2video to video onlyEdits existing footage
seedance2_5text, image, video to video4-30 s; up to 15,000-char prompt; draft mode
kling_4text, image, video to video3-30 s; 720p or 1080p; always has audio
veo3.1_fasttext, image to videoduration 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

MethodSize limitUse when
HTTPS URL16 MB image, 32 MB video or audioMedia is already hosted
Data URI5 MB encoded, about 3.3 MB of binarySmall images only
Ephemeral upload200 MB (512-byte minimum); URI valid 24 hLocal or large files; reusable
  • URLs must be HTTPS and return valid Content-Type and Content-Length headers. Redirects are not followed: a 3XX fails the request, so don't pass a URL that redirects.
  • GIF images aren't supported.
  • Inputs are auto-cropped to the target ratio, which can silently change the composition.
TypeScript
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:

failureCodeRetry?
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.TEXTNo
ASSET.INVALIDNo. 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.UNAVAILABLENot immediately; wait, then retry
INPUT_PREPROCESSING.INTERNAL, INTERNAL, or nullYes, 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.

ModelCredits5-second video
grok_imagine_1_5_lite 720p3/s, plus 1 for a start frame15 ($0.15)
gen4_turbo5/s25 ($0.25)
wan3 480p / 720p / 1080p5 / 10 / 20 per s25 / 50 / 100
gen4.512/s60 ($0.60)
kling_4 720p, no input video15.7/s; 12.56/s through 2026-11-30 UTC64 during the promotion
veo3.1_fast, audio / none15 / 10 per s75 / 50
seedance2_5 480p / 720p / 1080p20 / 30 / 68 per s, 80 minimum, plus input video100 / 150 / 340
aleph228/s, 56 minimum140 ($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.

TypeScript
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

  • workflows.run(id, { nodeOutputs }) starts an invocation. Keys are node ID, then output key (prompt, image, video, audio).
  • Poll workflowInvocations.retrieve(id), not tasks.retrieve.
  • Unknown node IDs and keys are ignored silently, so typos don't error.
  • A SUCCEEDED invocation can still contain failed nodes. Check nodeErrors and confirm every node you expect is in output.
  • A 400 can mean a node uses a retired model; a 404 can mean the key belongs to a different project.

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.

Bash
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.

TSX
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

ServerURLPurposeBilling
Runway Dev MCPhttps://dev.runwayml.com/mcp (Claude: /mcp/claude)Look up tasks, manage routers, read docsDeveloper account
Runway MCPhttps://mcp.runwayml.comCreate media in chatRunway app credits

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

Bash
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

  • Secrets: RUNWAYML_API_SECRET is server-side only, never NEXT_PUBLIC_*, and lives in Hazina or Vercel env. Use a separate key per environment and developer. If one leaks, disable it in the portal right away. Runway suggests git grep "key_" as a check; our gitleaks gate still runs first.
  • AI routing: Runway is a media provider, next to Claude for reasoning, OpenAI for structured output and HuggingFace for open models. Have Claude draft or clean a prompt, then send it to Runway. See ai-video/ for choosing among video providers, and put Runway behind that guide's adapter when a product may switch.
  • Direct vs AI SDK: use @runwayml/sdk directly for Runway-only features such as Aleph 2.0, Recipes, Routers, Workflows and Characters.
  • Hosting: store finished media in R2 or Vercel Blob. Vercel function bodies cap at 4.5 MB, so upload large inputs straight to storage, then pass Runway a non-redirecting HTTPS URL. Poll with a cron or queue, and never from a request handler.
  • Abuse: a public "generate" button spends real money. Require sign-in with Clerk, cap per-user spend, screen prompts, and watch the credit balance through organization.retrieve().
  • Data handling: the developer docs don't describe input retention or training. Confirm this in Runway's terms or an enterprise agreement before sending client-confidential footage. Never send PHI or patient images.
  • US-first default: Stripe charges your customers, and your Runway credits are a cost of goods. Price from the realized credits on the job, including re-renders and moderated attempts.
  • Kenya-targeted projects: the docs make no language claims for Swahili, so test any speech with native speakers. Runway generation is priced in credits bought in USD, so convert and cap costs before quoting KES prices through M-Pesa. Deliver a compressed 480p or 720p rendition with a poster image for 2G/3G and WhatsApp, and keep the master in storage.
  • Provenance: tell clients when a deliverable is AI-generated, and keep the prompt, model, task id and date with each asset. Moderation decisions and third-party model terms can change, so re-check before reusing an old pipeline.