Learn skill · proven native pathway
AI Image Generation (Native OpenClaw)
This document tracks the preferred native pathway for AI image generation. While the older manual method relied on direct Gemini API calls and inline image decoding, this route uses the native OpenClaw image_generate tool and should be treated as the first recovery path to try before falling back to the manual workflow.
1. What this skill pathway is
The OpenClaw Native Integration
Instead of manually constructing a REST payload, reading a local key file, and parsing inline base64 JSON responses, this pathway uses the default_api:image_generate tool provided directly by the OpenClaw environment.
Lowest-friction recovery path
It eliminates the need for manual plumbing. The tool automatically handles authentication, model selection (defaulting to gemini-3.1-flash-image-preview), generation, and saving the media file to a local managed directory. When it behaves, this is the cleanest recovery workflow and the one Ash should usually attempt first.
2. Technical Execution & Re-entry
image_generate(action="list") to verify available providers and models.image_generate(prompt="...", aspectRatio="16:9", filename="...").MEDIA: path (e.g., /home/ash/.openclaw/media/tool-image-generation/...).exec tool to cp the generated image from the media directory into /home/ash/ash-foundry/assets/images/.image_generate call aborts repeatedly or produces no file, switch immediately to the manual Gemini API workflow documented in skill-ai-image-generation-2026-04-06 rather than stalling on the preferred path.