Generate and edit images using Gemini image models (gemini-3-pro-image-preview, gemini-3.1-flash-image-preview). Use when the user wants to create, generate, edit, or transform images via AI. Triggers on requests like "generate an image", "create a picture", "edit this photo", "make a logo", or any image creation/manipulation task.
Generate and edit images using Gemini's native image output models.
uv run --with httpx scripts/generate.py "a cat astronaut floating in space" -o cat.png
uv run --with httpx scripts/generate.py "make the background blue" -i input.jpg -o edited.png
| Model | Flag | Notes |
|---|---|---|
gemini-3-pro-image-preview | (default) |
| Best quality |
gemini-3.1-flash-image-preview | -m gemini-3.1-flash-image-preview | Faster |
gemini-2.5-flash-image | -m gemini-2.5-flash-image | Older, still available |
| Flag | Description | Default |
|---|---|---|
-o, --output | Output file path | output.png |
-i, --input | Input image for editing | None |
-m, --model | Model to use | gemini-3-pro-image-preview |
--timeout | Request timeout in seconds | 120 |
The script finds the Gemini API key in this order:
LLM_GEMINI_KEY env varGEMINI_API_KEY env varllm keys get gemini (llm keystore)