rw-recipe-full-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Full Runway API Setup

完整的Runway API设置

PREREQUISITE: Run
+rw-check-compatibility
first to ensure the project has server-side capability.
This recipe guides a user through the complete process of integrating Runway's public API into their project. It chains together the compatibility check, API key setup, and API integration skills.
前提条件: 先运行
+rw-check-compatibility
以确保项目具备服务端能力。
本指南将引导用户完成将Runway公开API集成到项目中的完整流程,涵盖兼容性检查、API密钥设置和API集成技能的串联使用。

Workflow

工作流程

Phase 1: Compatibility Check

阶段1:兼容性检查

Use
+rw-check-compatibility
to analyze the user's project.
  1. Identify the project type (Node.js, Python, etc.)
  2. Verify server-side capability
  3. Check runtime version compatibility
  4. Look for existing Runway SDK installation
If the project is INCOMPATIBLE, stop and explain the options:
  • Add a backend (Express, FastAPI, etc.)
  • Use a fullstack framework (Next.js, SvelteKit, Nuxt, Remix)
  • Add serverless functions (Vercel Functions, AWS Lambda)
  • Create a separate backend service
If NEEDS CHANGES, help the user make the required changes before proceeding.
If COMPATIBLE, proceed to Phase 2.
使用
+rw-check-compatibility
分析用户的项目。
  1. 识别项目类型(Node.js、Python等)
  2. 验证服务端能力
  3. 检查运行时版本兼容性
  4. 查找是否已安装Runway SDK
如果项目不兼容,停止操作并说明可选方案:
  • 添加后端(Express、FastAPI等)
  • 使用全栈框架(Next.js、SvelteKit、Nuxt、Remix)
  • 添加无服务器函数(Vercel Functions、AWS Lambda)
  • 创建独立的后端服务
如果需要修改,帮助用户完成必要的更改后再继续。
如果兼容,进入阶段2。

Phase 2: API Key Setup

阶段2:API密钥设置

Use
+rw-setup-api-key
to configure credentials.
  1. Direct the user to https://dev.runwayml.com/ to create an account and API key
  2. Install the appropriate SDK (
    @runwayml/sdk
    for Node.js,
    runwayml
    for Python)
  3. Configure the
    RUNWAYML_API_SECRET
    environment variable
  4. Update
    .gitignore
    to exclude
    .env
  5. Remind about credit purchase requirement ($10 minimum)
Wait for the user to confirm they have their API key before proceeding.
使用
+rw-setup-api-key
配置凭据。
  1. 引导用户访问https://dev.runwayml.com/ 创建账户并获取API密钥
  2. 安装合适的SDK(Node.js使用
    @runwayml/sdk
    ,Python使用
    runwayml
  3. 配置
    RUNWAYML_API_SECRET
    环境变量
  4. 更新
    .gitignore
    以排除
    .env
    文件
  5. 提醒用户需要购买 credits(最低10美元)
等待用户确认已获取API密钥后再继续。

Phase 3: Determine What to Integrate

阶段3:确定集成内容

Ask the user what they want to build. Based on their response, use the appropriate integration skill:
User wants...Skill to use
Generate videos from text
+rw-integrate-video
(text-to-video)
Animate images into video
+rw-integrate-video
(image-to-video) +
+rw-integrate-uploads
if local files
Edit/transform existing videos
+rw-integrate-video
(video-to-video) +
+rw-integrate-uploads
Generate images from text
+rw-integrate-image
Generate images with references
+rw-integrate-image
+
+rw-integrate-uploads
if local refs
Text-to-speech
+rw-integrate-audio
Sound effects
+rw-integrate-audio
Voice isolation/dubbing
+rw-integrate-audio
+
+rw-integrate-uploads
Real-time conversational avatar
+rw-integrate-characters
+
+rw-integrate-character-embed
(React UI)
Avatar with domain knowledge
+rw-integrate-characters
+
+rw-integrate-documents
+
+rw-integrate-character-embed
Multiple capabilitiesIntegrate each one, sharing the same client instance
询问用户想要构建的功能,根据他们的回复使用相应的集成技能:
用户需求...使用的技能
文本生成视频
+rw-integrate-video
(文本转视频)
图片动效转视频
+rw-integrate-video
(图片转视频) + 若涉及本地文件则使用
+rw-integrate-uploads
编辑/转换现有视频
+rw-integrate-video
(视频转视频) +
+rw-integrate-uploads
文本生成图片
+rw-integrate-image
基于参考图生成图片
+rw-integrate-image
+ 若涉及本地参考文件则使用
+rw-integrate-uploads
文本转语音
+rw-integrate-audio
音效生成
+rw-integrate-audio
语音分离/配音
+rw-integrate-audio
+
+rw-integrate-uploads
实时对话虚拟形象
+rw-integrate-characters
+
+rw-integrate-character-embed
(React UI)
具备领域知识的虚拟形象
+rw-integrate-characters
+
+rw-integrate-documents
+
+rw-integrate-character-embed
多种功能集成分别集成每个功能,共享同一个客户端实例

Phase 4: Write the Integration Code

阶段4:编写集成代码

Based on the user's framework and needs:
  1. Create the API route/handler — server-side endpoint that calls Runway
  2. Add upload handling if the user needs to accept files from their users
  3. Add error handling — catch and handle task failures
  4. Handle output storage — remind user that output URLs expire in 24-48 hours
根据用户的框架和需求:
  1. 创建API路由/处理器 —— 调用Runway的服务端端點
  2. 添加上传处理(如果用户需要接收用户上传的文件)
  3. 添加错误处理 —— 捕获并处理任务失败情况
  4. 处理输出存储 —— 提醒用户输出URL的有效期为24-48小时

Phase 5: Test and Verify

阶段5:测试与验证

Help the user:
  1. Run a test generation to verify everything works
  2. Check for common issues (missing env var, insufficient credits, wrong model)
  3. Confirm output is accessible
帮助用户:
  1. 运行一次测试生成,验证所有功能正常工作
  2. 检查常见问题(缺少环境变量、credits不足、模型错误)
  3. 确认输出内容可访问

Decision Tree for Upload Requirements

上传需求决策树

When the user's workflow involves images or videos as input:
Does the input come from a public HTTPS URL?
├── YES → Pass the URL directly to the API
└── NO → Is it a local file or user-uploaded file?
    ├── YES → Use +rw-integrate-uploads to upload first, then pass runway:// URI
    └── NO → Is it small enough for a data URI? (< 5MB image, < 16MB video)
        ├── YES → Convert to base64 data URI
        └── NO → Use +rw-integrate-uploads
当用户的工作流程涉及图片或视频作为输入时:
输入是否来自公共HTTPS URL?
├── 是 → 直接将URL传递给API
└── 否 → 是否为本地文件或用户上传的文件?
    ├── 是 → 使用+rw-integrate-uploads先上传,再传递runway:// URI
    └── 否 → 是否小到可以用数据URI?(图片<5MB,视频<16MB)
        ├── 是 → 转换为base64数据URI
        └── 否 → 使用+rw-integrate-uploads

Important Reminders

重要提醒

  • Never expose the API key in client-side code. All API calls must happen server-side.
  • Output URLs expire. Always download and store generated content.
  • Credits are required. The API won't work without prepaid credits.
  • Rate limits exist. Rate limits exist. You should always check what is the rate limit before attempting concurrent generations.
  • Content moderation applies to both inputs and outputs. Safety-flagged inputs are non-refundable.
  • Be cost-conscious. Help users pick the right model for their budget. Credit cost can be found on https://docs.dev.runwayml.com/guides/pricing/
  • 切勿在客户端代码中暴露API密钥。所有API调用必须在服务端进行。
  • 输出URL会过期。务必下载并存储生成的内容。
  • 需要credits。没有预付费credits的话API无法使用。
  • 存在速率限制。在尝试并发生成之前,务必查看当前的速率限制。
  • 内容审核适用于输入和输出。被标记为不安全的输入不予退款。
  • 注意成本。帮助用户选择符合预算的模型。credits成本可在https://docs.dev.runwayml.com/guides/pricing/ 查看。