名称: runware 描述: 通过 Runware API 生成图像和视频。可访问 FLUX、Stable Diffusion、Kling AI 等顶级模型。支持文生图、图生图、图像放大、文生视频和图生视频。适用于生成图像、根据提示或图像创建视频、放大图像或进行 AI 图像转换。
Runware
通过 Runware 的统一 API 进行图像和视频生成。可访问 FLUX、Stable Diffusion XL、Kling AI 等模型。
设置
设置 RUNWARE_API_KEY 环境变量,或向脚本传递 --api-key。
获取 API 密钥: https://runware.ai
图像生成
文生图
python3 scripts/image.py gen "日落时分的赛博朋克城市,霓虹灯,雨" --count 2 -o ./images
选项:
--model: 模型 ID (默认:runware:101@1/ FLUX.1 Dev)--width/--height: 尺寸 (默认: 1024x1024)--steps: 推理步数 (默认: 25)--cfg: CFG 缩放比例 (默认: 7.5)--count/-n: 图像数量--negative: 负面提示词--seed: 可复现的种子--lora: LoRA 模型 ID--format: png/jpg/webp
图生图
转换现有图像:
python3 scripts/image.py img2img ./photo.jpg "水彩画风格" --strength 0.7
--strength: 转换强度 (0=保持原图,1=忽略原图)
图像放大
python3 scripts/image.py upscale ./small.png --factor 4 -o ./large.png
列出模型
python3 scripts/image.py models
视频生成
文生视频
python3 scripts/video.py gen "一只猫在玩毛线球,可爱,高质量" --duration 5 -o ./cat.mp4
选项:
--model: 模型 ID (默认:klingai:5@3/ Kling AI 1.6 Pro)--duration: 时长(秒)--width/--height: 分辨率 (默认: 1920x1080)--negative: 负面提示词--format: mp4/webm/mov--max-wait: 轮询超时时间 (默认: 600秒)
图生视频
为图像添加动画或在帧之间插值:
# 单张图像(作为第一帧)
python3 scripts/video.py img2vid ./start.png --prompt "缓慢拉远镜头" -o ./animated.mp4
# 两张图像(第一帧和最后一帧)
python3 scripts/video.py img2vid ./start.png ./end.png --duration 5
列出视频模型
python3 scripts/video.py models
热门模型
图像
| 模型 | ID |
|---|---|
| FLUX.1 Dev | runware:101@1 |
| FLUX.1 Schnell (快速) | runware:100@1 |
| FLUX.1 Kontext | runware:106@1 |
| Stable Diffusion XL | civitai:101055@128080 |
| RealVisXL | civitai:139562@297320 |
视频
| 模型 | ID |
|---|---|
| Kling AI 1.6 Pro | klingai:5@3 |
| Kling AI 1.5 Pro | klingai:3@2 |
| Runway Gen-3 | runwayml:1@1 |
浏览全部模型: https://runware.ai/models
注意事项
- 视频生成是异步的;脚本会轮询直到完成
- 成本因模型而异 — 查看 https://runware.ai/pricing
- FLUX 模型质量出色;Schnell 速度更快
- 要获得最佳视频效果,请使用包含动作词汇的描述性提示词