Skip to main content

Image generation

Headmaster can generate and edit images inside the chat. The agent writes a prompt, calls the image generation tool, and the result appears as an image in the chat and in the preview panel.

Enabling image generation

1

Add an image-capable provider

Open Settings → Headmaster’s Library → Connections and make sure you have a provider that supports image generation.
2

Turn on image generation

Go to Settings → Headmaster’s Library → Advanced → Tools and enable Image generation.
3

Pick an image model

Select a model from the dropdown. Only allowlisted image-capable models appear here.

Gemini is the fastest, cheapest, and easiest image generation path.
1

Get a Gemini API key

Visit Google AI Studio, sign in with your Google account, and create a new API key.
2

Add Gemini to Headmaster

Go to Settings → Connections → Add provider → Gemini and paste the API key.
3

Enable image generation

Go to Settings → Advanced → Tools → Image generation and toggle it on.
4

Pick the image model

Select gemini-2.5-flash-image-preview from the dropdown (auto-injected if no other image model is configured).

Supported providers

PlatformAPI shapeRecognized model patternsNotes
GeminiChat completion*-image-*, gemini-*image*Free tier available. Default model: gemini-2.5-flash-image-preview.
Gemini (Vertex AI)Chat completionSame as GeminiEnterprise variant.
OpenRouterChat completionimage, dall-e, flux, stable, etc.300+ models, mixed pricing. Default: google/gemini-2.5-flash-image-preview.
AntigravityToolsChat completionImage-capable modelsDefault: gemini-3-pro-image-1x1.
OpenAIImages APIgpt-image-*, dall-e-*Requires images-API access.
Stability AIImages APIstable-*, sd<n>, ultra, coreRequires Stability key.
Alibaba DashScopeImages APIwanx-*, image-*Requires DashScope key.
Together AIImages APIflux-*Requires Together key.
The model allowlist prevents text-only models from appearing in the image picker. If your model doesn’t appear, its name doesn’t match a recognized pattern — rename the entry to include image, flux, dall-e, or another recognized keyword.

Generating an image

In chat:
Generate an image: a minimalist logo for a coffee brand called "Dawn".
Warm earth tones, geometric, flat design.
The agent writes the prompt, calls the image generation tool, and the image appears in the chat. The file is saved to your project folder.

Image editing

Edit the image at /images/logo.png: change the background color to dark
navy and add a subtle gradient.
The agent reads the image, applies the edit, and shows the result. The original is preserved; the edited version is saved as a new file.

Verifying your setup

1

Check the tool list

Ask in a conversation: “what tools do you have?”image-generation should appear.
2

Test with a prompt

Generate a 1024×1024 blue neon cyberpunk city nightscape
If the tool doesn’t appear: ensure image generation is toggled on, a model is selected and saved, and you start a fresh conversation after saving.

Tips for better images

  • 🎯 Be specific — describe the style, color palette, composition, and mood.
  • 🎨 Reference art movements — “Bauhaus,” “Art Deco,” “minimalist,” “brutalist.”
  • 📐 Specify the format — “landscape 16:9,” “square,” “portrait.”
  • 🔄 Iterate — if the first result isn’t right, ask for adjustments: “make it warmer, add more contrast, simplify the background.”

FAQ

gemini-2.5-flash-image-preview — fast, free with a Gemini API key, decent quality.
The model name doesn’t match the allowlist pattern (image, flux, dall-e, stable, sd<n>, wanx) or the platform isn’t recognized. Rename the model entry to include a recognized keyword, or switch to a supported platform.
Ensure: (1) image generation is toggled on in Settings, (2) a model is selected and saved, (3) you started a fresh conversation after saving.
Check the key was copied without whitespace, the platform account is active, and billing/quota is set up where required.
Usually a network timeout, expired token, or quota exhaustion — check the platform dashboard.

Models & providers

Add the provider that powers image generation.

Preview panel

Generated images open automatically in the preview panel.