rw-api-reference
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRunway Public API Reference
Runway公共API参考
PREREQUISITE: Runfirst to ensure the project has server-side capability.+rw-check-compatibility
Base URL:
https://api.dev.runwayml.comAll requests require these headers:
Authorization: Bearer <RUNWAYML_API_SECRET>
X-Runway-Version: 2024-11-06前提条件: 先运行,确保项目具备服务端能力。+rw-check-compatibility
基础URL:
https://api.dev.runwayml.com所有请求均需包含以下请求头:
Authorization: Bearer <RUNWAYML_API_SECRET>
X-Runway-Version: 2024-11-06Models & Endpoints
模型与端点
Video Generation
视频生成
| Model | Endpoint | Input | Cost (credits/sec) |
|---|---|---|---|
| | Text and/or Image | 12 |
| | Image required | 5 |
| | Video + Text/Image | 15 |
| | Image/Video | 5 |
| | Text/Image | 40 |
| | Text/Image | 20-40 |
| | Text/Image | 10-15 |
| | Text, Image, and/or Video | 36 |
Video duration: 2-15 seconds (model-dependent). Aspect ratios are pixel-based: , , , , , , etc.
1280:720720:12801104:832960:960832:11041584:672Seedance 2 specifics:
- Modes: text-to-video, image-to-video (first/last frame or image reference), video-to-video
- Duration: required for TTV and ITV (in seconds)
- Aspect ratios (pixel-based): ,
1280:720,720:1280,960:960,1112:834,834:1112,1470:630,992:432,864:496,752:560,640:640,560:752496:864 - ITV supports two mutually exclusive modes: first/last frame (array with
promptImage) or image reference (positionarray)references - VTV input requirements: max 15 seconds, max 32 MB, min 720p resolution, MP4 recommended
| 模型 | 端点 | 输入 | 成本(点数/秒) |
|---|---|---|---|
| | 文本和/或图像 | 12 |
| | 必须提供图像 | 5 |
| | 视频 + 文本/图像 | 15 |
| | 图像/视频 | 5 |
| | 文本/图像 | 40 |
| | 文本/图像 | 20-40 |
| | 文本/图像 | 10-15 |
| | 文本、图像和/或视频 | 36 |
视频时长:2-15秒(取决于模型)。宽高比基于像素:、、、、、等。
1280:720720:12801104:832960:960832:11041584:672Seedance 2 专属说明:
- 模式:文本转视频、图像转视频(首帧/末帧或图像参考)、视频转视频
- 时长:文本转视频和图像转视频需指定(单位:秒)
- 宽高比(基于像素):、
1280:720、720:1280、960:960、1112:834、834:1112、1470:630、992:432、864:496、752:560、640:640、560:752496:864 - 图像转视频支持两种互斥模式:首帧/末帧(含的
position数组)或图像参考(promptImage数组)references - 视频转视频输入要求:最长15秒,最大32 MB,最低720p分辨率,推荐MP4格式
Image Generation
图像生成
| Model | Endpoint | Cost (credits) |
|---|---|---|
| | 5 (720p), 8 (1080p) |
| | 2 |
| | 5 |
| 模型 | 端点 | 成本(点数) |
|---|---|---|
| | 5(720p)、8(1080p) |
| | 2 |
| | 5 |
Audio Generation
音频生成
| Model | Endpoint | Use Case | Cost |
|---|---|---|---|
| | Text to speech | 1 credit/50 chars |
| | Sound effects | 1-2 credits |
| | Isolate voice from audio | 1 credit/6 sec |
| | Dub audio to other languages | 1 credit/2 sec |
| | Voice conversion | 1 credit/3 sec |
| 模型 | 端点 | 使用场景 | 成本 |
|---|---|---|---|
| | 文本转语音 | 1点数/50字符 |
| | 音效生成 | 1-2点数 |
| | 从音频中分离人声 | 1点数/6秒 |
| | 将音频配音为其他语言 | 1点数/2秒 |
| | 语音转换 | 1点数/3秒 |
Characters (Real-Time Avatars)
角色(实时虚拟形象)
| Model | Description | Session Max Duration |
|---|---|---|
| Real-time conversational avatars powered by GWM-1 | 5 minutes |
Endpoints:
| Method | Endpoint | Description |
|---|---|---|
| | Create a new Avatar |
| | Retrieve an Avatar |
| | Update an Avatar (name, voice, personality, documentIds) |
| | Delete an Avatar |
| | Create a new real-time session |
| | Retrieve session status (poll until |
| | Consume session credentials for WebRTC (one-time use) |
Avatar creation parameters:
| Parameter | Type | Description |
|---|---|---|
| string | Display name for the avatar |
| string | URL or |
| object | |
| string | System prompt / personality instructions |
| string[] | Optional. IDs of knowledge base documents to attach |
Voice presets: (soft), (firm), (authoritative). Preview all at dev.runwayml.com.
claravictoriavincentSession statuses: → → → (or / )
NOT_READYREADYRUNNINGCOMPLETEDFAILEDCANCELLED| 模型 | 描述 | 会话最长时长 |
|---|---|---|
| 由GWM-1驱动的实时对话虚拟形象 | 5分钟 |
端点:
| 方法 | 端点 | 描述 |
|---|---|---|
| | 创建新虚拟形象 |
| | 获取虚拟形象信息 |
| | 更新虚拟形象(名称、语音、人设、documentIds) |
| | 删除虚拟形象 |
| | 创建新实时会话 |
| | 获取会话状态(轮询直到状态为 |
| | 消耗会话凭证用于WebRTC(仅可使用一次) |
虚拟形象创建参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| string | 虚拟形象的显示名称 |
| string | 角色图像的URL或 |
| object | |
| string | 系统提示词/人设说明 |
| string[] | 可选。需关联的知识库文档ID |
会话状态: → → → (或 / )
NOT_READYREADYRUNNINGCOMPLETEDFAILEDCANCELLEDDocuments (Knowledge Base)
文档(知识库)
| Method | Endpoint | Description |
|---|---|---|
| | Create a document (plain text or Markdown) |
| | Retrieve a document |
| | Delete a document |
Each Avatar supports up to 50,000 tokens of knowledge. Link documents to an Avatar via .
client.avatars.update(id, { documentIds: [...] })| 方法 | 端点 | 描述 |
|---|---|---|
| | 创建文档(纯文本或Markdown格式) |
| | 获取文档信息 |
| | 删除文档 |
每个虚拟形象最多支持50,000个token的知识库内容。可通过将文档关联到虚拟形象。
client.avatars.update(id, { documentIds: [...] })Request Body Reference (raw JSON)
请求体参考(原始JSON)
Use these when calling the API directly (e.g. through 's command) rather than via an SDK. Only required + common fields shown — consult for the full schema.
use-runway-apirequest+rw-fetch-api-reference直接调用API时使用(例如通过的命令),而非通过SDK。仅展示必填及常用字段——完整架构请参考。
use-runway-apirequest+rw-fetch-api-referencePOST /v1/text_to_image
POST /v1/text_to_imagePOST /v1/text_to_image
POST /v1/text_to_imagejson
{
"model": "gen4_image",
"promptText": "A serene Japanese garden with cherry blossoms",
"ratio": "1920:1080"
}- :
model|gen4_image|gen4_image_turbo(required)gemini_2.5_flash - : string, up to ~1000 chars (required)
promptText - : one of
ratio,1920:1080,1080:1920,1024:1024,1360:768,1080:1080,1168:880,1440:1080,1080:1440,1808:768(required; 720p or 1080p variants depending on model)2112:912 - : optional
referenceImages— reference by[{ "uri": "https://...", "tag": "MyTag" }]in@MyTagpromptText - : optional integer for reproducibility
seed
json
{
"model": "gen4_image",
"promptText": "A serene Japanese garden with cherry blossoms",
"ratio": "1920:1080"
}- :
model|gen4_image|gen4_image_turbo(必填)gemini_2.5_flash - : 字符串,最多约1000字符(必填)
promptText - : 可选值包括
ratio、1920:1080、1080:1920、1024:1024、1360:768、1080:1080、1168:880、1440:1080、1080:1440、1808:768(必填;根据模型不同支持720p或1080p变体)2112:912 - : 可选,格式为
referenceImages— 在[{ "uri": "https://...", "tag": "MyTag" }]中通过promptText引用@MyTag - : 可选整数,用于生成结果可复现
seed
POST /v1/text_to_video
POST /v1/text_to_videoPOST /v1/text_to_video
POST /v1/text_to_videojson
{
"model": "gen4.5",
"promptText": "A golden retriever running through wildflowers at sunset",
"ratio": "1280:720",
"duration": 5
}- :
model|gen4.5|veo3|veo3.1|veo3.1_fast(required)seedance2 - : integer seconds, 2–10 (required; model-specific valid values — e.g. veo3 only accepts 8)
duration - : e.g.
ratio,1280:720,720:1280,1104:832,832:1104(required)960:960
json
{
"model": "gen4.5",
"promptText": "A golden retriever running through wildflowers at sunset",
"ratio": "1280:720",
"duration": 5
}- :
model|gen4.5|veo3|veo3.1|veo3.1_fast(必填)seedance2 - : 整数,单位秒,范围2–10(必填;不同模型支持的有效值不同——例如veo3仅支持8秒)
duration - : 例如
ratio、1280:720、720:1280、1104:832、832:1104(必填)960:960
POST /v1/image_to_video
POST /v1/image_to_videoPOST /v1/image_to_video
POST /v1/image_to_videojson
{
"model": "gen4.5",
"promptImage": "https://example.com/cover.jpg",
"promptText": "A slow dolly-in shot",
"ratio": "1280:720",
"duration": 5
}- :
model|gen4.5|gen4_turbo|veo3|veo3.1|veo3.1_fast(required)seedance2 - : HTTPS URL, data URI, or
promptImageURI (required). Can also berunway://for keyframes.[{ "uri": "...", "position": "first" | "last" }] - : optional for most models, required for
promptTextwhen no image motion is obviousgen4_turbo
json
{
"model": "gen4.5",
"promptImage": "https://example.com/cover.jpg",
"promptText": "A slow dolly-in shot",
"ratio": "1280:720",
"duration": 5
}- :
model|gen4.5|gen4_turbo|veo3|veo3.1|veo3.1_fast(必填)seedance2 - : HTTPS URL、data URI或
promptImageURI(必填)。也可使用含关键帧的格式:runway://[{ "uri": "...", "position": "first" | "last" }] - : 多数模型可选,当图像无明显动态效果时,
promptText必填gen4_turbo
POST /v1/video_to_video
POST /v1/video_to_videoPOST /v1/video_to_video
POST /v1/video_to_videojson
{
"model": "gen4_aleph",
"videoUri": "https://example.com/source.mp4",
"promptText": "Change the season to winter with snowfall",
"ratio": "1280:720"
}json
{
"model": "gen4_aleph",
"videoUri": "https://example.com/source.mp4",
"promptText": "Change the season to winter with snowfall",
"ratio": "1280:720"
}POST /v1/text_to_speech
POST /v1/text_to_speechPOST /v1/text_to_speech
POST /v1/text_to_speechjson
{
"model": "eleven_multilingual_v2",
"text": "Hello, welcome to Runway.",
"voice": { "type": "runway-preset", "presetId": "clara" }
}- :
voiceor a provider-specific voice object{ type: "runway-preset", presetId: "clara" | "victoria" | "vincent" | ... } - : optional ISO code (auto-detected by default)
languageCode
json
{
"model": "eleven_multilingual_v2",
"text": "Hello, welcome to Runway.",
"voice": { "type": "runway-preset", "presetId": "clara" }
}- :
voice或供应商专属语音对象{ type: "runway-preset", presetId: "clara" | "victoria" | "vincent" | ... } - : 可选ISO代码(默认自动检测)
languageCode
POST /v1/sound_effect
POST /v1/sound_effectPOST /v1/sound_effect
POST /v1/sound_effectjson
{
"model": "eleven_text_to_sound_v2",
"promptText": "Thunderclap followed by heavy rain",
"duration": 5
}json
{
"model": "eleven_text_to_sound_v2",
"promptText": "Thunderclap followed by heavy rain",
"duration": 5
}POST /v1/voice_isolation
POST /v1/voice_isolationPOST /v1/voice_isolation
POST /v1/voice_isolationjson
{
"model": "eleven_voice_isolation",
"audioUri": "https://example.com/noisy.mp3"
}json
{
"model": "eleven_voice_isolation",
"audioUri": "https://example.com/noisy.mp3"
}POST /v1/voice_dubbing
POST /v1/voice_dubbingPOST /v1/voice_dubbing
POST /v1/voice_dubbingjson
{
"model": "eleven_voice_dubbing",
"audioUri": "https://example.com/english.mp3",
"targetLanguage": "es"
}json
{
"model": "eleven_voice_dubbing",
"audioUri": "https://example.com/english.mp3",
"targetLanguage": "es"
}POST /v1/speech_to_speech
POST /v1/speech_to_speechPOST /v1/speech_to_speech
POST /v1/speech_to_speechjson
{
"model": "eleven_multilingual_sts_v2",
"audioUri": "https://example.com/source.mp3",
"voice": { "type": "runway-preset", "presetId": "victoria" }
}json
{
"model": "eleven_multilingual_sts_v2",
"audioUri": "https://example.com/source.mp3",
"voice": { "type": "runway-preset", "presetId": "victoria" }
}POST /v1/avatars
POST /v1/avatarsPOST /v1/avatars
POST /v1/avatarsjson
{
"name": "Support Agent",
"referenceImage": "https://example.com/portrait.jpg",
"voice": { "type": "runway-live-preset", "presetId": "clara" },
"personality": "You are a friendly support agent.",
"documentIds": []
}json
{
"name": "Support Agent",
"referenceImage": "https://example.com/portrait.jpg",
"voice": { "type": "runway-live-preset", "presetId": "clara" },
"personality": "You are a friendly support agent.",
"documentIds": []
}POST /v1/documents
POST /v1/documentsPOST /v1/documents
POST /v1/documentsjson
{
"avatarId": "<avatar-id>",
"name": "FAQ",
"content": "Q: What is your return policy?\nA: 30 days, no questions asked."
}json
{
"avatarId": "<avatar-id>",
"name": "FAQ",
"content": "Q: What is your return policy?\nA: 30 days, no questions asked."
}POST /v1/realtime_sessions
POST /v1/realtime_sessionsPOST /v1/realtime_sessions
POST /v1/realtime_sessionsjson
{
"avatarId": "<avatar-id>"
}json
{
"avatarId": "<avatar-id>"
}Management Endpoints
管理端点
| Method | Endpoint | Description |
|---|---|---|
| | Get task status and output |
| | Cancel/delete a task |
| | Create ephemeral upload |
| | Organization info & credit balance |
| | Credit usage history (up to 90 days) |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 获取任务状态及输出 |
| | 取消/删除任务 |
| | 创建临时上传链接 |
| | 组织信息及点数余额 |
| | 点数使用历史(最长90天) |
Task Lifecycle
任务生命周期
All generation endpoints return a task object. The flow is:
- Submit — → returns
POST /v1/<endpoint>{ "id": "task_xxx" } - Poll — → returns task with
GET /v1/tasks/{id}status - Retrieve output — When , the
status === "SUCCEEDED"array contains signed URLsoutput
所有生成类端点均返回任务对象。流程如下:
- 提交 — 调用→ 返回
POST /v1/<endpoint>{ "id": "task_xxx" } - 轮询 — 调用→ 返回含
GET /v1/tasks/{id}的任务信息status - 获取输出 — 当时,
status === "SUCCEEDED"数组包含签名URLoutput
Task Statuses
任务状态
| Status | Meaning |
|---|---|
| Queued, waiting to start |
| Currently generating |
| Complete — output URLs available |
| Generation failed — check |
| Concurrency limit hit — auto-queued |
| 状态 | 含义 |
|---|---|
| 已排队,等待启动 |
| 正在生成 |
| 生成完成 — 可获取输出URL |
| 生成失败 — 查看 |
| 达到并发限制 — 自动排队 |
SDK Polling (Recommended)
SDK轮询(推荐)
The SDKs provide a method that handles polling automatically:
waitForTaskOutput()javascript
// Node.js — polls until complete (default 10 min timeout)
const task = await client.imageToVideo.create({
model: 'gen4.5',
promptImage: 'https://example.com/image.jpg',
promptText: 'A sunset timelapse',
ratio: '1280:720',
duration: 5
}).waitForTaskOutput();
console.log(task.output); // Array of signed URLspython
undefinedSDK提供方法,可自动处理轮询:
waitForTaskOutput()javascript
// Node.js — 轮询直到完成(默认超时10分钟)
const task = await client.imageToVideo.create({
model: 'gen4.5',
promptImage: 'https://example.com/image.jpg',
promptText: 'A sunset timelapse',
ratio: '1280:720',
duration: 5
}).waitForTaskOutput();
console.log(task.output); // 签名URL数组python
undefinedPython
Python
task = client.image_to_video.create(
model='gen4.5',
prompt_image='https://example.com/image.jpg',
prompt_text='A sunset timelapse',
ratio='1280:720',
duration=5
).wait_for_task_output()
print(task.output)
undefinedtask = client.image_to_video.create(
model='gen4.5',
prompt_image='https://example.com/image.jpg',
prompt_text='A sunset timelapse',
ratio='1280:720',
duration=5
).wait_for_task_output()
print(task.output)
undefinedManual Polling (REST)
手动轮询(REST)
javascript
async function pollTask(taskId) {
while (true) {
const response = await fetch(`https://api.dev.runwayml.com/v1/tasks/${taskId}`, {
headers: {
'Authorization': `Bearer ${process.env.RUNWAYML_API_SECRET}`,
'X-Runway-Version': '2024-11-06'
}
});
const task = await response.json();
if (task.status === 'SUCCEEDED') return task;
if (task.status === 'FAILED') throw new Error(task.failure);
await new Promise(r => setTimeout(r, 5000)); // poll every 5 seconds
}
}javascript
async function pollTask(taskId) {
while (true) {
const response = await fetch(`https://api.dev.runwayml.com/v1/tasks/${taskId}`, {
headers: {
'Authorization': `Bearer ${process.env.RUNWAYML_API_SECRET}`,
'X-Runway-Version': '2024-11-06'
}
});
const task = await response.json();
if (task.status === 'SUCCEEDED') return task;
if (task.status === 'FAILED') throw new Error(task.failure);
await new Promise(r => setTimeout(r, 5000)); // 每5秒轮询一次
}
}Output Handling
输出处理
- Successful tasks return an array with signed URLs to generated content
output - Output URLs expire within 24-48 hours
- Download and store outputs in your own storage — do not serve signed URLs to end users
- Video outputs are MP4, image outputs are PNG/JPEG
- 成功的任务返回数组,包含生成内容的签名URL
output - 输出URL会在24-48小时内过期
- 下载并将输出存储在自有存储中——不要将签名URL直接提供给终端用户
- 视频输出为MP4格式,图像输出为PNG/JPEG格式
Input Requirements
输入要求
Size Limits
大小限制
| Type | Via URL | Via Data URI | Via Upload |
|---|---|---|---|
| Image | 16 MB | 5 MB | 200 MB |
| Video | 32 MB | 16 MB | 200 MB |
| Audio | 32 MB | 16 MB | 200 MB |
| 类型 | 通过URL | 通过Data URI | 通过上传 |
|---|---|---|---|
| 图像 | 16 MB | 5 MB | 200 MB |
| 视频 | 32 MB | 16 MB | 200 MB |
| 音频 | 32 MB | 16 MB | 200 MB |
Supported Formats
支持的格式
- Images: JPEG, PNG, WebP (no GIF)
- Video codecs: H.264, H.265/HEVC, AV1, VP8/VP9, Apple ProRes, Theora
- Audio: MP3, AAC, FLAC, PCM, ALAC
- 图像: JPEG、PNG、WebP(不支持GIF)
- 视频编码: H.264、H.265/HEVC、AV1、VP8/VP9、Apple ProRes、Theora
- 音频: MP3、AAC、FLAC、PCM、ALAC
URL Requirements
URL要求
If providing assets via URL:
- HTTPS only (no HTTP)
- Domain names only (no IP addresses)
- No redirects
- Must support HTTP HEAD requests
- Must return valid and
Content-TypeheadersContent-Length - Max URL length: 2,048 characters
若通过URL提供资源:
- 仅支持HTTPS(不支持HTTP)
- 仅支持域名(不支持IP地址)
- 无重定向
- 必须支持HTTP HEAD请求
- 必须返回有效的和
Content-Type请求头Content-Length - URL最大长度:2048字符
Rate Limits & Tiers
速率限制与等级
| Tier | Concurrency | Daily Gens | Monthly Cap | Unlock |
|---|---|---|---|---|
| 1 (default) | 1-2 | 50-200 | $100 | — |
| 2 | 3 | 500-1,000 | $500 | 1 day + $50 |
| 3 | 5 | 1,000-2,000 | $2,000 | 7 days + $100 |
| 4 | 10 | 5,000-10,000 | $20,000 | 14 days + $1,000 |
| 5 | 20 | 25,000-30,000 | $100,000 | 7 days + $5,000 |
- No requests-per-minute limit — only daily generation quotas
- Exceeding concurrency → status (auto-queued, not rejected)
THROTTLED - Exceeding daily limit →
429 Too Many Requests - Daily limits use a rolling 24-hour window
| 等级 | 并发数 | 每日生成量 | 月度上限 | 解锁条件 |
|---|---|---|---|---|
| 1(默认) | 1-2 | 50-200 | 100美元 | — |
| 2 | 3 | 500-1000 | 500美元 | 1天 + 50美元 |
| 3 | 5 | 1000-2000 | 2000美元 | 7天 + 100美元 |
| 4 | 10 | 5000-10000 | 20000美元 | 14天 + 1000美元 |
| 5 | 20 | 25000-30000 | 100000美元 | 7天 + 5000美元 |
- 无每分钟请求数限制——仅限制每日生成配额
- 超过并发数→返回状态(自动排队,不会被拒绝)
THROTTLED - 超过每日限制→返回
429 Too Many Requests - 每日限制采用滚动24小时窗口
Error Handling
错误处理
HTTP Errors
HTTP错误
| Code | Meaning | Action |
|---|---|---|
| 400 | Input validation failure | Fix input, do not retry |
| 401 | Invalid API key | Check key, do not retry |
| 429 | Rate limited | Retry with exponential backoff + jitter |
| 502/503/504 | Server overload | Retry with exponential backoff + jitter |
| 状态码 | 含义 | 操作 |
|---|---|---|
| 400 | 输入验证失败 | 修正输入,请勿重试 |
| 401 | API密钥无效 | 检查密钥,请勿重试 |
| 429 | 速率限制 | 使用指数退避+抖动策略重试 |
| 502/503/504 | 服务器过载 | 使用指数退避+抖动策略重试 |
Task Failure Codes
任务失败代码
| Code | Meaning | Retry? |
|---|---|---|
| Input content moderation | No — not refundable |
| Output content moderation | Yes — try different prompt |
| Quality issue | Yes |
| Bad input format | Fix input |
| Server error | Yes |
The SDKs handle retries for transient errors automatically.
| 代码 | 含义 | 是否可重试? |
|---|---|---|
| 输入内容审核不通过 | 否 — 不予退款 |
| 输出内容审核不通过 | 是 — 尝试更换提示词 |
| 生成质量问题 | 是 |
| 输入格式错误 | 修正输入 |
| 服务器错误 | 是 |
SDK会自动处理临时错误的重试。
Data URI Support
Data URI支持
Base64-encoded images can be passed instead of URLs:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...Useful for small images or when you don't want to host the file. Subject to the data URI size limits above.
可传入Base64编码的图像替代URL:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...适用于小型图像或无需托管文件的场景。需遵守上述Data URI大小限制。