Runway API Skill
Generate AI videos, images, and audio using Runway's API. Features Gen-4.5 — Runway's latest and most capable model — supporting both text-to-video and image-to-video generation, plus Gen-4 variants and third-party models from Google (Veo) and ElevenLabs.
Setup
- 1. Get your API key from dev.runwayml.com
- Store it as
RUNWAYML_API_SECRET in your environment - Install the Node.js SDK: INLINECODE1
Quick Start
Text-to-Video (gen4.5)
CODEBLOCK0
Image-to-Video (gen4.5)
CODEBLOCK1
cURL (direct API)
CODEBLOCK2
Available Models
Video Generation
| Model | Input | Credits/sec | Notes |
|---|
gen4.5 ⭐ | Text or Image | 12 | Newest & recommended |
| INLINECODE3 |
Image only | 5 | Fast I2V iteration |
|
veo3.1 | Text or Image | 40 | Google Veo — includes audio |
|
veo3.1_fast | Text or Image | 15 | Veo — audio, cheaper |
|
gen4_aleph | Video + Text/Image | 15 | Video-to-video transformation |
|
act_two | Image or Video | 5 | Character performance/motion |
Image Generation
| Model | Credits | Notes |
|---|
| INLINECODE8 | 5–8/image | High quality, supports style references |
| INLINECODE9 |
2/image | Fast iteration (requires reference image) |
Audio (ElevenLabs via Runway)
| Model | Output | Credits |
|---|
| INLINECODE10 | Text → Speech | 1/50 chars |
| INLINECODE11 |
Text → Sound FX | 1/6 sec |
|
eleven_voice_dubbing | Audio → Dubbed | 1/2 sec |
Valid Ratios
| Ratio | Format |
|---|
| INLINECODE13 | 16:9 landscape (standard) |
| INLINECODE14 |
9:16 portrait (Reels/Stories) |
|
1584:672 | 21:9 ultra-wide |
|
1104:832 | 4:3 |
|
832:1104 | 3:4 |
|
960:960 | Square |
Duration
- - gen4.5: 2–10 seconds
- gen4_turbo: 5 or 10 seconds
Task Polling
All operations are async. The SDK's .waitForTaskOutput() handles polling automatically (10 min timeout).
Statuses: PENDING → THROTTLED → RUNNING → SUCCEEDED / INLINECODE24
Manual poll:
CODEBLOCK3
Prompting Tips
- - Describe single scenes (5–10 sec clips)
- Use clear physical descriptions, not abstract concepts
- For camera movement: "slow dolly-in", "tracking shot", "push toward subject"
- Avoid negative phrasing — "no blur" produces unpredictable results
- Keep prompts grounded and physically plausible
Official Docs
Runway API 技能
使用 Runway 的 API 生成 AI 视频、图像和音频。支持 Gen-4.5——Runway 最新、最强大的模型——同时支持文本转视频和图像转视频生成,以及 Gen-4 变体模型和来自 Google(Veo)和 ElevenLabs 的第三方模型。
设置
- 1. 从 dev.runwayml.com 获取你的 API 密钥
- 将其作为 RUNWAYMLAPI_SECRET 存储在环境变量中
- 安装 Node.js SDK:npm install @runwayml/sdk
快速开始
文本转视频(gen4.5)
javascript
import RunwayML from @runwayml/sdk;
const client = new RunwayML(); // 自动读取 RUNWAYMLAPISECRET
const task = await client.textToVideo.create({
model: gen4.5,
promptText: 繁忙小贩中心里一碗热气腾腾的面条,暖光,镜头缓慢推进,
duration: 5,
ratio: 1280:720
}).waitForTaskOutput();
console.log(视频 URL:, task.output[0]);
图像转视频(gen4.5)
javascript
import RunwayML from @runwayml/sdk;
import fs from fs;
const client = new RunwayML();
const imageData = fs.readFileSync(product.jpg);
const promptImage = data:image/jpeg;base64,${imageData.toString(base64)};
const task = await client.imageToVideo.create({
model: gen4.5,
promptImage,
promptText: 缓慢推近产品罐,暖色侧光,透过玻璃可见酱汁闪烁,
duration: 5,
ratio: 1280:720
}).waitForTaskOutput();
console.log(视频 URL:, task.output[0]);
cURL(直接 API)
bash
文本转视频
curl -X POST https://api.dev.runwayml.com/v1/image
tovideo \
-H Authorization: Bearer $RUNWAYML
APISECRET \
-H X-Runway-Version: 2024-11-06 \
-H Content-Type: application/json \
-d {
model: gen4.5,
promptText: 日落时分宁静的山景,
ratio: 1280:720,
duration: 5
}
可用模型
视频生成
| 模型 | 输入 | 积分/秒 | 说明 |
|---|
| gen4.5 ⭐ | 文本或图像 | 12 | 最新且推荐 |
| gen4_turbo |
仅图像 | 5 | 快速 I2V 迭代 |
| veo3.1 | 文本或图像 | 40 | Google Veo — 包含音频 |
| veo3.1_fast | 文本或图像 | 15 | Veo — 含音频,更便宜 |
| gen4_aleph | 视频 + 文本/图像 | 15 | 视频到视频转换 |
| act_two | 图像或视频 | 5 | 角色表演/动作 |
图像生成
| 模型 | 积分 | 说明 |
|---|
| gen4image | 5–8/张 | 高质量,支持风格参考 |
| gen4image_turbo |
2/张 | 快速迭代(需要参考图像) |
音频(通过 Runway 的 ElevenLabs)
| 模型 | 输出 | 积分 |
|---|
| elevenmultilingualv2 | 文本 → 语音 | 1/50 字符 |
| eleventexttosoundv2 |
文本 → 音效 | 1/6 秒 |
| eleven
voicedubbing | 音频 → 配音 | 1/2 秒 |
有效比例
| 比例 | 格式 |
|---|
| 1280:720 | 16:9 横向(标准) |
| 720:1280 |
9:16 纵向(Reels/Stories) |
| 1584:672 | 21:9 超宽 |
| 1104:832 | 4:3 |
| 832:1104 | 3:4 |
| 960:960 | 方形 |
时长
- - gen4.5: 2–10 秒
- gen4_turbo: 5 或 10 秒
任务轮询
所有操作均为异步。SDK 的 .waitForTaskOutput() 自动处理轮询(10 分钟超时)。
状态: PENDING → THROTTLED → RUNNING → SUCCEEDED / FAILED
手动轮询:
bash
curl https://api.dev.runwayml.com/v1/tasks/{task_id} \
-H Authorization: Bearer $RUNWAYMLAPISECRET \
-H X-Runway-Version: 2024-11-06
提示技巧
- - 描述单个场景(5–10 秒片段)
- 使用清晰的物理描述,而非抽象概念
- 对于镜头运动:缓慢推进、跟拍、推向主体
- 避免否定表述——不要模糊会产生不可预测的结果
- 保持提示接地气且物理上合理
官方文档