npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@lpenguin/openai-image-cli

v1.0.3

Published

CLI tool for generating images using OpenAI's DALL-E models

Downloads

269

Readme

openai-image-cli

A command-line interface tool for generating images using OpenAI's DALL-E models (dall-e-3, dall-e-2, gpt-image, and gpt-image-mini).

Features

  • Generate images using DALL-E 3, DALL-E 2, GPT-Image, or GPT-Image Mini
  • Customizable image sizes
  • Support for multiple image generation (dall-e-2 only)
  • Automatic image download and saving
  • Simple command-line interface
  • Written in TypeScript for type safety

Installation

Using npx (Recommended)

Run directly without installation:

npx openai-image-cli "A sunset over mountains"

Global Installation

npm install -g openai-image-cli

Local Development

  1. Clone the repository:
git clone https://github.com/lpenguin/openai-image-cli.git
cd openai-image-cli
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Set up your OpenAI API key:
export OPENAI_API_KEY=your-api-key-here

Usage

Basic Usage

npx openai-image-cli "A sunset over mountains"
# or if installed globally
openai-image "A sunset over mountains"
# or if running locally
node dist/index.js "A sunset over mountains"

With Options

npx openai-image-cli --prompt "A cat playing piano" --size 1024x1024 --n 1

Using Different Models

# DALL-E 2 with multiple images
npx openai-image-cli "Abstract art" --model dall-e-2 --size 512x512 --n 2

# GPT-Image
npx openai-image-cli "Modern design" --model gpt-image --size 1024x1024

# GPT-Image Mini
npx openai-image-cli "Quick sketch" --model gpt-image-mini

Command-Line Options

  • --prompt <text> - Image generation prompt (required if not using positional argument or --prompt-file)
  • --prompt-file <path> - Path to file containing the prompt (alternative to --prompt)
  • --size <size> - Image size (default: 1024x1024)
    • DALL-E 3 sizes: 1024x1024, 1024x1792, 1792x1024
    • DALL-E 2 sizes: 256x256, 512x512, 1024x1024
    • GPT-Image sizes: 1024x1024, 1024x1792, 1792x1024
    • GPT-Image Mini sizes: 1024x1024, 1024x1792, 1792x1024
  • --n <number> - Number of images to generate (default: 1)
    • Note: DALL-E 3, GPT-Image, and GPT-Image Mini only support n=1
  • --model <model> - Model to use: dall-e-3, dall-e-2, gpt-image, or gpt-image-mini (default: dall-e-3)
  • --help, -h - Show help message

Environment Variables

  • OPENAI_API_KEY (required) - Your OpenAI API key

Examples

Generate a single image with DALL-E 3:

export OPENAI_API_KEY=sk-...
npx openai-image-cli "A futuristic city at night"

Generate an image using a prompt from a file:

npx openai-image-cli --prompt-file my-prompt.txt --model dall-e-3

Generate multiple images with DALL-E 2:

npx openai-image-cli "A cute robot" --model dall-e-2 --size 512x512 --n 3

Generate a wide image with GPT-Image:

npx openai-image-cli "A panoramic landscape" --model gpt-image --size 1792x1024

Use GPT-Image Mini for faster generation:

npx openai-image-cli "A simple sketch" --model gpt-image-mini

Output

Generated images are automatically downloaded and saved to the current directory with filenames like:

  • generated_image_<timestamp>_1.png
  • generated_image_<timestamp>_2.png

Development

Build the project:

npm run build

The TypeScript source is in src/ and compiles to dist/.

License

ISC