介绍
# Reve AI Image Generation
使用 Reve 的 AI API 生成、编辑和混合图像。
## 前置条件
- Bun 运行时 - 设置了 `REVE_API_KEY` 或 `REVE_AI_API_KEY` 环境变量
## 快速使用
```bash # Generate image from prompt bun scripts/reve.ts create "A beautiful sunset over mountains" -o sunset.png
# With aspect ratio bun scripts/reve.ts create "A cat in space" -o cat.png --aspect 16:9
# Edit existing image bun scripts/reve.ts edit "Add dramatic clouds" -i photo.png -o edited.png
# Remix multiple images bun scripts/reve.ts remix "Person from <img>0</img> in scene from <img>1</img>" -i person.png -i background.png -o remix.png ```
## 命令
### create
根据文本提示生成新图像。
选项: - `-o, --output FILE` — 输出文件路径(默认:output.png) - `--aspect RATIO` — 纵横比:16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 1:1(默认:3:2) - `--version VER` — 模型版本(默认:latest)
### edit
使用文本指令修改现有图像。
选项: - `-i, --input FILE` — 要编辑的输入图像(必需) - `-o, --output FILE` — 输出文件路径(默认:output.png) - `--version VER` — 模型版本:latest, latest-fast, reve-edit@20250915, reve-edit-fast@20251030
### remix
将文本提示与参考图像结合。在提示中使用 `<img>N</img>` 通过索引(从 0 开始)引用图像。
选项: - `-i, --input FILE` — 参考图像(可指定多个,最多 6 个) - `-o, --output FILE` — 输出文件路径(默认:output.png) - `--aspect RATIO` — 纵横比(选项与 create 相同) - `--version VER` — 模型版本:latest, latest-fast, reve-remix@20250915, reve-remix-fast@20251030
## 限制
- 最大提示长度:2560 个字符 - remix 的最大参考图像数:6 - 有效的纵横比:16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 1:1
## 响应
脚本输出包含生成详情的 JSON: ```json { "output": "path/to/output.png", "version": "reve-create@20250915", "credits_used": 18, "credits_remaining": 982 } ```
## 错误
- `401` — 无效的 API 密钥 - `402` — 积分不足 - `429` — 请求频率受限(包含 retry_after) - `422` — 输入无效(提示过长、纵横比错误)