summary: "Generate and edit images using configured providers (OpenAI, Google Gemini, fal, MiniMax)"
read_when:
- Generating images via the agent
- Configuring image generation providers and models
- Understanding the image_generate tool parameters
title: "Image Generation"
---
# Image Generation
The `image_generate` tool lets the agent create and edit images using your configured providers. Generated images are delivered automatically as media attachments in the agent's reply.
<Note>
The tool only appears when at least one image generation provider is available. If you don't see `image_generate` in your agent's tools, configure `agents.defaults.imageGenerationModel` or set up a provider API key.
</Note>
## Quick start
1. Set an API key for at least one provider (for example `OPENAI_API_KEY` or `GEMINI_API_KEY`).
2. Optionally set your preferred model:
```json5
{
agents: {
defaults: {
imageGenerationModel: "openai/gpt-image-1",
},
},
}
```
3. Ask the agent: _"Generate an image of a friendly lobster mascot."_
The agent calls `image_generate` automatically. No tool allow-listing needed — it's enabled by default when a provider is available.
When generating an image, OpenClaw tries providers in this order:
1.**`model` parameter** from the tool call (if the agent specifies one)
2.**`imageGenerationModel.primary`** from config
3.**`imageGenerationModel.fallbacks`** in order
4.**Auto-detection** — queries all registered providers for defaults, preferring: configured primary provider, then OpenAI, then Google, then others
If a provider fails (auth error, rate limit, etc.), the next candidate is tried automatically. If all fail, the error includes details from each attempt.