@image tool generates images from a prompt via the llm/imagegen package, local/keyless-first and multi-provider.
Backend selection (local first)
imagegen.NewFromEnv picks, degrading to null when nothing is configured:
CHATCLI_IMAGE_PROVIDER=sdwebui→ local Stable Diffusion WebUI (/sdapi/v1/txt2img, defaulthttp://localhost:7860). Keyless — the preferred path.CHATCLI_IMAGE_URL→ an OpenAI-compatible endpoint (/images/generations). Covers OpenAI, LocalAI and similar.OPENAI_API_KEY→ OpenAI Images API (defaultgpt-image-1).CHATCLI_IMAGE_PROVIDER=responses(oropenai+CHATCLI_IMAGE_API=responses) → OpenAI Responses API, where a chat model likegpt-5.5generates the image via theimage_generationtool.GOOGLEAI_API_KEY/GEMINI_API_KEY→ native Google Imagen (own:predictshape).XAI_API_KEY→ native xAI grok-image (OpenAI shape, omitssize).CHATCLI_IMAGE_PROVIDER=bedrock→ AWS Bedrock (Nova Canvas / Titan Image / Stability viaInvokeModel, reusing the chat provider’s credential chain).
CHATCLI_IMAGE_PROVIDER pins the backend (sdwebui|url|openai|responses|google|xai|bedrock); CHATCLI_IMAGE_API chooses images|responses for OpenAI; CHATCLI_IMAGE_MODEL tunes the model.
Two OpenAI APIs: the Images API (
gpt-image-2/1.5/1/1-mini family) and the Responses API (gpt-5.5 and gpt-5+ via the image_generation tool). On Bedrock, image generation is via the dedicated models (Nova/Titan/Stability), not the chat models. Chat providers with no image API (Anthropic, text-only Ollama…) can’t be added — the endpoint doesn’t exist.Models & config by command
gpt-image-2, gpt-image-1.5, gpt-image-1, gpt-image-1-mini; OpenAI Responses gpt-5.5, gpt-5; Google imagen-3.0-generate-002; xAI grok-2-image, grok-imagine-image-quality; Bedrock amazon.nova-canvas-v1:0, amazon.titan-image-generator-v2:0, stability.sd3-5-large-v1:0, stability.stable-image-ultra-v1:1.
@image tool
| Subcommand | Purpose |
|---|---|
gen {prompt, size?, n?, out?} | generate image(s) and save to file; out = file (1 image) or directory (multiple) |
status | show the effective backend |
/config (Image generation (@image)).
Privacy & cost
- Local Stable Diffusion WebUI is keyless and keeps everything on your machine — ideal for privacy and zero cost.
- Cloud backends use the user’s own key.
- Confirm before generating large batches; mention cost where applicable.