# imagine-cli

> Command-line tool for generating and editing images with Gemini and OpenAI models

- Repository: https://github.com/AhmedAburady/imagine-cli
- Category: Image, video & audio
- Stars: 65 · Forks: 7 · Language: Go · License: AGPL-3.0
- Experience: Beginner friendly
- Page: https://ir.adyog.com/repos/ahmedaburady/imagine-cli/

Some of the best image models are mostly used through web pages. Imagine gives you a command, imagine -p "your prompt", that calls them directly through their APIs and saves the result as a PNG in your current folder. It supports Gemini, Vertex AI and OpenAI.

Setup is one config file at ~/.config/imagine/config.yaml, with no environment variables needed. You can add a provider with imagine providers add. For OpenAI you can use an API key, or sign in with a ChatGPT Plus, Pro or Team plan. The README says the subscription route uses an unpublished endpoint, so it may stop working. The API key is the stable fallback.

The same command generates or edits: add -i reference.png and it edits that image instead. You can also pass a YAML or JSON file to -p to run many jobs in parallel, each with its own prompt, provider and size. The README names its predecessor, banana-cli, which only supported Google's models. Imagine is built so new providers can be added as a directory under providers/.

## What it does

- **Generate and edit in one command**: -p with a prompt generates an image. Adding -i with a reference image switches the same command to edit mode.
- **Concurrent generation**: -n 10 produces ten images in one run, so you can compare variations without waiting for each one.
- **Batch runs from a file**: Point -p at a YAML or JSON file and every entry runs in parallel, with mixed providers, models and sizes. The file is validated before any request is sent, and a summary table is printed at the end.
- **Composable prompts**: -p can be repeated, so you can join reusable prompt files and one-off text into a single prompt.
- **Flexible credentials**: Keys can be literal, read from ${VAR} environment variables, or fetched from 1Password with op:// references. OpenAI can also use a ChatGPT subscription login.

## What you could build

- Generate a set of image variations from one prompt with -n and keep the best.
- Edit an existing picture by passing it with -i and a short instruction.
- Run a YAML file of many scenes across Gemini and OpenAI in one command.
- Call image generation from shell scripts or CI jobs to produce reproducible image sets.
- Keep a library of style prompt files and mix them per run.

## Who it's for

Suits developers comfortable with a terminal who have a Gemini or OpenAI key (or a ChatGPT plan) and want image generation in scripts. Note it is AGPL-3.0 licensed.

## Get started

Install with Go 1.26 or later, or download a pre-built binary from Releases. Add a provider with your API key, then run a prompt. A timestamped PNG is saved in the current directory.

```
go install github.com/AhmedAburady/imagine-cli/cmd/imagine@latest
```
```
imagine providers add gemini --api-key AIza-your-key
```
```
imagine -p "a cyberpunk city at night with neon lights"
```

Tags: image-generation, cli, gemini, openai, go
