rw-recipe-full-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFull Runway API Setup
完整的Runway API设置
PREREQUISITE: Runfirst to ensure the project has server-side capability.+rw-check-compatibility
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 to analyze the user's project.
+rw-check-compatibility- Identify the project type (Node.js, Python, etc.)
- Verify server-side capability
- Check runtime version compatibility
- 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- 识别项目类型(Node.js、Python等)
- 验证服务端能力
- 检查运行时版本兼容性
- 查找是否已安装Runway SDK
如果项目不兼容,停止操作并说明可选方案:
- 添加后端(Express、FastAPI等)
- 使用全栈框架(Next.js、SvelteKit、Nuxt、Remix)
- 添加无服务器函数(Vercel Functions、AWS Lambda)
- 创建独立的后端服务
如果需要修改,帮助用户完成必要的更改后再继续。
如果兼容,进入阶段2。
Phase 2: API Key Setup
阶段2:API密钥设置
Use to configure credentials.
+rw-setup-api-key- Direct the user to https://dev.runwayml.com/ to create an account and API key
- Install the appropriate SDK (for Node.js,
@runwayml/sdkfor Python)runwayml - Configure the environment variable
RUNWAYML_API_SECRET - Update to exclude
.gitignore.env - Remind about credit purchase requirement ($10 minimum)
Wait for the user to confirm they have their API key before proceeding.
使用配置凭据。
+rw-setup-api-key- 引导用户访问https://dev.runwayml.com/ 创建账户并获取API密钥
- 安装合适的SDK(Node.js使用,Python使用
@runwayml/sdk)runwayml - 配置环境变量
RUNWAYML_API_SECRET - 更新以排除
.gitignore文件.env - 提醒用户需要购买 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 | |
| Animate images into video | |
| Edit/transform existing videos | |
| Generate images from text | |
| Generate images with references | |
| Text-to-speech | |
| Sound effects | |
| Voice isolation/dubbing | |
| Real-time conversational avatar | |
| Avatar with domain knowledge | |
| Multiple capabilities | Integrate each one, sharing the same client instance |
询问用户想要构建的功能,根据他们的回复使用相应的集成技能:
| 用户需求... | 使用的技能 |
|---|---|
| 文本生成视频 | |
| 图片动效转视频 | |
| 编辑/转换现有视频 | |
| 文本生成图片 | |
| 基于参考图生成图片 | |
| 文本转语音 | |
| 音效生成 | |
| 语音分离/配音 | |
| 实时对话虚拟形象 | |
| 具备领域知识的虚拟形象 | |
| 多种功能集成 | 分别集成每个功能,共享同一个客户端实例 |
Phase 4: Write the Integration Code
阶段4:编写集成代码
Based on the user's framework and needs:
- Create the API route/handler — server-side endpoint that calls Runway
- Add upload handling if the user needs to accept files from their users
- Add error handling — catch and handle task failures
- Handle output storage — remind user that output URLs expire in 24-48 hours
根据用户的框架和需求:
- 创建API路由/处理器 —— 调用Runway的服务端端點
- 添加上传处理(如果用户需要接收用户上传的文件)
- 添加错误处理 —— 捕获并处理任务失败情况
- 处理输出存储 —— 提醒用户输出URL的有效期为24-48小时
Phase 5: Test and Verify
阶段5:测试与验证
Help the user:
- Run a test generation to verify everything works
- Check for common issues (missing env var, insufficient credits, wrong model)
- Confirm output is accessible
帮助用户:
- 运行一次测试生成,验证所有功能正常工作
- 检查常见问题(缺少环境变量、credits不足、模型错误)
- 确认输出内容可访问
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-uploadsImportant 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/ 查看。