Imagifly logoImagiflyDeveloper docs
Agents

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 --help

Sign in

imagifly auth login --agent Cursor

A 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 logout

To check that the login works:

imagifly +me

Exit 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

CommandWhat it does
imagifly auth login --agent <name>Open the browser to sign in
imagifly auth logoutSign out
imagifly auth statusShow the current login
imagifly +meCheck that the login works
imagifly creditsShow the current credit balance
imagifly models imageList image models
imagifly models videoList video models
imagifly image generate --prompt "..." --model <id>Generate an image
imagifly image historyList 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.png

Useful 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.png

Generate 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

ExitMeaning
0Success. Checking a task that is still generating is also 0
2Bad arguments
3Not signed in, or the login expired
4Generation failed, or the wait timed out
1Network 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.

On this page