openrouter-image-gen-mcp
Enables AI assistants to generate and edit images using multiple models through OpenRouter, with features like style presets, batch operations, and variations.
README
openrouter-image-gen-mcp
Give your AI assistant the ability to generate and edit images. One install, multiple models, no vendor lock-in.
Works with Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, and any MCP client.
Why This
- One API key, every image model. Gemini, GPT-5, and more through OpenRouter. Switch models with a word, not a code change.
- Generate, edit, and batch. Text-to-image, image editing with references, and batch operations (up to 20 parallel tasks).
- Style presets. Say "in watercolor style" or "as pixel art" and get consistent results. 8 built-in styles.
- Variations. Generate up to 4 takes from one prompt. Pick the best one.
- Smart file output. Save to a path or a directory. Files get descriptive names automatically.
- Pay for what you use. OpenRouter's per-token and per-image pricing means no subscriptions.
How to Install
Get an OpenRouter API key, then add the server to your client.
Claude Code
# macOS / Linux
claude mcp add openrouter-image-gen-mcp -s user -e OPENROUTER_API_KEY=YOURAPIKEY -- npx -y openrouter-image-gen-mcp@latest
# Windows
claude mcp add openrouter-image-gen-mcp -s user -e OPENROUTER_API_KEY=YOURAPIKEY -- cmd /c npx -y openrouter-image-gen-mcp@latest
Claude Desktop / Cursor / VS Code / Windsurf
Add to your MCP config JSON:
{
"mcpServers": {
"openrouter-image-gen-mcp": {
"command": "npx",
"args": ["-y", "openrouter-image-gen-mcp@latest"],
"env": {
"OPENROUTER_API_KEY": "YOURAPIKEY"
}
}
}
}
What You Can Do
Simply chat with your assistant:
Generate a product photo of a ceramic mug on a wooden table, warm lighting
Generate 3 variations of a logo concept for a coffee brand, pixel-art style
Edit /path/to/headshot.png: make the background a gradient, keep the subject
Batch generate 5 social media banners: summer sale, back to school, holiday promo,
new arrivals, free shipping. All in illustration style, 16:9, save to ./banners/
List image models. What's cheapest for quick drafts?
Quality Presets
Skip the model IDs. Just say "fast", "balanced", or "quality":
| Preset | Model | When to use |
|---|---|---|
fast |
Gemini 2.5 Flash | Drafts, iteration, keeping costs low |
balanced |
Gemini 3 Pro | Day-to-day use (default) |
quality |
GPT-5 Image | Final deliverables, max fidelity |
Or pass any OpenRouter model ID directly:
Generate a cat using model google/gemini-2.5-flash-image
Style Presets
Keywords modifies the style:
| Style | What you get |
|---|---|
photo |
Photorealistic, DSLR, natural lighting |
illustration |
Clean digital art, vibrant colors |
watercolor |
Soft washes, paper texture |
pixel-art |
Retro 16-bit, limited palette |
3d-render |
Studio-lit, physically based rendering |
anime |
Cel-shaded, Japanese animation |
sketch |
Pencil on paper, monochrome |
oil-painting |
Brushstrokes, impasto, classical |
Tools Reference
Convenient tools:
| Tool | What it does |
|---|---|
generate_image |
Text-to-image with quality/style presets, variations (1-4), aspect ratio, file output |
edit_image |
Transform images with a prompt + up to 12 reference images (files, URLs, data URIs) |
batch_images |
Run up to 20 generate/edit tasks in parallel with concurrency control |
list_image_models |
Browse available models with pricing |
check_balance |
Check your OpenRouter credit balance |
Supported output: 1:1, 2:3, 3:2, 16:9, 9:16, 4:3, 3:4 aspect ratios. 0.5K, 1K, 2K, 4K sizes. PNG, JPEG, WebP, GIF inputs.
Headless Configuration
| Flag | Env Var | Default |
|---|---|---|
--api-key |
OPENROUTER_API_KEY |
(required) |
--default-model |
OPENROUTER_IMG_DEFAULT_MODEL |
google/gemini-3-pro-image-preview |
--batch-concurrency |
OPENROUTER_IMG_BATCH_CONCURRENCY |
3 |
--cache-ttl |
OPENROUTER_IMG_CACHE_TTL |
300000 (5 min) |
--log-level |
OPENROUTER_IMG_LOG_LEVEL |
warn |
Security
API keys never appear in logs or error messages. File paths block directory traversal. Image URLs are validated against SSRF patterns. Batch operations are memory-capped at 200MB. All inputs are schema-validated.
For Developers
To build for devs:
pnpm install && pnpm build && pnpm test # 57 tests
License
MIT
Made with <3 at Bitcoin.com
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。