Skip to main content
The @image tool generates and edits images via the llm/imagegen package, local/keyless-first and multi-provider.

Backend selection (local first)

imagegen.NewFromEnv picks one, degrading to null when nothing is configured:
  1. CHATCLI_IMAGE_PROVIDER=sdwebui → local Stable Diffusion WebUI (/sdapi/v1/txt2img, default http://localhost:7860). Keyless — the preferred path.
  2. CHATCLI_IMAGE_URL → an OpenAI-compatible endpoint (/images/generations). Covers OpenAI, LocalAI and similar.
  3. OPENAI_API_KEYOpenAI Images API (default gpt-image-1).
  4. CHATCLI_IMAGE_PROVIDER=responses (or openai + CHATCLI_IMAGE_API=responses) → OpenAI Responses API, where a chat model like gpt-5.5 generates the image via the image_generation tool.
  5. GOOGLEAI_API_KEY/GEMINI_API_KEYnative Google (Imagen :predict to generate; Gemini image / “Nano Banana” :generateContent to edit).
  6. XAI_API_KEYnative xAI grok-image / Aurora (OpenAI shape, omits size). Generate only.
  7. CHATCLI_IMAGE_PROVIDER=bedrockAWS Bedrock (Nova Canvas / Titan Image / Stability via InvokeModel, reusing the chat provider’s credential chain).
CHATCLI_IMAGE_PROVIDER pins the backend (sdwebui|url|openai|responses|google|xai|zai|minimax|bedrock); CHATCLI_IMAGE_API selects images|responses on OpenAI; CHATCLI_IMAGE_MODEL sets the model.
The model is inherited by both generation AND editing. @image gen and @image edit read the same CHATCLI_IMAGE_MODEL/CHATCLI_IMAGE_PROVIDER — one /model-image serves both. You never configure “one model to create and another to edit”.

The @image tool

edit accepts image (path), mask (optional PNG for inpainting), strength (0..1 — how much to change). The result reports the output file path(s).

Multi-provider editing (not locked to one)

Editing is a per-API capability — not every generation backend has an edit endpoint. @image edit is capability-gated: editing backends get Edit; generation-only ones refuse cleanly (and route, see below).

Inheritance and automatic routing

Editing inherits the active provider/model. Only when the active backend can’t edit does @image edit route to an edit-capable fallback — and says so explicitly:
ℹ️ Image backend "xai" can’t edit images; routed to "sdwebui" for this edit. Set CHATCLI_IMAGE_EDIT_PROVIDER to pin a different one.
Fallback order (each credential-gated, never routing to something that can’t run):
You can pin the editor without changing the generation provider:
If no editor is available, the tool returns a clear error listing the editing backends and how to configure them.

Models & per-command config

Catalog (summary): OpenAI Images 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 (generate) / gemini-2.5-flash-image (edit); xAI grok-2-image; Bedrock amazon.nova-canvas-v1:0, stability.stable-image-core-v1:1, stability.sd3-5-large-v1:0.

Formats & details

  • OpenAI edits accepts image/jpeg, image/png, image/webp (not gif). The multipart part’s Content-Type is sent correctly from the image bytes.
  • SD WebUI img2img uses denoising_strength (mapped from strength); default 0.6 (visible change while preserving structure).
  • Bedrock Stability uses mode: image-to-image + strength; Nova/Titan use IMAGE_VARIATION with similarityStrength.

Privacy & cost

  • Local Stable Diffusion WebUI is keyless and generates and edits on your machine — ideal for privacy and zero cost.
  • Cloud backends use the user’s own key.
  • Confirm before generating/editing large batches; mention cost when relevant.