A new npm package called blog-cover-image-cli brings AI-powered cover image generation directly into the OpenCode ecosystem. The tool uses Google's Gemini 3.1 Flash Image Preview model to generate minimalist, typography-heavy blog covers from a simple title and domain name โ€” and it's fully agent-ready with a built-in OpenCode skill.

How the CLI Works

The tool handles the entire image generation pipeline autonomously. Pass a title like "Why Cursor is the Ultimate AI Code Editor" and a domain like cursor.com, and it fetches the company logo via Brandfetch (converting WebP/SVG/AVIF to PNG using sharp), assembles aesthetic examples from its bundled ./examples folder, and sends the unified prompt to Gemini 3.1 Flash with Google Search grounding for real-time context.

The OpenCode Skill Integration

What makes this particularly useful for the OpenClaw and Claude Code crowd is the included agent-skill/blog-cover-generator/SKILL.md. AI agents can install the package, read the skill instructions, and autonomously generate cover images on behalf of users. The workflow is straightforward: set the API key via npx, run the generate command with title and logo domain, then return the generated PNG.

Self-Healing Validation Loop

The most compelling feature here is the built-in QA system. After generating an image, the CLI uses Gemini Pro Vision to OCR and validate the output โ€” checking for typos in the rendered text, layout issues, or missing elements. If validation fails, it retries up to 3 times with corrective feedback passed back to the generator. This addresses one of the biggest pain points with AI image generation: misspellings in typography-heavy designs.

Setup Requirements

You'll need Node.js v18+, a Gemini API key, and a Brandfetch client ID. Configuration is handled securely via the conf package, storing keys locally so you don't need to export them on every run. The CLI defaults to outputting PNGs in an ./output directory with intelligent naming based on the logo domain or title.

Key Takeaways

  • Uses Gemini 3.1 Flash Image Preview for generation with Google Search grounding
  • Built-in self-healing validation loop retries up to 3 times on failures
  • Fully agent-ready with OpenCode skill for autonomous workflows
  • Fetches and converts logos via Brandfetch, supports multiple formats

The Bottom Line

This is exactly the kind of tool that makes AI agents actually useful in real workflows โ€” not just chat assistants, but actual CLI utilities that fit into CI/CD pipelines. The self-healing validation is the differentiator; most AI image tools give you garbage and call it a feature. This one actually checks its work. If you're publishing blogs programmatically or building agent workflows that need visual assets, this is worth a look.