llms.py
Media Generation

Image Generation

Generate images using various LLM providers

Unlike text generation, there's no standard API for image generation across providers - each requires its own custom implementation. Despite the additional effort required, there's now seamless image generation support through both the UI and CLI with built-in integrations for:

ProviderStatus
Google✅ Supported
OpenAI✅ Supported
OpenRouter✅ Supported
Fireworks AI✅ Supported
Chutes✅ Supported
Z.ai✅ Supported
Nvidia✅ Supported

To begin select an image generation model from the Model Selector that supports image generation:

When an image generation model is selected, the chat prompt will the option to specify which aspect ratio to use for the generated images:

Command-Line Usage

Generate images using the --out image modifier:

llms --out image "cat in a hat"

Which uses the out:image chat template in llms.json for its image generation request. Before returning, any assets are saved to cache and their local path and HTTP URL returned, e.g:

Output:

Here is a cat in a hat for you! 

Saved files:
/home/mythz/.llms/cache/c9/c9b2fd2a1d95708251...5d3f467a.png
http://localhost:8000/~cache/c9/c9b2fd2a1d95708251...5d3f467a.png

Specify a Model

Use any model that supports image generation by specifying its ID or name:

llms -m "gemini-2.5-flash-image" --out image "cat in a hat"
llms -m "Gemini 2.5 Flash Image" --out image "cat in a hat"

INFO

📁 All generated images are saved to ~/.llms/cache using their SHA-256 hash as the filename.

Fireworks Image Generation Models

Fireworks hosts Black Forest Labs' FLUX.1 image generation models with fast inference and competitive per-image pricing:

ModelCostPricing
FLUX.1 Kontext Max$0.08per image
FLUX.1 Kontext Pro$0.04per image
FLUX.1 Dev FP8$0.0005per step
FLUX.1 Schnell FP8$0.00035per step

This can be found in the model selector by selecting the Image output filter:

Here are examples to demonstrate the quality of each of the FLUX.1 models:

FLUX.1 Kontext Max

FLUX.1 Kontext Max

Click to view full size

FLUX.1 Kontext Pro

FLUX.1 Kontext Pro

Click to view full size

FLUX.1 Dev

FLUX.1 Dev

Click to view full size

FLUX.1 Schnell

FLUX.1 Schnell

Click to view full size