CLI
Install the Imagifly CLI, sign in, and generate images or videos from the terminal.
The Imagifly CLI is a command-line tool that uses the same account, credits and models as the website. After you install it, you can generate from the terminal, or let an agent such as Cursor or Claude Code call it for you.
You need Node.js 18 or newer.
Install
npm install -g @imagifly/cli
imagifly --helpSign in
imagifly auth login --agent CursorA browser window opens the authorization page. Sign in to Imagifly and click Allow. Replace Cursor with the tool you are using, such as Claude Code or Codex — that name appears on the Allow page.
After a successful login the token stays on this computer. Do not share it. You can review or revoke authorized tools in the Skill console.
imagifly auth status
imagifly auth logoutTo check that the login works:
imagifly +meExit code 0 means you are signed in.
If you would rather have an agent install it for you, send it this sentence:
Please read https://imagifly.net/cli/setup.md and follow the steps to install and configure the Imagifly CLI.Commands
| Command | What it does |
|---|---|
imagifly auth login --agent <name> | Open the browser to sign in |
imagifly auth logout | Sign out |
imagifly auth status | Show the current login |
imagifly +me | Check that the login works |
imagifly credits | Show the current credit balance |
imagifly models image | List image models |
imagifly models video | List video models |
imagifly image generate --prompt "..." --model <id> | Generate an image |
imagifly image history | List recent image generations, including the credits each one used |
imagifly image get --id gen_... | Check an image task. The result includes generation.cost |
imagifly video generate --prompt "..." --model <id> | Generate a video |
imagifly video get --id vid_... | Check a video task |
Use the model ids, prices, ratios and durations returned by models image / models video.
A successful command prints one JSON object. Progress and help go to a separate stream and can usually be ignored.
Generate an image
List models, then generate:
imagifly models image
imagifly image generate --prompt "A rainy teahouse at dusk" --model <id> --ratio 16:9 --wait --out tea.pngUseful flags: --quality high, --resolution-tier 1k, --steps 20, --reference file.png (repeatable). --wait waits until the image is ready or the task fails. --out must be used with --wait and saves the first image.
If you already have a task id:
imagifly image get --id gen_... --out tea.pngGenerate a video
imagifly models video
imagifly video generate --prompt "A 5-second walk through a rainy teahouse" --model <id> --duration 5s --wait --out clip.mp4--duration must be a length the model supports, such as 5s. Other flags depend on the model: --variant, --fps, --size, --ratio, --first-frame, --last-frame.
If something fails
| Exit | Meaning |
|---|---|
| 0 | Success. Checking a task that is still generating is also 0 |
| 2 | Bad arguments |
| 3 | Not signed in, or the login expired |
| 4 | Generation failed, or the wait timed out |
| 1 | Network or unexpected error |
Failed commands print error and message in the JSON. Use error for not enough credits or a rejected request. Credits are reserved when a task is accepted; if you close the terminal, check the same task id instead of submitting again. Failed tasks are refunded.
You can also call the HTTP API, or connect the same tools over MCP.
