@rongyan/image-gen-cli
v1.1.0
Published
适配多个模型厂商的图片生成命令行工具
Maintainers
Readme
@rongyan/image-gen-cli
适配多个模型厂商的图片生成命令行工具,支持 npx 一键运行,也支持全局安装。
支持的服务商
| 服务商 | 模型 | 状态 | |--------|------|------| | MiniMax | image-01 | ✅ 已支持 |
安装
方式一:npx 一键运行(无需安装)
npx @rongyan/image-gen-cli@latest "a beautiful sunset"方式二:全局安装
npm install -g @rongyan/image-gen-cli@latest安装后使用 image-gen 命令:
image-gen "a beautiful sunset"配置
首次运行时,工具会自动检测配置文件,若未配置则提示你交互式输入 API Key:
⚠ 未找到 minimax 的 API Key 配置
配置 minimax API Key
配置将保存到: ~/.@rongyan/image-gen-env.json
? MiniMax API Key: **********************
✓ minimax 配置已保存配置保存在 ~/.@rongyan/image-gen-env.json:
{
"minimax": {
"apiKey": "your-api-key-here"
}
}手动配置 / 更新 API Key
image-gen config
# 指定服务商
image-gen config --provider minimaxMiniMax API Key 获取地址:https://platform.minimaxi.com
使用
基本用法
image-gen "a cat sitting on a windowsill, watercolor style"生成的图片默认保存到当前目录,文件名格式为 image-gen-2026-03-28T12-00-00.jpg。
指定输出目录
image-gen "a beautiful sunset" --output ./images指定输出文件路径
image-gen "a beautiful sunset" --output ./images/sunset.jpg指定宽高比
image-gen "a wide landscape" --aspect-ratio 16:9支持的宽高比:1:1、16:9、9:16、4:3、3:4、3:2、2:3
指定模型
image-gen "a portrait" --model image-01完整参数说明
Usage: image-gen [options] [command] [prompt]
Arguments:
prompt 图片描述文字
Options:
-V, --version 版本号
-p, --provider <provider> 图片生成服务商 (default: "minimax")
-o, --output <path> 输出路径(目录或完整文件路径)
-r, --aspect-ratio <ratio> 宽高比 (default: "1:1")
-m, --model <model> 模型名称
-h, --help 显示帮助
Commands:
config [options] 配置 API Key示例
# 生成头像(1:1)
image-gen "a professional headshot of a young engineer"
# 生成壁纸(16:9)
image-gen "futuristic city at night, cyberpunk style" -r 16:9 -o ./wallpapers
# 生成手机壁纸(9:16)
image-gen "cherry blossom forest, anime style" -r 9:16 -o ~/Pictures/phone-wallpaper.jpg
# 使用 npx 生成并保存到指定目录
npx @rongyan/image-gen-cli "a cozy coffee shop" -o ./output系统要求
- Node.js >= 18.0.0
