MCP Hub
Back to servers

openrouter-imgen-mcp

MCP server for image generation via OpenRouter — supports quality presets, image editing, batch operations, and multiple models

npm212/wk
Stars
1
Updated
Mar 7, 2026

Quick Install

npx -y openrouter-imgen-mcp

openrouter-imgen-mcp

Give your AI assistant the ability to generate and edit images. One install, multiple models, no vendor lock-in.

Screenshots

BeforeAfter
BeforeAfter

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-imgen-mcp -s user -e OPENROUTER_API_KEY=YOURAPIKEY -- npx -y openrouter-imgen-mcp@latest

# Windows
claude mcp add openrouter-imgen-mcp -s user -e OPENROUTER_API_KEY=YOURAPIKEY -- cmd /c npx -y openrouter-imgen-mcp@latest

Claude Desktop / Cursor / VS Code / Windsurf

Add to your MCP config JSON:

{
  "mcpServers": {
    "openrouter-imgen-mcp": {
      "command": "npx",
      "args": ["-y", "openrouter-imgen-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":

PresetModelWhen to use
fastGemini 2.5 FlashDrafts, iteration, keeping costs low
balancedGemini 3 ProDay-to-day use (default)
qualityGPT-5 ImageFinal 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:

StyleWhat you get
photoPhotorealistic, DSLR, natural lighting
illustrationClean digital art, vibrant colors
watercolorSoft washes, paper texture
pixel-artRetro 16-bit, limited palette
3d-renderStudio-lit, physically based rendering
animeCel-shaded, Japanese animation
sketchPencil on paper, monochrome
oil-paintingBrushstrokes, impasto, classical

Tools Reference

Convenient tools:

ToolWhat it does
generate_imageText-to-image with quality/style presets, variations (1-4), aspect ratio, file output
edit_imageTransform images with a prompt + up to 12 reference images (files, URLs, data URIs)
batch_imagesRun up to 20 generate/edit tasks in parallel with concurrency control
list_image_modelsBrowse available models with pricing
check_balanceCheck 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

FlagEnv VarDefault
--api-keyOPENROUTER_API_KEY(required)
--default-modelOPENROUTER_IMG_DEFAULT_MODELgoogle/gemini-3-pro-image-preview
--batch-concurrencyOPENROUTER_IMG_BATCH_CONCURRENCY3
--cache-ttlOPENROUTER_IMG_CACHE_TTL300000 (5 min)
--log-levelOPENROUTER_IMG_LOG_LEVELwarn

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

Reviews

No reviews yet

Sign in to write a review