Skip to main content

PiAPI CLI

在終端機中使用 94 個多模態 AI 模型

生成圖像、影片、音訊、3D 資源,以及與 LLM 對話——全部透過一條指令。適合開發者、AI 代理和自動化工作流。

使用 npm 安裝:

$ npm install -g piapi-cli

一個 CLI 支援所有 AI 模型

flux-devnano-banana-progpt-image-2qwen-imageseedream-5-litemidjourneyz-imageremove-bgupscalefaceswap

執行 piapi model list 瀏覽所有模型

$ piapi run flux-dev prompt="a corgi astronaut"

CLI 指令

$ piapi run flux-dev prompt="a corgi" aspect_ratio=16:9

生成圖像

$ piapi run gpt-4o prompt="hello" --stream

串流聊天

$ piapi run sora2-pro prompt="waves" --async

生成影片(非同步)

$ piapi run remove-bg image=@./photo.png --download

上傳並下載

完整命令參考和參數

學習 PiAPI CLI 工作流程

常見問題

What is PiAPI CLI?

PiAPI CLI is a command line interface for running PiAPI models from your terminal. It works as an AI CLI tool for image, video, audio, 3D, and chat generation workflows.

如何進行身份驗證?

執行 piapi auth login --api-key sk-xxxxx 並輸入您的 PiAPI API key。您可以從 PiAPI 工作區取得 API key。在共享機器上,建議使用環境變數 PIAPI_API_KEY=sk-...

Can I generate AI images from terminal?

Yes. Use piapi run flux-dev prompt="a corgi astronaut" or another image model to generate AI images from terminal commands. Add --download to save generated files locally.

如何上傳本地檔案?

在任何輸入前加上 @ 前綴即可上傳本地檔案。例如:piapi run remove-bg image=@./photo.png

可以與 Claude Code 或 Cursor 等 AI 代理一起使用嗎?

可以!PiAPI CLI 專為 AI 代理整合設計。使用 npx skills add PiAPI-1/piapi-cli 新增技能。

PiAPI CLI 免費嗎?

CLI 本身免費且開源(MIT 授權)。使用模型需要 PiAPI 帳戶——新帳戶可獲得免費額度試用。

如何安裝 PiAPI CLI?

使用 npm 全域安裝:npm install -g piapi-cli。也可以使用 pnpm、yarn 或 bun。或者使用 npx piapi-cli@latest 無需安裝直接執行。需要 Node.js 18+。

支援哪些模型?

PiAPI CLI 支援 94 個多模態 AI 模型:34 個圖像模型、40 個影片模型、10 個音訊模型、2 個 3D 模型和 8 個 LLM 模型。執行 piapi model list 查看所有可用模型。

Can I generate AI videos from terminal?

Yes. Use video models such as Sora, Kling, Veo, Seedance, Hailuo, and Luma to generate AI videos from terminal workflows. Video jobs usually use --async so you can check task status later.

如何下載生成的檔案?

在任何指令中新增 --download 即可自動儲存生成的檔案。使用 --out-dir ./output 指定自訂輸出目錄。

同步和非同步模式有什麼區別?

LLM 和 gpt-image-2 模型同步執行。影片和 3D 模型需要 --async 參數並回傳任務 ID 用於輪詢。