gen-ai-use
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesegen-ai CLI — Usage Guide
gen-ai CLI — 使用指南
The CLI generates AI images, videos, and audio from the terminal via the Picsart API.
gen-aigen-aiWhen to Use
使用场景
See the description above.
请参考上方描述。
Prerequisites
前置条件
Picsart CLI installed and authenticated ().
gen-aigen-ai login已安装并完成Picsart CLI的身份验证(执行)。
gen-aigen-ai loginHow to Run
运行方式
Use the agent's tool to invoke commands as described in the Procedure below.
terminalgen-ai使用Agent的工具,按照下方步骤调用命令。
terminalgen-aiQuick Reference
快速参考
- Auth: ,
login,logoutwhoami - Generation: ,
generate,remove-bg,change-bg,enhance,vectorize,redoextend - Models / pricing: ,
models,models info,models compare,pricing,creditsvalidate - Batch: ,
batch run,batch statusbatch resume - Drive: ,
upload,downloadlist - Config:
config get | set | list | keys | unset - History: ,
history,history last,history fileshistory clear - Utilities: ,
completionupdate
Run for full flag details, or see references/FLAGS.md.
gen-ai <command> --help- 身份验证: ,
login,logoutwhoami - 生成操作: ,
generate,remove-bg,change-bg,enhance,vectorize,redoextend - 模型/定价: ,
models,models info,models compare,pricing,creditsvalidate - 批量处理: ,
batch run,batch statusbatch resume - Drive操作: ,
upload,downloadlist - 配置:
config get | set | list | keys | unset - 历史记录: ,
history,history last,history fileshistory clear - 实用工具: ,
completionupdate
执行查看完整参数详情,或参考references/FLAGS.md。
gen-ai <command> --helpProcedure
操作步骤
See sections below for the detailed walkthrough.
请查看下方章节获取详细操作流程。
Pitfalls
常见陷阱
- Stale model ID — using a name from memory that's been renamed/removed → run first or
gen-ai models.gen-ai validate -m <id> - Passing to a non-i2v video model — it's silently ignored, not auto-mapped. Confirm with
--image.gen-ai models info <id> - Forgetting in CI — the CLI sits waiting for an interactive prompt and the job times out. Always pair
--no-input(or--script) with non-TTY contexts.--no-input - Mixing and
--multi— they're mutually exclusive--batchmodes; pick one.--input-dir
- 过时的模型ID — 使用记忆中已重命名/移除的模型名称 → 先执行或
gen-ai models确认。gen-ai validate -m <id> - 向非图像转视频(i2v)模型传递参数 — 该参数会被静默忽略,不会自动映射。请通过
--image确认模型支持的参数。gen-ai models info <id> - 在CI环境中忘记添加— CLI会等待交互式输入,导致任务超时。在非TTY环境中,务必搭配
--no-input(或--script)使用。--no-input - 同时使用和
--multi— 二者是互斥的--batch模式,请选择其中一种。--input-dir
Verification
验证方法
Run to confirm authentication, then re-run the failed command with .
gen-ai whoami--debug执行确认身份验证状态,然后添加参数重新运行失败的命令。
gen-ai whoami--debugWhere to look
参考文档位置
- Flags & full command list → references/FLAGS.md
- Batch generation (manifests, concurrency, stress tests) → references/BATCH.md
- Picsart Drive (upload, download, list) → references/DRIVE.md
- Advanced (validate, extend VEO, interactive mode, piping) → references/ADVANCED.md
- Troubleshooting (dry-run, debug, common errors) → references/TROUBLESHOOTING.md
- Example workflows (image → video, cross-model comparison) → references/EXAMPLES.md
- Shell completions (bash, zsh, fish) → references/COMPLETIONS.md
- 参数与完整命令列表 → references/FLAGS.md
- 批量生成(清单、并发、压力测试)→ references/BATCH.md
- Picsart Drive(上传、下载、列表)→ references/DRIVE.md
- 高级功能(验证、扩展VEO、交互模式、管道操作)→ references/ADVANCED.md
- 故障排查(空运行、调试、常见错误)→ references/TROUBLESHOOTING.md
- 示例工作流(图像转视频、跨模型对比)→ references/EXAMPLES.md
- Shell补全(bash、zsh、fish)→ references/COMPLETIONS.md
When NOT to use
不适用场景
- SDK-level integration questions → consult the reference /
@picsart/ai-sdksourcespecs/ - Picsart web miniapp or mobile flows → unrelated
- New backend models that aren't in the catalog yet → backend MR first; CLI picks them up automatically once they ship in
@picsart/ai-sdk
- SDK级集成问题 → 请参考文档或
@picsart/ai-sdk源码specs/ - Picsart网页小程序或移动端流程 → 与此工具无关
- 尚未加入目录的新后端模型 → 先提交后端MR;一旦模型在中发布,CLI会自动同步支持
@picsart/ai-sdk
Install & auth
安装与身份验证
bash
undefinedbash
undefinedSigned binary (no Node required) — recommended
签名二进制文件(无需Node)—— 推荐方式
curl -fsSL https://picsart.com/gen-ai-cli/install.sh | bash
curl -fsSL https://picsart.com/gen-ai-cli/install.sh | bash
Or via npm (requires Node 22+)
或通过npm安装(需要Node 22+)
npm install -g @picsart/gen-ai
gen-ai login # OAuth browser flow
gen-ai whoami # verify
undefinednpm install -g @picsart/gen-ai
gen-ai login # OAuth浏览器流程
gen-ai whoami # 验证身份
undefinedGenerate
生成内容
bash
undefinedbash
undefinedInteractive wizard
交互式向导
gen-ai generate
gen-ai generate
Image, fully specified
完全指定参数生成图像
gen-ai generate -m flux-2-pro -p "a sunset over mountains" -s
gen-ai generate -m flux-2-pro -p "a sunset over mountains" -s
Image-to-image
图像转图像
gen-ai generate -m gemini-3.1-flash-image -i ~/photo.jpg -p "make it watercolor"
gen-ai generate -m gemini-3.1-flash-image -i ~/photo.jpg -p "make it watercolor"
Text-to-video
文本转视频
gen-ai generate -m kling-v3-pro -p "a cat playing piano" --ar 16:9
gen-ai generate -m kling-v3-pro -p "a cat playing piano" --ar 16:9
Image-to-video (--image is auto-mapped to startFrame for i2v models)
图像转视频(对于i2v模型,--image会自动映射为startFrame)
gen-ai generate -m veo-3.1 -i ~/photo.jpg -p "camera zooms in" -d 5
undefinedgen-ai generate -m veo-3.1 -i ~/photo.jpg -p "camera zooms in" -d 5
undefinedImage operations
图像操作
bash
gen-ai remove-bg -i photo.jpg
gen-ai change-bg -i photo.jpg -p "tropical beach sunset"
gen-ai enhance -i photo.jpg # upscale / enhance
gen-ai vectorize -i logo.png # raster → SVGAll operation commands accept the same output flags as (, , , , , , , etc.). See references/FLAGS.md.
generate--download--save-to-drive--drive-folder--open--clipboard--json--quietbash
gen-ai remove-bg -i photo.jpg
gen-ai change-bg -i photo.jpg -p "tropical beach sunset"
gen-ai enhance -i photo.jpg # 放大/增强画质
gen-ai vectorize -i logo.png # 栅格图转SVG所有操作命令都支持与相同的输出参数(、、、、、、等)。详情请参考references/FLAGS.md。
generate--download--save-to-drive--drive-folder--open--clipboard--json--quietBrowse models, check pricing
浏览模型、查看定价
Model IDs change as new versions ship — always check the live catalog:
bash
gen-ai models # list (filter --mode, --provider)
gen-ai models info <id> # capabilities, inputs, aspect ratios
gen-ai models compare <a> <b> # side-by-side
gen-ai pricing <model-id> # credit cost
gen-ai credits # remaining balance模型ID会随新版本发布而变化,请始终查看实时目录:
bash
gen-ai models # 列出模型(可通过--mode、--provider过滤)
gen-ai models info <id> # 查看模型能力、输入要求、宽高比
gen-ai models compare <a> <b> # 对比两个模型
gen-ai pricing <model-id> # 查看信用点成本
gen-ai credits # 查看剩余余额Important defaults
重要默认设置
- Drive auto-save — results save to Picsart Drive in folder by default. Disable with
gen-ai-cli; use--no-save-to-drivefor a custom folder.--drive-folder NAME - startFrame mapping — for i2v models (VEO, Kling i2v, Wan, Luma, Seedance, Runway), is auto-mapped to
-i / --image.ctx.startFrame - Script mode — =
--script, the right combo for piping or CI.--silent --quiet --json - CI mode — pass to fail fast instead of hanging on interactive prompts.
--no-input
- Drive自动保存 — 结果默认保存到Picsart Drive的文件夹中。可通过
gen-ai-cli禁用;使用--no-save-to-drive指定自定义文件夹。--drive-folder NAME - startFrame映射 — 对于i2v模型(VEO、Kling i2v、Wan、Luma、Seedance、Runway),会自动映射为
-i / --image。ctx.startFrame - 脚本模式 — 等价于
--script,适合管道操作或CI环境。--silent --quiet --json - CI模式 — 添加参数可避免等待交互式输入,快速失败。
--no-input
When to reach for the reference files
何时查看参考文档
- Many generations at once, or retry/resume → references/BATCH.md
- Files in/out of Drive → references/DRIVE.md
- Validation, VEO extension, scripting → references/ADVANCED.md
- A command is failing → references/TROUBLESHOOTING.md
- Chaining (image → video) or comparing models → references/EXAMPLES.md
- Tab completion → references/COMPLETIONS.md
- All flags / all commands → references/FLAGS.md
- 需要批量生成、重试/恢复任务 → references/BATCH.md
- 处理Drive中的文件 → references/DRIVE.md
- 验证、扩展VEO、脚本编写 → references/ADVANCED.md
- 命令执行失败 → references/TROUBLESHOOTING.md
- 链式操作(图像转视频)或模型对比 → references/EXAMPLES.md
- 标签补全 → references/COMPLETIONS.md
- 所有参数/命令 → references/FLAGS.md