Skip to main content

LLM plugin for OpenAI and Google image generation and editing

Project description

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_openai_images-0.3.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_openai_images-0.3.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_openai_images-0.3.0.tar.gz.

File metadata

  • Download URL: llm_openai_images-0.3.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for llm_openai_images-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d7c4a7a7290908fd4ef02dc70c4a50091c0bdd49906a4d78aa5a9743ed31e880
MD5 65392f1a3d279eb9ef9aa4e4b54a1014
BLAKE2b-256 1bb7586a4d41206ef608bca7fe454497d470f654d34567d029ba5eaa81a5b4c1

See more details on using hashes here.

File details

Details for the file llm_openai_images-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_openai_images-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 430255074a4f998e5e7ffe3953276185dc9e59e3f068d9ed4e0eb5ff14facd65
MD5 e0142aac75cf37969944d542aed6b8b8
BLAKE2b-256 0b9b70b1d399afc69ebea600c6245160a43b68dcc86cae4a33e912da2a371a97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page