AI image generation for vibe coding β powered by OpenRouter & Google Gemini
Works with Claude Code Β· Cursor Β· Windsurf Β· any MCP client
Quick Install Β· Models Β· Tools Β· Examples Β· trucopilot.com
Vibe coding tools can generate text, code, and CSS β but they can't generate images.
Every AI coding platform today β Claude Code, Cursor, Windsurf β can scaffold an entire website in minutes. Beautiful layouts, perfect typography, responsive grids, dark mode toggles. But open the result and what do you see? Grey placeholder boxes. Broken image icons. Empty hero sections. The design falls flat because the visuals are missing.
This is the problem we solve.
This MCP server is the bridge between AI-generated code and AI-generated visuals. When your vibe coding tool builds a landing page, it can now simultaneously generate the hero image, the feature illustrations, the team headshots, the background textures β all ultra-realistic, 2K resolution, perfectly sized for the layout it just created.
| Without Image Generator | With Image Generator |
|---|---|
β Hero sections with placeholder.jpg |
β Stunning AI-generated hero banners that match your brand |
| β Feature cards with missing icons | β Custom illustrations generated per feature |
| β "Add your image here" comments | β Real images, auto-saved, auto-referenced in code |
| β Static, lifeless mockups | β Production-ready pages with full visual design |
| β Manual Midjourney/DALL-E workflow | β Images generated inline during vibe coding β zero context switching |
- π₯οΈ Hero Sections β Full-width 16:9 banners with dramatic lighting, depth, and atmosphere
- π Cards & Features β 1:1 or 4:3 illustrations that bring product features to life
- π€ Avatars & Profiles β 1:1 ultra-realistic or stylized portraits
- π± Mobile Screens β 9:16 splash screens, onboarding visuals, story-format content
- π Backgrounds β Subtle textures, gradients, and atmospheric images for sections
- π’ About & Team Pages β Professional headshots, office environments, company culture imagery
The result? Your vibe-coded website goes from "skeleton with placeholder boxes" to "production-ready with full visual design" β in a single AI session.
π‘ The hero banner at the top of this README was generated by this MCP server in under 10 seconds.
One command β paste into your terminal:
claude mcp add --scope user image-generator \
-e OPENROUTER_API_KEY=YOUR_OPENROUTER_API_KEY \
-- npx -y @trucopilot/image-generator-vibe-codingπ Get your API key at openrouter.ai/keys β replace
YOUR_OPENROUTER_API_KEYabove
π Project scope only (click to expand)
claude mcp add image-generator \
-e OPENROUTER_API_KEY=YOUR_OPENROUTER_API_KEY \
-- npx -y @trucopilot/image-generator-vibe-codingβοΈ Manual JSON config β Claude Code, Cursor, Windsurf, etc. (click to expand)
{
"mcpServers": {
"image-generator": {
"command": "npx",
"args": ["-y", "@trucopilot/image-generator-vibe-coding"],
"env": {
"OPENROUTER_API_KEY": "your-openrouter-key-here"
}
}
}
}Drop this prompt into Claude Code (or any AI coding tool). Replace the two placeholders and it will auto-configure everything β MCP install, CLAUDE.md rules, persistent memory.
π‘ This is the recommended way to set up image generation in your vibe coding workflow.
Fetch this doc: https://github.com/TruCopilot/image-generator-vibe-coding and install the
image-generator MCP server for me. Use user scope if possible, otherwise project scope.
Install command:
claude mcp add --scope user image-generator \
-e OPENROUTER_API_KEY=[YourOpenRouterAPIKey] \
-- npx -y @trucopilot/image-generator-vibe-coding
Then update my CLAUDE.md (or AGENTS.md) and your memory with these image generation rules:
# Image Generation (MANDATORY for all visual content)
- MCP Server: `image-generator` (via @trucopilot/image-generator-vibe-coding)
- Model: `[YourModelName]`
- OpenRouter: `google/gemini-2.5-flash-image` (fast) or `google/gemini-3-pro-image-preview` (quality)
- Gemini direct: `gemini-2.5-flash-image` (fast) or `gemini-3-pro-image-preview` (quality)
- Provider: OpenRouter (default)
## Rules
- ALWAYS use the `image-generator` MCP to generate images when working on new designs,
building UI, or making the site more beautiful β hero sections, banners, cards,
backgrounds, avatars, and any visual content
- CRITICAL: Always call via sub-agent (Agent tool) β base64 image data will crash
the main context window if returned directly
- Resolution: Always `2K` β never go below unless I explicitly ask
- Style: Ultra-realistic, high detail, professional photography quality β include
lighting, composition, and mood descriptors in every prompt
- Aspect ratios β choose based on design context:
- `1:1` β Avatars, profile pics, square cards, thumbnails
- `16:9` β Hero banners, page headers, blog covers, landscape backgrounds
- `9:16` β Mobile splash screens, story formats, vertical banners
- `3:4` / `4:3` β Product cards, feature sections
- `2:3` / `3:2` β Portrait/landscape editorial layouts
- Output directory: `./public/images/generated/` (or project-appropriate path)
- After generating, use the saved file path in <img> or CSS background-image
β never embed base64 in markup
## Sub-Agent Pattern (Required)
Always generate images through a sub-agent like this:
Agent tool β "Use the image-generator MCP generate_image tool with:
prompt: '<detailed visual description>',
model: '[YourModelName]',
aspectRatio: '<pick based on context>',
imageSize: '2K',
outputDir: './public/images/generated/'
Report back ONLY the saved file path, do NOT return image data."
Save this to your persistent memory so every future session uses these rules automatically.
Replace before pasting:
| Placeholder | Replace with | Example |
|---|---|---|
[YourOpenRouterAPIKey] |
Your OpenRouter API key | sk-or-v1-abc123... |
[YourModelName] |
Full model ID from your provider | OpenRouter: google/gemini-2.5-flash-image Β· Gemini: gemini-2.5-flash-image |
|
Access 300+ models via one API
|
Direct Gemini API access
|
Provider is auto-detected from available env vars. OpenRouter is preferred. Override per-request with the
providerparameter.
| Model | OpenRouter ID | Gemini ID | Best For |
|---|---|---|---|
| β‘ Flash | google/gemini-2.5-flash-image |
gemini-2.5-flash-image |
Fast, high-volume generation |
| π Pro | google/gemini-3-pro-image-preview |
gemini-3-pro-image-preview |
Maximum quality output |
π Browse 300+ image models on OpenRouter β
Any model ID from that page works directly in the
modelparameter.
Generate an image from a text prompt.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string |
(required) | Text description of the image |
model |
string |
google/gemini-2.5-flash-image |
Full model ID β see Models. Shortcuts: flash, pro |
aspectRatio |
enum |
1:1 |
1:1 Β· 16:9 Β· 9:16 Β· 3:4 Β· 4:3 Β· 2:3 Β· 3:2 Β· 4:5 Β· 5:4 Β· 21:9 |
imageSize |
enum |
2K |
0.5K Β· 1K Β· 2K Β· 4K |
outputDir |
string |
./generated-images |
Directory to save generated images |
provider |
enum |
auto-detect | openrouter Β· gemini |
Edit an existing image with text instructions.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string |
(required) | Edit instructions |
imagePath |
string |
(required) | Path to source image |
model |
string |
google/gemini-2.5-flash-image |
Full model ID β same options as above |
aspectRatio |
enum |
(optional) | Output aspect ratio |
outputDir |
string |
./generated-images |
Directory to save edited images |
provider |
enum |
auto-detect | openrouter Β· gemini |
| Ratio | Resolution | Best For |
|---|---|---|
1:1 |
1024Γ1024 | Avatars, profile pics, square cards, thumbnails |
16:9 |
1344Γ768 | Hero banners, page headers, blog covers, landscape BGs |
9:16 |
768Γ1344 | Mobile splash, stories, vertical banners, wallpapers |
3:4 / 4:3 |
864Γ1184 | Product cards, feature sections, content blocks |
2:3 / 3:2 |
832Γ1248 | Portrait/landscape editorial, magazine layouts |
4:5 / 5:4 |
896Γ1152 | Social media posts, Instagram |
21:9 |
1536Γ672 | Ultra-wide banners, cinematic headers |
Once configured, just ask your AI assistant:
"Generate a hero image of a futuristic cityscape at night, neon lights, rain reflections"
"Create a 16:9 banner for my blog post about machine learning"
"Edit this image to add dramatic clouds and golden hour lighting"
"Generate a 1:1 avatar of a friendly robot mascot, 3D rendered, studio lighting"
git clone https://github.com/TruCopilot/image-generator-vibe-coding.git
cd image-generator-vibe-coding
npm install
npm run buildTest locally:
OPENROUTER_API_KEY=your-key node dist/index.jsBuilt with β€οΈ by TruCopilot
GitHub Β· npm Β· OpenRouter Β· MIT License