runwayml
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRunway 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: Usefor best results - the newest and most capable video generation model.gen4.5
Setup: See Installation Guide. API key goes inenv var.RUNWAYML_API_SECRET
使用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()
undefinedtask = 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()
undefinedNode.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
undefinedbash
undefinedImage-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 }'
-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 }'
-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 }'
-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 }'
-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"
-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"
-H "Authorization: Bearer $RUNWAYML_API_SECRET"
-H "X-Runway-Version: 2024-11-06"
---All Available Models
所有可用模型
Video Generation
视频生成
| Model | Input | Pricing | Use Case |
|---|---|---|---|
| Text or Image | 12 credits/sec | Newest & recommended - Best quality text/image-to-video (no audio) |
| Image | 5 credits/sec | Fast image-to-video (no audio), iteration |
| Video + Text/Image | 15 credits/sec | Video-to-video transformation (no audio) |
| Image or Video | 5 credits/sec | Character performance/motion (no audio) |
| Text or Image | 40 credits/sec | Google Veo high-quality video with audio |
| Text or Image | 40 credits/sec | Google Veo 3.1 with keyframes & audio |
| Text or Image | 15 credits/sec | Google Veo 3.1 faster/cheaper & audio |
| 模型 | 输入 | 定价 | 适用场景 |
|---|---|---|---|
| 文本或图像 | 12积分/秒 | 最新推荐 - 最高质量的文本/图生视频(无音频) |
| 图像 | 5积分/秒 | 快速图生视频(无音频),适合快速迭代 |
| 视频 + 文本/图像 | 15积分/秒 | 视频转视频风格转换(无音频) |
| 图像或视频 | 5积分/秒 | 角色动作/运动生成(无音频) |
| 文本或图像 | 40积分/秒 | Google Veo高质量视频带音频 |
| 文本或图像 | 40积分/秒 | Google Veo 3.1,支持关键帧及音频 |
| 文本或图像 | 15积分/秒 | Google Veo 3.1,更快更便宜及音频 |
Image Generation
图像生成
| Model | Input | Pricing | Use Case |
|---|---|---|---|
| Text + References (optional) | 5 credits/720p, 8 credits/1080p | High-quality with style transfer |
| Text + References (required) | 2 credits/image (any res) | Fast iteration |
| Text + References | 5 credits/image | Google Gemini image gen |
| 模型 | 输入 | 定价 | 适用场景 |
|---|---|---|---|
| 文本 + 参考图(可选) | 5积分/720p,8积分/1080p | 高质量生成,支持风格迁移 |
| 文本 + 参考图(必填) | 2积分/张(任意分辨率) | 快速迭代生成 |
| 文本 + 参考图 | 5积分/张 | Google Gemini图像生成 |
Audio Generation (ElevenLabs)
音频生成(ElevenLabs)
| Model | Input → Output | Pricing |
|---|---|---|
| Text → Speech | 1 credit/50 chars |
| Text → Sound Effects | 1 credit/6 sec |
| Audio → Clean Audio | 1 credit/6 sec |
| Audio → Dubbed Audio | 1 credit/2 sec |
| Speech → Speech | 1 credit/2 sec |
1 credit = $0.01. Get credits at dev.runwayml.com
| 模型 | 输入 → 输出 | 定价 |
|---|---|---|
| 文本 → 语音 | 1积分/50字符 |
| 文本 → 音效 | 1积分/6秒 |
| 音频 → 纯净音频 | 1积分/6秒 |
| 音频 → 配音音频 | 1积分/2秒 |
| 语音 → 语音 | 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 (16:9) | Portrait (9:16)
1280:720720:1280仅通过文本描述生成视频:
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()文本转视频宽高比: 横屏(16:9)| 竖屏(9:16)
1280:720720:1280Image-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: (16:9),
1280:720(21:9 ultra-wide)1584:672 - Standard: (4:3)
1104:832 - Portrait: (9:16),
720:1280(3:4)832:1104
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()图生视频宽高比:
- 宽屏:(16:9)、
1280:720(21:9超宽)1584:672 - 标准屏:(4:3)
1104:832 - 竖屏:(9:16)、
720:1280(3:4)832:1104
时长: 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 , , | Portrait , | Square
1280:7201584:6721104:832720:1280832:1104960:960python
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:7201584:6721104:832720:1280832:1104960:960Aleph (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 (landscape) and (portrait) to Gen-4 options.
848:480480:848通过文本或图像引导,转换现有视频风格:
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:480480:848Act-Two (Character Performance)
Act-Two(角色动作生成)
Drive character motion from reference performance. Objects require discriminators:
typepython
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: (character performs in static environment) or (character performs with some of its own movement)
imagevideo通过参考动作驱动角色运动。若为物体,需指定标识符:
typepython
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()角色类型: (角色在静态环境中动作)或(角色自带部分动作)
imagevideoVeo (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
undefinedGoogle的Veo模型支持文本转视频与图生视频。Veo模型包含音频生成——适合需要带声音的视频场景。
python
undefinedText-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
undefinedgen4_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: , , , , , , , , , , , , , , , , , , ,
MayaArjunSereneBernardBillyMarkClintMabelChadLeslieEleanorEliasElliotNoahRachelJamesKatieTomWandaBenjaminElevenLabs模型支持文本转语音、音效生成与语音处理。
预设语音: , , , , , , , , , , , , , , , , , , ,
MayaArjunSereneBernardBillyMarkClintMabelChadLeslieEleanorEliasElliotNoahRachelJamesKatieTomWandaBenjaminText-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: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
enhiptzhesfrdejaarrukoiditnltrplsvfilmsroukelcsdafibghrsktapython
task = client.voice_dubbing.create(
model="eleven_voice_dubbing",
audio_uri="https://example.com/speech.mp3",
target_lang="es" # Spanish
).wait_for_task_output()支持语言: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
enhiptzhesfrdejaarrukoiditnltrplsvfilmsroukelcsdafibghrsktaSpeech-to-Speech
语音转语音
Convert speech to a different voice. Requires discriminators:
typepython
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()将语音转换为不同的音色。需指定标识符:
typepython
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
大小限制
| Type | URL Limit | Data URI Limit | Ephemeral Upload |
|---|---|---|---|
| Image | 16MB | 5MB (3.3MB pre-encoding) | 200MB |
| Video | 32MB | 16MB | 200MB |
| Audio | 32MB | 16MB | 200MB |
| 类型 | URL链接限制 | Data URI限制 | 临时上传限制 |
|---|---|---|---|
| 图像 | 16MB | 5MB(编码前3.3MB) | 200MB |
| 视频 | 32MB | 200MB | |
| 音频 | 32MB | 16MB | 200MB |
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 (polls automatically, 10 min timeout).
wait_for_task_output()Statuses: → → / /
PENDINGRUNNINGSUCCEEDEDFAILEDCANCELEDTHROTTLEDPENDING所有操作均为异步执行。可使用(自动轮询,超时时间10分钟)。
wait_for_task_output()状态: → → / /
PENDINGRUNNINGSUCCEEDEDFAILEDCANCELEDTHROTTLEDPENDINGCanceling/Deleting Tasks
取消/删除任务
python
undefinedpython
undefinedCancel 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}")| Code | Meaning | Action |
|---|---|---|
| 400 | Invalid input | Fix request parameters |
| 401 | Invalid API key | Check RUNWAYML_API_SECRET |
| 429 | Rate limit | SDKs auto-retry with backoff |
| 503 | Service unavailable | SDKs 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 | 输入无效 | 修正请求参数 |
| 401 | API密钥无效 | 检查RUNWAYML_API_SECRET配置 |
| 429 | 速率限制 | SDK会自动重试并退避 |
| 503 | 服务不可用 | SDK会自动重试 |
Parameters Quick Reference
参数速查
Video (gen4.5)
视频(gen4.5)
| Parameter | Type | Options |
|---|---|---|
| string | |
| number | |
| string | Text-to-video: |
| string | Motion/scene description (required) |
| string | URL or base64 (optional for text-to-video, required for image-to-video) |
| number | Optional, for reproducibility |
| 参数 | 类型 | 可选值 |
|---|---|---|
| 字符串 | |
| 数字 | |
| 字符串 | 文本转视频: |
| 字符串 | 运动/场景描述(必填) |
| 字符串 | URL或base64编码(文本转视频可选,图生视频必填) |
| 数字 | 可选,用于生成结果可复现 |
Image (gen4_image)
图像(gen4_image)
| Parameter | Type | Options |
|---|---|---|
| string | |
| string | |
| string | Image description |
| array | |
| 参数 | 类型 | 可选值 |
|---|---|---|
| 字符串 | |
| 字符串 | |
| 字符串 | 图像描述 |
| 数组 | |
References
参考链接
- Installation Guide - SDK setup
- Prompting Guide - Advanced prompting
- Task Management - Polling, batching
- 安装指南 - SDK配置
- 提示词指南 - 高级提示词技巧
- 任务管理 - 轮询与批量处理
Official Documentation
官方文档
- Runway API Documentation - Complete API reference
- Model Guide - All available models
- Developer Portal - API keys and account management
- Runway API文档 - 完整API参考
- 模型指南 - 所有可用模型详情
- 开发者门户 - API密钥与账户管理