AI agents

Claude Code, Codex, Cursor, and other assistants that can run commands use img-cli well, because its commands, output, and exit codes are the same for every provider. An agent that learns them once can use any provider you install.

Let the agent set it up

The Install with your assistant button on the home page copies a prompt for your agent. The agent installs img-cli, asks you to add a provider and log in yourself, and adds the instructions below to its own notes.

Give your agent the CLI

Paste this into your agent's instructions, such as AGENTS.md or CLAUDE.md:

## Generating media with img-cli

Use the `img-cli` CLI to generate images, video, and speech.

- Always pass `--json -q`. Results are JSON on stdout; errors are JSON on stderr.
- Models are `provider:model`. List them with `img-cli models list --kind <image|video|speech> --json`,
  and read the flags a model accepts with `img-cli models show <provider:model> --json`.
- Use only the flags in the model's `supports`. Common ones: `--aspect 16:9`, `--size 2K`,
  `--resolution 720p`, `--duration 5`, `--ref <url-or-file>` (repeatable), `--first-frame`.
- Preview a request with `--dry-run`; it sends nothing and costs nothing.
- Add `-o <dir>` to save results; the JSON then lists local paths in `outputs[].file`.
- For video, pass `--no-wait`, then run `img-cli task wait <task> --json -q -o <dir>`.
  Exit code 8 means the task is still running: run `task wait` again.
- Exit code 2 means a flag or value was wrong and nothing was sent: fix it from `models show`.
- Exit code 9 after submitting means the request may have reached the provider. Do not
  resubmit; tell the user, since a second submit may be charged.
- If a provider is missing (`provider ... is not installed`) or has no key (exit code 3), ask
  the user to run `img-cli provider add <name>` and `img-cli provider login <name>` themselves.
  Never ask them to paste an API key into the chat.

The full English docs are also available as one file at https://img-cli.dev/llms.txt.

Discover what is available

img-cli provider list --json                   # installed providers and where their keys come from
img-cli models list --json                     # every model
img-cli models show <provider:model> --json    # the flags one model accepts
img-cli <command> --help                       # one command, as text

Output and errors

The JSON shapes and exit codes the instructions above refer to are in Output and exit codes.