Skip to main content

llm-openai-images

PyPI

An LLM plugin providing access to OpenAI's gpt-image-1.5 and Google's Nano Banana models for image generation and editing.

Installation

Install this plugin in the same environment as LLM.

llm install llm-openai-images

API Key Setup

You will need API keys for the providers you want to use.

OpenAI:

llm keys set openai

Enter your key when prompted. You can obtain a key from the OpenAI Platform.

Google (Gemini API):

llm keys set gemini

Enter your key when prompted. You can obtain a key from Google AI Studio.

Output Files

The plugin writes images to files and prints the output path. By default, files are written to the current working directory using this naming scheme:

<model>_<timestamp>.png

To override the output path, use -o output:

llm -m openai/gpt-image-1.5 "Prompt..." -o output path/to/file.png

Usage

This plugin adds the following models to LLM:

  • openai/gpt-image-1.5
  • google/nano-banana
  • google/nano-banana-pro

Basic Image Generation

To generate an image from a text prompt:

llm -m openai/gpt-image-1.5 "A cat wearing sunglasses, riding a skateboard"

Generation Options

You can control the image size and quality using options (-o):

  • -o size <value>: Set the image dimensions.
    • square (default): 1024x1024
    • portrait: 1024x1536
    • landscape: 1536x1024
  • -o quality <value>: Set the image quality/detail.
    • high: ~$0.26
    • medium (default): ~$0.06
    • low: ~$0.015

These options apply to openai/gpt-image-1.5 only. Google Nano Banana models currently ignore them.

For Google Nano Banana models, you can set:

  • -o aspect_ratio <value>: Set the image aspect ratio (default: 1:1).
    • 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

Example with options:

llm -m openai/gpt-image-1.5 "Impressionist painting of a harbor at sunset" \
  -o size landscape -o quality high \
  -o output harbor_sunset_hd_landscape.png

Editing an Image

To edit an existing image, provide the image file as an attachment using the -a or --attach flag. The prompt should describe the desired changes or additions to the image.

# First, generate an image or use an existing one (e.g., cat_skateboard.png from above)

# Now, edit it:
llm -m openai/gpt-image-1.5 "Add a small blue bird perched on the cat's head" \
  -a cat_skateboard.png \
  -o output cat_skateboard_with_bird.png

Combining Multiple Images

llm -m openai/gpt-image-1.5 "A photo of me dressed in these pants and top" \
  -a maison-martin-margiela-ss16-blouse.jpg \
  -a dior-homme-19cm-mij.jpg \
  -a me.jpg \
  -o output my_fabulous_self.png

Nano Banana (Google) Examples

llm -m google/nano-banana "A kitten with prominent purple-and-green fur."
llm -m google/nano-banana-pro "A cinematic portrait of a hummingbird" \
  -o output hummingbird.png

Development

To set up this plugin locally, first checkout the code. Then install it in editable mode:

cd llm-openai-images
llm install -e .

See the LLM plugin documentation for more details on plugin development.

Metadata

Release files for llm-openai-images 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-openai-images 0.3.1
File Size Uploaded
llm_openai_images-0.3.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-openai-images 0.3.1
File Interpreter ABI Platform
llm_openai_images-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / llm_openai_images-0.3.1.tar.gz

Download URL llm_openai_images-0.3.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2e25cbf8cbdcf9bf017e2c6b7e183dc9cf570794e989209353d6d2effb10d60b
BLAKE2b-256 checksum
How to use checksums
4f10a18ad31464fa6754df831dd1c42c9b284c6a17884f1258cdb029017f9f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / llm_openai_images-0.3.1-py3-none-any.whl

Download URL llm_openai_images-0.3.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60b0a6bbf5e49a7292d5adb545b2bceedd91ed13aa98dfae9d736e251b9bc27b
BLAKE2b-256 checksum
How to use checksums
85b12a161f44641a2e2f43085fbb68c3aaf6d4c65574e4c09f57203a879531bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page