Guides
AI Image Generator CLI: Generate Images From Your Terminal
Generate images from your terminal with a zero-dependency CLI. Real scripting and agent workflows with dpf, plus an honest comparison with single-model tools.
Yes, you can generate images without leaving your terminal, and if you live in a shell, that is a better place to make them than a web app: images become a command you can script, pipe, and hand to an agent. This guide covers the honest state of command-line image generation in 2026, then shows real workflows with dpf, the zero-dependency CLI for Dream Pixel Forge, which is built for exactly this.
Most terminal image tools do one thing: take a prompt, call one model, print a URL. That is fine for a quick render. It is not enough when the images have a brand attached, need to stay consistent across a set, or get produced by an agent that has to know whether the result is any good. That gap is the whole reason to read past the first result on the search page.
Generate an image from the terminal in three commands
The CLI ships as an npm package called dreampixel-cli that installs a dpf binary. It has no runtime dependencies (nothing but Node built-ins), needs Node 20 or newer, and talks to the platform over plain HTTPS. There is nothing to build and no SDK to configure. First, authenticate this machine:
npx dreampixel-cli loginThat opens your browser to approve the device (more on why that flow is safe below). After approval, generation is scoped to a run, a small unit of work that carries your brief and tracks what it spends. Create one, sketch a concept, then generate against it:
dpf run create "launch sheet for the spring capsule"
# -> prints a runId
dpf run plan <runId> "hero: wide shot on set" "detail: fabric close-up"
dpf generate <runId> hero --prompt "wide editorial shot, model on a sunlit set, spring capsule" --ar 16:9The generate call returns the image as a URL, not a file on disk. That is deliberate: a URL is what you pipe into the next step, whether that is a download, a validation pass, or an upload. Check the run at any time, and add --watch to poll until every concept settles:
dpf run status <runId> --watchYou can also generate from a named template instead of a raw prompt. List what is available with dpf templates, then pass a slug and its inputs:
dpf generate <runId> hero --template product-mockup --input color=red --ar 1:1What makes a command-line image generator worth installing
A wrapper around one image endpoint is a weekend project, and the search results are full of them. The features that make a CLI worth keeping in your PATH are the ones a single fetch call cannot give you.
- Model routing, not a hardcoded model. A generation request is routed across the available image and video models by a server-side policy, with fallback if a provider is down, so your script does not break when one model is deprecated or rate-limited. You describe the image; the platform picks the engine.
- Brand and character context. The same command that generates a plain image can pull a brand profile or a locked persona into the request, so the output matches your palette, product, or a consistent face across a whole set. That is the difference between a folder of related-looking pictures and a usable campaign.
- Built-in validation.
dpf visionruns a vision model over a generation to inspect it or validate it against the brief, and returns a verdict. An agent can read that verdict and decide whether to accept the image or regenerate, which is the loop a bare generator cannot close. - One credit system. Images, video, brand context, and validation all draw from the same balance, so there is no per-provider billing to reconcile.
None of that requires you to write prompts by hand or wire up a model SDK. The routing and the brand context are the product; the CLI is just the thinnest possible way to reach them from a shell.
How does dpf login keep your API key safe?
The device flow is the part worth understanding, because it changes the threat model. When you run dpf login, the CLI mints a random API key locally and never sends it anywhere. It computes a SHA-256 hash of the key and sends only that hash to the server to start the device approval. You approve the machine in the browser, which binds that hash to your account, and the plaintext key is written to disk on your machine only, at ~/.config/dpf/config.json with 0600 permissions.
The practical consequence: a compromised network, a leaked server log, or a breach of the approval endpoint yields the hash, not a usable key. Every command after login is a single HTTPS request to the /api/mcp endpoint with an Authorization: Bearer header; login itself is the only step that touches the device endpoints. If you would rather manage the key yourself, set DPF_API_KEY in the environment and it takes precedence over the stored one, which is how you would run this in CI. dpf whoami shows which key is in effect and confirms it authenticates; dpf logout removes the stored file.
Real terminal workflows
The reason to generate images from the command line is composition. Here are three workflows that a web UI cannot match.
Batch brand assets in one sitting
Because generation is scoped to a run with a plan, you describe the shots once and generate them as a set rather than clicking through a UI. Plan a hero, a detail, and a lifestyle frame, generate each against the same brand context, then validate the batch before anyone sees it. When you are producing ad variations or a listing set, the same pattern applies, and you can prototype the look in the browser first:
Pipe results into a build script
Every command takes a global --json flag that prints the raw result instead of the human-readable rendering, which makes the CLI scriptable. Capture the run status as JSON, extract the image URLs with jq, and fetch them into your assets directory as part of a build:
dpf run status <runId> --json \
| jq -r '.generations[] | select(.status=="succeeded") | .url' \
| while read url; do curl -sSL "$url" -O; doneBecause the CLI returns URLs rather than downloading files itself, you decide where the bytes land. Success goes to stdout and failures to stderr with a non-zero exit code, so a failed generation stops your pipeline instead of silently shipping a broken asset.
Let an agent run the campaign
The same tools the CLI calls are exposed over MCP, so an AI coding agent can drive the whole loop: create a run, plan concepts, generate, validate with vision, and regenerate the ones that fail the brief. Install the agent skill next to your project so the agent knows the commands:
dpf skill installThat writes a skill file the agent reads, and from there Claude, Codex, or any MCP client can create on-brand visuals without you typing a single prompt. This is the workflow the agentic creation setup is built around.
How it compares to other command-line image generators
The honest picture: most of what ranks for these searches is a thin CLI over a single provider. A command-line front end for Google's Gemini image models, a wrapper around the OpenAI image API, a GitHub script that pipes a prompt to one Stable Diffusion endpoint. They are genuinely useful when you want one model and one image, and if that is all you need, install one and move on. A few tools, like Masonry, do route across multiple image and video models the way a mature platform should.
Where dpf is different is the layer above the model. A single-model wrapper cannot carry your brand palette into the request, cannot hold a persona consistent across a set, and cannot tell you whether the image it just made actually matches the brief. Those are the parts that turn terminal image generation from a novelty into a production step. The comparison, kept honest:
| Capability | Single-model CLI | dpf CLI |
|---|---|---|
| Prompt to image from the terminal | Yes | Yes |
| Routes across models with fallback | Rarely | Yes |
| Brand and persona context in the request | No | Yes |
| Built-in vision validation of results | No | Yes |
| Runnable by an MCP agent | No | Yes |
| Zero runtime dependencies | Varies | Yes |
If you want the fastest path to a single render, a one-model tool wins on simplicity. If the images represent a brand, ship in sets, or get made by an agent, the layer above the model is the point, and that is what this CLI exists to reach.
The bottom line
Generating images from a terminal is a solved problem for one-off renders and an open one for real work. Install a single-model wrapper when you need a quick picture. Reach for a CLI with model routing, brand context, and validation when the output has to be consistent, on-brand, or agent-driven. With dpf that is three commands to your first image and one credit system behind all of it. See pricing for how credits work, or start from the CLI and MCP setup.






