runwayml

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Runway API

Runway API

Generate AI videos, images, and audio using Runway's API. Features Runway's latest Gen-4.5 model for high-quality text-to-video and image-to-video generation, plus Gen-4 variants and third-party models from Google (Veo, Gemini) and ElevenLabs.
Recommended: Use
gen4.5
for best results - the newest and most capable video generation model.
Setup: See Installation Guide. API key goes in
RUNWAYML_API_SECRET
env var.
使用Runway的API生成AI视频、图像与音频。支持Runway最新的Gen-4.5模型,可生成高质量的文本转视频与图生视频内容,同时兼容Gen-4系列变体模型,以及来自Google(Veo、Gemini)和ElevenLabs的第三方模型。
推荐: 使用**
gen4.5
**以获得最佳效果——这是最新、最强大的视频生成模型。
设置: 请查看安装指南。API密钥需配置在
RUNWAYML_API_SECRET
环境变量中。

Quick Start

快速开始

Python

Python

python
from runwayml import RunwayML

client = RunwayML()
python
from runwayml import RunwayML

client = RunwayML()

Image-to-video with latest Gen-4.5 model

Image-to-video with latest Gen-4.5 model

task = client.image_to_video.create( model="gen4.5", prompt_image="https://example.com/image.jpg", prompt_text="A timelapse on a sunny day with clouds flying by", ratio="1280:720", duration=10 ).wait_for_task_output()
print(f"Video URL: {task.output[0]}")
task = client.image_to_video.create( model="gen4.5", prompt_image="https://example.com/image.jpg", prompt_text="A timelapse on a sunny day with clouds flying by", ratio="1280:720", duration=10 ).wait_for_task_output()
print(f"Video URL: {task.output[0]}")

Text-to-video (no image required)

Text-to-video (no image required)

task = client.image_to_video.create( model="gen4.5", prompt_text="A serene mountain landscape at sunset with clouds drifting", ratio="1280:720", duration=10 ).wait_for_task_output()
undefined
task = client.image_to_video.create( model="gen4.5", prompt_text="A serene mountain landscape at sunset with clouds drifting", ratio="1280:720", duration=10 ).wait_for_task_output()
undefined

Node.js

Node.js

javascript
import RunwayML from "@runwayml/sdk";

const client = new RunwayML();

// Image-to-video with latest Gen-4.5 model
const task = await client.imageToVideo
  .create({
    model: "gen4.5",
    promptImage: "https://example.com/image.jpg",
    promptText: "A timelapse on a sunny day with clouds flying by",
    ratio: "1280:720",
    duration: 10,
  })
  .waitForTaskOutput();

console.log(`Video URL: ${task.output[0]}`);

// Text-to-video (no image required)
const textTask = await client.imageToVideo
  .create({
    model: "gen4.5",
    promptText: "A serene mountain landscape at sunset",
    ratio: "1280:720",
    duration: 10,
  })
  .waitForTaskOutput();
javascript
import RunwayML from "@runwayml/sdk";

const client = new RunwayML();

// Image-to-video with latest Gen-4.5 model
const task = await client.imageToVideo
  .create({
    model: "gen4.5",
    promptImage: "https://example.com/image.jpg",
    promptText: "A timelapse on a sunny day with clouds flying by",
    ratio: "1280:720",
    duration: 10,
  })
  .waitForTaskOutput();

console.log(`Video URL: ${task.output[0]}`);

// Text-to-video (no image required)
const textTask = await client.imageToVideo
  .create({
    model: "gen4.5",
    promptText: "A serene mountain landscape at sunset",
    ratio: "1280:720",
    duration: 10,
  })
  .waitForTaskOutput();

cURL

cURL

bash
undefined
bash
undefined

Image-to-video

Image-to-video

curl -X POST "https://api.dev.runwayml.com/v1/image_to_video"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"
-H "Content-Type: application/json"
-d '{ "model": "gen4.5", "promptImage": "https://example.com/image.jpg", "promptText": "A timelapse on a sunny day", "ratio": "1280:720", "duration": 10 }'
curl -X POST "https://api.dev.runwayml.com/v1/image_to_video"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"
-H "Content-Type: application/json"
-d '{ "model": "gen4.5", "promptImage": "https://example.com/image.jpg", "promptText": "A timelapse on a sunny day", "ratio": "1280:720", "duration": 1 }'

Text-to-video (no image required)

Text-to-video (no image required)

curl -X POST "https://api.dev.runwayml.com/v1/image_to_video"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"
-H "Content-Type: application/json"
-d '{ "model": "gen4.5", "promptText": "A serene mountain landscape at sunset", "ratio": "1280:720", "duration": 10 }'
curl -X POST "https://api.dev.runwayml.com/v1/image_to_video"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"
-H "Content-Type: application/json"
-d '{ "model": "gen4.5", "promptText": "A serene mountain landscape at sunset", "ratio": "1280:720", "duration": 10 }'

Poll for result (use returned task id)

Poll for result (use returned task id)

curl "https://api.dev.runwayml.com/v1/tasks/{task_id}"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"

---
curl "https://api.dev.runwayml.com/v1/tasks/{task_id}"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"

---

All Available Models

所有可用模型

Video Generation

视频生成

ModelInputPricingUse Case
gen4.5
Text or Image12 credits/secNewest & recommended - Best quality text/image-to-video (no audio)
gen4_turbo
Image5 credits/secFast image-to-video (no audio), iteration
gen4_aleph
Video + Text/Image15 credits/secVideo-to-video transformation (no audio)
act_two
Image or Video5 credits/secCharacter performance/motion (no audio)
veo3
Text or Image40 credits/secGoogle Veo high-quality video with audio
veo3.1
Text or Image40 credits/secGoogle Veo 3.1 with keyframes & audio
veo3.1_fast
Text or Image15 credits/secGoogle Veo 3.1 faster/cheaper & audio
模型输入定价适用场景
gen4.5
文本或图像12积分/秒最新推荐 - 最高质量的文本/图生视频(无音频)
gen4_turbo
图像5积分/秒快速图生视频(无音频),适合快速迭代
gen4_aleph
视频 + 文本/图像15积分/秒视频转视频风格转换(无音频)
act_two
图像或视频5积分/秒角色动作/运动生成(无音频)
veo3
文本或图像40积分/秒Google Veo高质量视频带音频
veo3.1
文本或图像40积分/秒Google Veo 3.1,支持关键帧及音频
veo3.1_fast
文本或图像15积分/秒Google Veo 3.1,更快更便宜及音频

Image Generation

图像生成

ModelInputPricingUse Case
gen4_image
Text + References (optional)5 credits/720p, 8 credits/1080pHigh-quality with style transfer
gen4_image_turbo
Text + References (required)2 credits/image (any res)Fast iteration
gemini_2.5_flash
Text + References5 credits/imageGoogle Gemini image gen
模型输入定价适用场景
gen4_image
文本 + 参考图(可选)5积分/720p,8积分/1080p高质量生成,支持风格迁移
gen4_image_turbo
文本 + 参考图(必填)2积分/张(任意分辨率)快速迭代生成
gemini_2.5_flash
文本 + 参考图5积分/张Google Gemini图像生成

Audio Generation (ElevenLabs)

音频生成(ElevenLabs)

ModelInput → OutputPricing
eleven_multilingual_v2
Text → Speech1 credit/50 chars
eleven_text_to_sound_v2
Text → Sound Effects1 credit/6 sec
eleven_voice_isolation
Audio → Clean Audio1 credit/6 sec
eleven_voice_dubbing
Audio → Dubbed Audio1 credit/2 sec
eleven_multilingual_sts_v2
Speech → Speech1 credit/2 sec
1 credit = $0.01. Get credits at dev.runwayml.com

模型输入 → 输出定价
eleven_multilingual_v2
文本 → 语音1积分/50字符
eleven_text_to_sound_v2
文本 → 音效1积分/6秒
eleven_voice_isolation
音频 → 纯净音频1积分/6秒
eleven_voice_dubbing
音频 → 配音音频1积分/2秒
eleven_multilingual_sts_v2
语音 → 语音1积分/2秒
1积分 = 0.01美元。可在dev.runwayml.com购买积分

Video Generation

视频生成

Gen-4.5 (Text-to-Video and Image-to-Video)

Gen-4.5(文本转视频与图生视频)

The latest and most capable Runway model supporting both text-only and image-to-video generation.
Runway最新、最强大的模型,支持纯文本输入或图生视频。

Text-to-Video

文本转视频

Generate videos from text descriptions only:
python
task = client.image_to_video.create(
    model="gen4.5",
    prompt_text="A serene mountain lake at sunrise with mist rising from the water",
    ratio="1280:720",
    duration=10,
    seed=12345  # Optional: reproducibility
).wait_for_task_output()
Text-to-Video Aspect Ratios: Landscape
1280:720
(16:9) | Portrait
720:1280
(9:16)
仅通过文本描述生成视频:
python
task = client.image_to_video.create(
    model="gen4.5",
    prompt_text="A serene mountain lake at sunrise with mist rising from the water",
    ratio="1280:720",
    duration=10,
    seed=12345  # Optional: reproducibility
).wait_for_task_output()
文本转视频宽高比: 横屏
1280:720
(16:9)| 竖屏
720:1280
(9:16)

Image-to-Video

图生视频

Animate existing images with motion:
python
task = client.image_to_video.create(
    model="gen4.5",
    prompt_image="https://example.com/image.jpg",
    prompt_text="Camera slowly pushes in, leaves rustling in the breeze",
    ratio="1584:672",
    duration=10,
    seed=12345
).wait_for_task_output()
Image-to-Video Aspect Ratios:
  • Widescreen:
    1280:720
    (16:9),
    1584:672
    (21:9 ultra-wide)
  • Standard:
    1104:832
    (4:3)
  • Portrait:
    720:1280
    (9:16),
    832:1104
    (3:4)
Duration: 2-10 seconds | Pricing: 12 credits/second (60 credits minimum for 5 sec)
为现有图像添加动画效果:
python
task = client.image_to_video.create(
    model="gen4.5",
    prompt_image="https://example.com/image.jpg",
    prompt_text="Camera slowly pushes in, leaves rustling in the breeze",
    ratio="1584:672",
    duration=10,
    seed=12345
).wait_for_task_output()
图生视频宽高比:
  • 宽屏:
    1280:720
    (16:9)、
    1584:672
    (21:9超宽)
  • 标准屏:
    1104:832
    (4:3)
  • 竖屏:
    720:1280
    (9:16)、
    832:1104
    (3:4)
时长: 2-10秒 | 定价: 12积分/秒(最低5秒,60积分)

Gen-4 Turbo (Image-to-Video)

Gen-4 Turbo(图生视频)

python
task = client.image_to_video.create(
    model="gen4_turbo",
    prompt_image="https://example.com/image.jpg",
    prompt_text="Camera slowly pushes in, leaves rustling",
    ratio="1280:720",
    duration=5,
    seed=12345           # Optional: reproducibility
).wait_for_task_output()
Aspect Ratios: Landscape
1280:720
,
1584:672
,
1104:832
| Portrait
720:1280
,
832:1104
| Square
960:960
python
task = client.image_to_video.create(
    model="gen4_turbo",
    prompt_image="https://example.com/image.jpg",
    prompt_text="Camera slowly pushes in, leaves rustling",
    ratio="1280:720",
    duration=5,
    seed=12345           # Optional: reproducibility
).wait_for_task_output()
宽高比: 横屏
1280:720
1584:672
1104:832
| 竖屏
720:1280
832:1104
| 正方形
960:960

Aleph (Video-to-Video)

Aleph(视频转视频)

Transform existing videos with text/image guidance:
python
task = client.video_to_video.create(
    model="gen4_aleph",
    video_uri="https://example.com/source.mp4",
    prompt_text="Transform to anime style",
    references=[{"uri": "https://example.com/style_ref.jpg"}]  # Optional style reference
).wait_for_task_output()
Aspect Ratios: Adds
848:480
(landscape) and
480:848
(portrait) to Gen-4 options.
通过文本或图像引导,转换现有视频风格:
python
task = client.video_to_video.create(
    model="gen4_aleph",
    video_uri="https://example.com/source.mp4",
    prompt_text="Transform to anime style",
    references=[{"uri": "https://example.com/style_ref.jpg"}]  # Optional style reference
).wait_for_task_output()
宽高比: 在Gen-4的基础上新增
848:480
(横屏)和
480:848
(竖屏)

Act-Two (Character Performance)

Act-Two(角色动作生成)

Drive character motion from reference performance. Objects require
type
discriminators:
python
task = client.character_performance.create(
    model="act_two",
    character={"type": "image", "uri": "https://example.com/character.jpg"},  # or type: "video"
    reference={"type": "video", "uri": "https://example.com/performance.mp4"}
).wait_for_task_output()
Character types:
image
(character performs in static environment) or
video
(character performs with some of its own movement)
通过参考动作驱动角色运动。若为物体,需指定
type
标识符:
python
task = client.character_performance.create(
    model="act_two",
    character={"type": "image", "uri": "https://example.com/character.jpg"},  # or type: "video"
    reference={"type": "video", "uri": "https://example.com/performance.mp4"}
).wait_for_task_output()
角色类型:
image
(角色在静态环境中动作)或
video
(角色自带部分动作)

Veo (Google)

Veo(Google)

Google's Veo models for text-to-video and image-to-video. Veo models include audio generation - making them ideal when you need video with sound.
python
undefined
Google的Veo模型支持文本转视频与图生视频。Veo模型包含音频生成——适合需要带声音的视频场景。
python
undefined

Text-to-video with audio (no image required)

Text-to-video with audio (no image required)

task = client.image_to_video.create( model="veo3.1", # or "veo3", "veo3.1_fast" prompt_text="A cinematic shot of a rocket launching at sunset with roaring engines" ).wait_for_task_output()
task = client.image_to_video.create( model="veo3.1", # or "veo3", "veo3.1_fast" prompt_text="A cinematic shot of a rocket launching at sunset with roaring engines" ).wait_for_task_output()

Image-to-video with audio

Image-to-video with audio

task = client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/starting_frame.jpg", prompt_text="Smooth camera movement through the scene with ambient nature sounds" ).wait_for_task_output()

> **Note:** Gen-4.5 and Gen-4 models produce silent video. Use Veo if you need audio, or add audio separately with ElevenLabs models (see Audio Generation section).

---
task = client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/starting_frame.jpg", prompt_text="Smooth camera movement through the scene with ambient nature sounds" ).wait_for_task_output()

> **注意:** Gen-4.5与Gen-4系列模型生成的视频无音频。若需要音频,可使用Veo模型,或通过ElevenLabs模型单独添加音频(请查看音频生成章节)。

---

Image Generation

图像生成

Gen-4 Image with References

带参考图的Gen-4图像生成

Use reference images with @mention syntax in prompts:
python
undefined
在提示词中使用@提及语法关联参考图:
python
undefined

gen4_image - reference_images is optional

gen4_image - reference_images is optional

task = client.text_to_image.create( model="gen4_image", ratio="1920:1080", prompt_text="A beautiful mountain landscape at sunset" ).wait_for_task_output()
task = client.text_to_image.create( model="gen4_image", ratio="1920:1080", prompt_text="A beautiful mountain landscape at sunset" ).wait_for_task_output()

With references

With references

task = client.text_to_image.create( model="gen4_image", ratio="1920:1080", prompt_text="@EiffelTower painted in the style of @StarryNight", reference_images=[ {"uri": "https://example.com/eiffel.jpg", "tag": "EiffelTower"}, {"uri": "https://example.com/starry.jpg", "tag": "StarryNight"} ] ).wait_for_task_output()

**Note:** `gen4_image_turbo` requires `reference_images` (at least one). Use `gen4_image` for text-only generation.

Untagged references apply as general style:

```python
reference_images=[
    {"uri": "https://example.com/subject.jpg", "tag": "subject"},
    {"uri": "https://example.com/style.jpg"}  # No tag = style reference
]

task = client.text_to_image.create( model="gen4_image", ratio="1920:1080", prompt_text="@EiffelTower painted in the style of @StarryNight", reference_images=[ {"uri": "https://example.com/eiffel.jpg", "tag": "EiffelTower"}, {"uri": "https://example.com/starry.jpg", "tag": "StarryNight"} ] ).wait_for_task_output()

**注意:** `gen4_image_turbo`模型必填`reference_images`(至少一张)。若需纯文本生成,请使用`gen4_image`模型。

未标记的参考图将作为通用风格参考:

```python
reference_images=[
    {"uri": "https://example.com/subject.jpg", "tag": "subject"},
    {"uri": "https://example.com/style.jpg"}  # No tag = style reference
]

Audio Generation

音频生成

ElevenLabs models for text-to-speech, sound effects, and voice processing.
Voice Presets:
Maya
,
Arjun
,
Serene
,
Bernard
,
Billy
,
Mark
,
Clint
,
Mabel
,
Chad
,
Leslie
,
Eleanor
,
Elias
,
Elliot
,
Noah
,
Rachel
,
James
,
Katie
,
Tom
,
Wanda
,
Benjamin
ElevenLabs模型支持文本转语音、音效生成与语音处理。
预设语音:
Maya
,
Arjun
,
Serene
,
Bernard
,
Billy
,
Mark
,
Clint
,
Mabel
,
Chad
,
Leslie
,
Eleanor
,
Elias
,
Elliot
,
Noah
,
Rachel
,
James
,
Katie
,
Tom
,
Wanda
,
Benjamin

Text-to-Speech

文本转语音

python
task = client.text_to_speech.create(
    model="eleven_multilingual_v2",
    prompt_text="Hello, welcome to RunwayML!",
    voice={"type": "runway-preset", "preset_id": "Maya"}
).wait_for_task_output()
python
task = client.text_to_speech.create(
    model="eleven_multilingual_v2",
    prompt_text="Hello, welcome to RunwayML!",
    voice={"type": "runway-preset", "preset_id": "Maya"}
).wait_for_task_output()

Sound Effects

音效生成

python
task = client.sound_effect.create(
    model="eleven_text_to_sound_v2",
    prompt_text="Thunder rumbling in the distance, rain on a window"
).wait_for_task_output()
python
task = client.sound_effect.create(
    model="eleven_text_to_sound_v2",
    prompt_text="Thunder rumbling in the distance, rain on a window"
).wait_for_task_output()

Voice Isolation

语音分离

python
task = client.voice_isolation.create(
    model="eleven_voice_isolation",
    audio_uri="https://example.com/noisy_audio.mp3"
).wait_for_task_output()
python
task = client.voice_isolation.create(
    model="eleven_voice_isolation",
    audio_uri="https://example.com/noisy_audio.mp3"
).wait_for_task_output()

Voice Dubbing

语音配音

python
task = client.voice_dubbing.create(
    model="eleven_voice_dubbing",
    audio_uri="https://example.com/speech.mp3",
    target_lang="es"  # Spanish
).wait_for_task_output()
Supported languages:
en
,
hi
,
pt
,
zh
,
es
,
fr
,
de
,
ja
,
ar
,
ru
,
ko
,
id
,
it
,
nl
,
tr
,
pl
,
sv
,
fil
,
ms
,
ro
,
uk
,
el
,
cs
,
da
,
fi
,
bg
,
hr
,
sk
,
ta
python
task = client.voice_dubbing.create(
    model="eleven_voice_dubbing",
    audio_uri="https://example.com/speech.mp3",
    target_lang="es"  # Spanish
).wait_for_task_output()
支持语言:
en
,
hi
,
pt
,
zh
,
es
,
fr
,
de
,
ja
,
ar
,
ru
,
ko
,
id
,
it
,
nl
,
tr
,
pl
,
sv
,
fil
,
ms
,
ro
,
uk
,
el
,
cs
,
da
,
fi
,
bg
,
hr
,
sk
,
ta

Speech-to-Speech

语音转语音

Convert speech to a different voice. Requires
type
discriminators:
python
task = client.speech_to_speech.create(
    model="eleven_multilingual_sts_v2",
    media={"type": "audio", "uri": "https://example.com/original.mp3"},  # or type: "video"
    voice={"type": "runway-preset", "preset_id": "Maya"}
).wait_for_task_output()

将语音转换为不同的音色。需指定
type
标识符:
python
task = client.speech_to_speech.create(
    model="eleven_multilingual_sts_v2",
    media={"type": "audio", "uri": "https://example.com/original.mp3"},  # or type: "video"
    voice={"type": "runway-preset", "preset_id": "Maya"}
).wait_for_task_output()

Input Requirements

输入要求

Size Limits

大小限制

TypeURL LimitData URI LimitEphemeral Upload
Image16MB5MB (3.3MB pre-encoding)200MB
Video32MB16MB200MB
Audio32MB16MB200MB
类型URL链接限制Data URI限制临时上传限制
图像16MB5MB(编码前3.3MB)200MB
视频32MB200MB
音频32MB16MB200MB

Supported Formats

支持格式

Images: JPEG, PNG, WebP (no GIF)
Videos: MP4 (H.264/H.265/AV1), MOV (ProRes), MKV, WebM
Audio: MP3, WAV, FLAC, M4A, AAC
图像: JPEG、PNG、WebP(不支持GIF)
视频: MP4(H.264/H.265/AV1)、MOV(ProRes)、MKV、WebM
音频: MP3、WAV、FLAC、M4A、AAC

Base64 Data URIs

Base64 Data URI

python
import base64

with open("image.jpg", "rb") as f:
    data_uri = f"data:image/jpeg;base64,{base64.b64encode(f.read()).decode()}"

task = client.image_to_video.create(
    model="gen4_turbo",
    prompt_image=data_uri,
    prompt_text="Gentle movement"
).wait_for_task_output()

python
import base64

with open("image.jpg", "rb") as f:
    data_uri = f"data:image/jpeg;base64,{base64.b64encode(f.read()).decode()}"

task = client.image_to_video.create(
    model="gen4_turbo",
    prompt_image=data_uri,
    prompt_text="Gentle movement"
).wait_for_task_output()

Task Management

任务管理

All operations are async. Use
wait_for_task_output()
(polls automatically, 10 min timeout).
Statuses:
PENDING
RUNNING
SUCCEEDED
/
FAILED
/
CANCELED
THROTTLED
= rate-limited, treat as
PENDING
所有操作均为异步执行。可使用
wait_for_task_output()
(自动轮询,超时时间10分钟)。
状态:
PENDING
RUNNING
SUCCEEDED
/
FAILED
/
CANCELED
THROTTLED
= 速率限制,视为
PENDING
处理

Canceling/Deleting Tasks

取消/删除任务

python
undefined
python
undefined

Cancel running task or delete completed task

Cancel running task or delete completed task

client.tasks.delete(task.id)

See [Task Management](references/task-management.md) for manual polling and batch processing.

---
client.tasks.delete(task.id)

更多内容请查看[任务管理](references/task-management.md),了解手动轮询与批量处理方法。

---

Prompting Tips

提示词技巧

Gen-4 thrives on simplicity. Start simple, iterate.
  • Describe single scenes (5-10 sec clips)
  • Use clear physical descriptions, not conceptual language
  • Reference subjects generically: "the subject", "she"
  • Avoid negative phrasing - "no blur" produces unpredictable results
See Prompting Guide for camera movements and advanced techniques.

Gen-4模型偏好简洁的提示词。从简单描述开始,逐步迭代优化。
  • 描述单一场景(5-10秒片段)
  • 使用清晰的物理描述,避免抽象语言
  • 用通用指代描述主体:“主体”、“她”
  • 避免负面表述 - 比如“无模糊”会导致不可预测的结果
更多高级技巧与镜头运动描述,请查看提示词指南

Error Handling

错误处理

python
from runwayml import RunwayML, APIError, RateLimitError

client = RunwayML()

try:
    task = client.image_to_video.create(...).wait_for_task_output()
    if task.status == "FAILED":
        print(f"Generation failed: {task.failure}")
except RateLimitError:
    print("Rate limited - SDK retries automatically")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")
CodeMeaningAction
400Invalid inputFix request parameters
401Invalid API keyCheck RUNWAYML_API_SECRET
429Rate limitSDKs auto-retry with backoff
503Service unavailableSDKs auto-retry

python
from runwayml import RunwayML, APIError, RateLimitError

client = RunwayML()

try:
    task = client.image_to_video.create(...).wait_for_task_output()
    if task.status == "FAILED":
        print(f"Generation failed: {task.failure}")
except RateLimitError:
    print("Rate limited - SDK retries automatically")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")
状态码含义处理方式
400输入无效修正请求参数
401API密钥无效检查RUNWAYML_API_SECRET配置
429速率限制SDK会自动重试并退避
503服务不可用SDK会自动重试

Parameters Quick Reference

参数速查

Video (gen4.5)

视频(gen4.5)

ParameterTypeOptions
model
string
"gen4.5"
,
"gen4_turbo"
,
"veo3"
,
"veo3.1"
duration
number
2
to
10
(seconds)
ratio
stringText-to-video:
"1280:720"
(16:9),
"720:1280"
(9:16)<br>Image-to-video adds:
"1584:672"
(21:9),
"1104:832"
(4:3),
"832:1104"
(3:4)
prompt_text
stringMotion/scene description (required)
prompt_image
stringURL or base64 (optional for text-to-video, required for image-to-video)
seed
numberOptional, for reproducibility
参数类型可选值
model
字符串
"gen4.5"
,
"gen4_turbo"
,
"veo3"
,
"veo3.1"
duration
数字
2
10
(秒)
ratio
字符串文本转视频:
"1280:720"
(16:9)、
"720:1280"
(9:16)<br>图生视频新增:
"1584:672"
(21:9)、
"1104:832"
(4:3)
prompt_text
字符串运动/场景描述(必填)
prompt_image
字符串URL或base64编码(文本转视频可选,图生视频必填)
seed
数字可选,用于生成结果可复现

Image (gen4_image)

图像(gen4_image)

ParameterTypeOptions
model
string
"gen4_image"
,
"gen4_image_turbo"
ratio
string
"1920:1080"
,
"1280:720"
, etc.
prompt_text
stringImage description
reference_images
array
[{"uri": "...", "tag": "..."}]

参数类型可选值
model
字符串
"gen4_image"
,
"gen4_image_turbo"
ratio
字符串
"1920:1080"
,
"1280:720"
prompt_text
字符串图像描述
reference_images
数组
[{"uri": "...", "tag": "..."}]

References

参考链接

  • Installation Guide - SDK setup
  • Prompting Guide - Advanced prompting
  • Task Management - Polling, batching
  • 安装指南 - SDK配置
  • 提示词指南 - 高级提示词技巧
  • 任务管理 - 轮询与批量处理

Official Documentation

官方文档