OpenClaw image generation
The image tool, the providers behind it, and why it runs as a background task
OpenClaw generates and edits images through one tool that sits on top of whichever image providers you have configured. In a chat session it runs asynchronously: OpenClaw records a background task, returns the task id at once, and wakes the agent when the provider finishes; the completion reply carries a short caption and every generated attachment, a failure comes back as a concise visible message, and if the requesting session is inactive the images are delivered directly so the result is not lost. Here is the setup, the routes, what the tool accepts, and the caveats.
Setup
- An API key for at least one provider, OpenAI, Gemini or OpenRouter among them, or a ChatGPT or Codex sign-in; with an OpenAI OAuth profile configured, image requests go through it rather than through the key.
- Optionally a default model under the media models block with a timeout; explicit OpenAI provider config, a key or a custom base URL, opts back into the direct Images API route.
- Ask the agent. No allow-listing is needed: the tool is on by default when a provider is available, and absent otherwise.
The tool only appears when at least one image-generation provider is available.
The routes
The docs list a route per goal: OpenAI’s image model with API billing or with the ChatGPT sign-in, the GPT Image 2.5 variants through the explicit key route, a transparent-background PNG or WebP through the older OpenAI model, FLUX through DeepInfra, Krea 2 and GPT Image 2.5 through fal, Gemini’s flash image model through OpenRouter or directly through Google, LiteLLM, and Microsoft Foundry deployments. The same tool handles text-to-image and reference-image editing, with one image or several as references; on Krea the references become style references. Output hints for quality, format and background are forwarded when the provider supports them and reported as ignored when it does not, and OpenAI accepts low or auto moderation for both generation and edits.
The caveats
- An OpenAI-compatible LAN endpoint such as LocalAI needs the custom base URL and an explicit opt-in under the browser’s SSRF policy; private and internal image endpoints stay blocked by default.
- In WebChat and the macOS app the generated attachments stay on the completion reply rather than appearing again in a separate image-only message, and a replayed delivery keeps the same identities.
- The task record itself stays silent; the visible reply follows the session’s current visible-reply contract, which is why a channel sees one captioned message rather than a stream of progress.
OpenClaw with OpenRouter and OpenClaw with Gemini are the two provider posts most people arrive from.
Where it fits
Image generation is one of the media tools beside video, music and speech, and it follows the same pattern as OpenClaw web search: a tool the agent calls, a provider you chose, and a result that comes back through the reply rather than through a separate interface.
On Diali
On Diali the tool follows the same rule as everywhere else: it appears when a provider that can generate images is configured for the assistant, and the dashboard is where that choice is made. Hosted OpenClaw on Diali is the assistant.
- One tool, many providers, a background task per image.
- Text-to-image and reference edits through the same call.
- LAN endpoints are blocked until you opt in.
Stop reading about it, build one
Set up an agent, pick a channel, and have it working inside the app you already keep open.
