img-cli

AI agent

Claude Code、Codex、Cursor 以及其他能运行命令的助手都能很好地使用 img-cli,因为它的命令、输出和退出码对每个 provider 都一样。agent 只要学一次,就能使用你安装的任何 provider。

把 CLI 交给你的 agent

不需要往 AGENTS.md 或 CLAUDE.md 粘贴一长串说明——img-cli --help、img-cli <command> --help 和 img-cli models show 已经把所有命令、参数、JSON 输出和退出码写清楚了。只需要放两句话(或者直接在对话里提到 img-cli):

## Generating media with img-cli

Use `img-cli` to generate images, video, speech, and music.
Run `img-cli --help` and `img-cli models show <provider:model> --json` first,
pass `--json -q`, never resubmit on exit code 9, and never ask for API keys in chat.

完整的英文文档也提供了单文件版本:https://img-cli.dev/llms.txt。

查看可用的内容

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

输出与错误

上面说明中提到的 JSON 结构和退出码,见输出与退出码。