meigen-ai-design-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMeiGen AI Design MCP
MeiGen AI Design MCP
Skill by ara.so — Design Skills collection.
MeiGen AI Design MCP turns AI coding tools into professional design assistants. It provides 8 MCP tools for generating images and videos, searching 1,446 curated prompts, enhancing prompts with AI, and managing design workflows. Works with Claude Code, Cursor, Windsurf, Roo Code, OpenClaw, and any MCP-compatible host.
Backend options:
- MeiGen Cloud — 9 models (GPT Image 2, Nanobanana 2, Midjourney V8.1, Flux 2 Klein, Seedream 5.0, Seedance 2.0, Happyhorse 1.0, Veo 3.1)
- OpenAI-compatible API — bring your own key and endpoint
- Local ComfyUI — run on your own GPU, full control over workflows
由ara.so开发的Skill——设计技能合集。
MeiGen AI Design MCP可将AI编码工具转变为专业设计助手。它提供8种MCP工具,用于生成图片和视频、搜索1446条精选提示词、通过AI优化提示词以及管理设计工作流。支持Claude Code、Cursor、Windsurf、Roo Code、OpenClaw及所有兼容MCP的宿主工具。
后端选项:
- MeiGen Cloud — 9种模型(GPT Image 2、Nanobanana 2、Midjourney V8.1、Flux 2 Klein、Seedream 5.0、Seedance 2.0、Happyhorse 1.0、Veo 3.1)
- 兼容OpenAI的API — 使用您自己的密钥和端点
- 本地ComfyUI — 在您的GPU上运行,完全控制工作流
Installation
安装
Claude Code Plugin (Recommended)
Claude Code 插件(推荐)
bash
undefinedbash
undefinedAdd marketplace and install
添加市场并安装
/plugin marketplace add jau123/MeiGen-AI-Design-MCP
/plugin install meigen@meigen-marketplace
**Restart Claude Code** after installation. Then run the setup wizard:
```bash
/meigen:setup/plugin marketplace add jau123/MeiGen-AI-Design-MCP
/plugin install meigen@meigen-marketplace
安装后**重启Claude Code**。然后运行设置向导:
```bash
/meigen:setupCursor / VS Code / Windsurf / Roo Code
Cursor / VS Code / Windsurf / Roo Code
bash
undefinedbash
undefinedOne command auto-configures for your tool
一键自动适配您的工具
npx meigen init cursor # Cursor
npx meigen init vscode # VS Code / GitHub Copilot
npx meigen init windsurf # Windsurf
npx meigen init roo # Roo Code
npx meigen init claude # Claude Code (project-level)
undefinednpx meigen init cursor # Cursor
npx meigen init vscode # VS Code / GitHub Copilot
npx meigen init windsurf # Windsurf
npx meigen init roo # Roo Code
npx meigen init claude # Claude Code(项目级)
undefinedOpenClaw
OpenClaw
bash
undefinedbash
undefinedFull plugin (commands + skills + MCP server)
完整插件(命令+技能+MCP服务器)
openclaw bundles install clawhub:meigen-ai-design
openclaw bundles install clawhub:meigen-ai-design
Or skill only
或仅安装技能
npx clawhub@latest install creative-toolkit
undefinednpx clawhub@latest install creative-toolkit
undefinedManual MCP Configuration
手动MCP配置
Add to your MCP config file (, , etc.):
.mcp.jsonclaude_desktop_config.jsonjson
{
"mcpServers": {
"meigen": {
"command": "npx",
"args": ["-y", "meigen@1.3.1"],
"env": {
"MEIGEN_API_TOKEN": "meigen_sk_..."
}
}
}
}添加到您的MCP配置文件(、等):
.mcp.jsonclaude_desktop_config.jsonjson
{
"mcpServers": {
"meigen": {
"command": "npx",
"args": ["-y", "meigen@1.3.1"],
"env": {
"MEIGEN_API_TOKEN": "meigen_sk_..."
}
}
}
}CLI Mode (No MCP Host Required)
CLI模式(无需MCP宿主)
bash
undefinedbash
undefinedSet token once
一次性设置令牌
export MEIGEN_API_TOKEN=meigen_sk_...
export MEIGEN_API_TOKEN=meigen_sk_...
Generate
生成
npx meigen gen --prompt "a calico cat in a sunlit kitchen"
npx meigen gen -p "tech logo" -m midjourney-v8.1 -r 1:1
npx meigen gen -p "product shot" --ref ~/Desktop/bottle.jpg
undefinednpx meigen gen --prompt "a calico cat in a sunlit kitchen"
npx meigen gen -p "tech logo" -m midjourney-v8.1 -r 1:1
npx meigen gen -p "product shot" --ref ~/Desktop/bottle.jpg
undefinedConfiguration
配置
Environment Variables
环境变量
bash
undefinedbash
undefinedMeiGen Cloud API token (get at https://www.meigen.ai → Settings → API Keys)
MeiGen Cloud API令牌(获取地址:https://www.meigen.ai → 设置 → API密钥)
MEIGEN_API_TOKEN=meigen_sk_...
MEIGEN_API_TOKEN=meigen_sk_...
OpenAI-compatible API (optional)
兼容OpenAI的API(可选)
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1
ComfyUI (optional)
ComfyUI(可选)
COMFYUI_URL=http://localhost:8188
COMFYUI_URL=http://localhost:8188
Output directories (optional)
输出目录(可选)
MEIGEN_OUTPUT_DIR=/Pictures/meigen
MEIGEN_VIDEO_OUTPUT_DIR=/Movies/meigen
undefinedMEIGEN_OUTPUT_DIR=/Pictures/meigen
MEIGEN_VIDEO_OUTPUT_DIR=/Movies/meigen
undefinedProject-Level Config
项目级配置
Create in your project root:
.meigen.jsonjson
{
"provider": "meigen",
"meigenApiToken": "${MEIGEN_API_TOKEN}",
"defaultModel": "nanobanana-2",
"defaultAspectRatio": "16:9",
"comfyuiUrl": "http://localhost:8188",
"comfyuiDefaultWorkflow": "txt2img",
"openaiApiKey": "${OPENAI_API_KEY}",
"openaiBaseUrl": "https://api.openai.com/v1"
}在项目根目录创建:
.meigen.jsonjson
{
"provider": "meigen",
"meigenApiToken": "${MEIGEN_API_TOKEN}",
"defaultModel": "nanobanana-2",
"defaultAspectRatio": "16:9",
"comfyuiUrl": "http://localhost:8188",
"comfyuiDefaultWorkflow": "txt2img",
"openaiApiKey": "${OPENAI_API_KEY}",
"openaiBaseUrl": "https://api.openai.com/v1"
}MCP Tools
MCP工具
search_gallery
search_gallery
Search 1,446 curated prompts with visual previews. Free, no API key required.
typescript
// AI agent will call this when user says:
// "find inspiration for product photography"
// "search for logo designs"
// "show me nature landscape prompts"
{
"keywords": "product photography",
"style": "commercial",
"limit": 10
}搜索1446条带视觉预览的精选提示词。免费,无需API密钥。
typescript
// AI代理会在用户说出以下内容时调用此工具:
// "寻找产品摄影灵感"
// "搜索标志设计"
// "展示自然景观提示词"
{
"keywords": "product photography",
"style": "commercial",
"limit": 10
}get_inspiration
get_inspiration
Get full prompt, all images, and metadata for a gallery entry. Free.
typescript
// After search_gallery, get full details
{
"id": "12345"
}获取图库条目的完整提示词、所有图片及元数据。免费。
typescript
// 搜索后,获取完整详情
{
"id": "12345"
}enhance_prompt
enhance_prompt
Transform a brief idea into a professional image prompt. Free.
typescript
// User says: "a coffee cup"
// AI calls enhance_prompt to expand into:
// "A ceramic coffee cup on a wooden table, warm morning light streaming through window, shallow depth of field, product photography style, commercial quality, 4K detail"
{
"userPrompt": "a coffee cup",
"style": "commercial",
"aspectRatio": "16:9"
}将简单想法转化为专业图片提示词。免费。
typescript
// 用户说:"a coffee cup"
// AI调用enhance_prompt扩展为:
// "A ceramic coffee cup on a wooden table, warm morning light streaming through window, shallow depth of field, product photography style, commercial quality, 4K detail"
{
"userPrompt": "a coffee cup",
"style": "commercial",
"aspectRatio": "16:9"
}list_models
list_models
List available models across all configured providers. Free.
typescript
// Returns models from MeiGen Cloud, OpenAI, and local ComfyUI
{} // No parameters列出所有已配置提供商的可用模型。免费。
typescript
// 返回MeiGen Cloud、OpenAI和本地ComfyUI的模型
{} // 无参数generate_image
generate_image
Generate an image. Requires API key. Routes to best available provider automatically.
typescript
// Basic generation
{
"prompt": "a calico cat in a sunlit kitchen, photorealistic, 4K detail",
"model": "nanobanana-2",
"aspectRatio": "16:9"
}
// With reference image (local file auto-uploaded)
{
"prompt": "product hero shot, professional lighting",
"model": "gpt-image-2",
"aspectRatio": "1:1",
"referenceImagePath": "/Users/you/Desktop/bottle.jpg"
}
// With specific provider
{
"prompt": "logo design, minimal, tech startup",
"provider": "comfyui",
"workflowName": "txt2img",
"aspectRatio": "1:1"
}生成图片。需要API密钥。自动路由至最佳可用提供商。
typescript
// 基础生成
{
"prompt": "a calico cat in a sunlit kitchen, photorealistic, 4K detail",
"model": "nanobanana-2",
"aspectRatio": "16:9"
}
// 带参考图片(本地文件自动上传)
{
"prompt": "product hero shot, professional lighting",
"model": "gpt-image-2",
"aspectRatio": "1:1",
"referenceImagePath": "/Users/you/Desktop/bottle.jpg"
}
// 指定提供商
{
"prompt": "logo design, minimal, tech startup",
"provider": "comfyui",
"workflowName": "txt2img",
"aspectRatio": "1:1"
}generate_video
generate_video
Generate a video via MeiGen platform. Requires API key. Saves MP4 to .
~/Movies/meigen/typescript
// Text-to-video
{
"prompt": "a cat walking through a garden, cinematic",
"model": "seedance-2.0-fast",
"duration": 5
}
// Image-to-video (first frame)
{
"prompt": "camera slowly zooms in",
"model": "happyhorse-1.0",
"duration": 5,
"firstFramePath": "/Users/you/Desktop/scene.jpg"
}
// Veo 3.1 (longest duration)
{
"prompt": "product rotation, studio lighting",
"model": "veo-3.1",
"duration": 10
}Video models:
- — 5s, fastest
seedance-2.0-fast - — 5s, higher quality
seedance-2.0-pro - — 5s, cinematic
happyhorse-1.0 - — up to 10s, best quality
veo-3.1
通过MeiGen平台生成视频。需要API密钥。保存MP4至。
~/Movies/meigen/typescript
// 文本转视频
{
"prompt": "a cat walking through a garden, cinematic",
"model": "seedance-2.0-fast",
"duration": 5
}
// 图片转视频(首帧)
{
"prompt": "camera slowly zooms in",
"model": "happyhorse-1.0",
"duration": 5,
"firstFramePath": "/Users/you/Desktop/scene.jpg"
}
// Veo 3.1(最长时长)
{
"prompt": "product rotation, studio lighting",
"model": "veo-3.1",
"duration": 10
}视频模型:
- — 5秒,速度最快
seedance-2.0-fast - — 5秒,更高质量
seedance-2.0-pro - — 5秒,电影质感
happyhorse-1.0 - — 最长10秒,最佳质量
veo-3.1
comfyui_workflow
comfyui_workflow
Manage ComfyUI workflow templates. Free.
typescript
// List workflows
{
"action": "list"
}
// View workflow details
{
"action": "view",
"name": "txt2img"
}
// Import new workflow (from ComfyUI API format JSON)
{
"action": "import",
"name": "my-flux-workflow",
"workflow": { /* ComfyUI API format workflow */ }
}
// Delete workflow
{
"action": "delete",
"name": "old-workflow"
}管理ComfyUI工作流模板。免费。
typescript
// 列出工作流
{
"action": "list"
}
// 查看工作流详情
{
"action": "view",
"name": "txt2img"
}
// 导入新工作流(来自ComfyUI API格式JSON)
{
"action": "import",
"name": "my-flux-workflow",
"workflow": { /* ComfyUI API格式工作流 */ }
}
// 删除工作流
{
"action": "delete",
"name": "old-workflow"
}manage_preferences
manage_preferences
Remember user's preferred style, aspect ratio, model, and favorite prompts. Free.
typescript
// Set preferences
{
"action": "set",
"preferences": {
"defaultModel": "midjourney-v8.1",
"defaultAspectRatio": "1:1",
"favoriteStyle": "minimal modern",
"favoritePrompts": ["tech logo", "product photography"]
}
}
// Get preferences
{
"action": "get"
}记住用户偏好的风格、宽高比、模型和收藏提示词。免费。
typescript
// 设置偏好
{
"action": "set",
"preferences": {
"defaultModel": "midjourney-v8.1",
"defaultAspectRatio": "1:1",
"favoriteStyle": "minimal modern",
"favoritePrompts": ["tech logo", "product photography"]
}
}
// 获取偏好
{
"action": "get"
}Slash Commands
斜杠命令
bash
undefinedbash
undefinedQuick generate — skip conversation
快速生成 — 跳过对话
/meigen:gen a calico cat in sunlit kitchen
/meigen:gen a calico cat in sunlit kitchen
Search prompts
搜索提示词
/meigen:find product photography
/meigen:find product photography
Browse models
浏览模型
/meigen:models
/meigen:models
Setup wizard
设置向导
/meigen:setup
undefined/meigen:setup
undefinedCLI Usage
CLI使用
Basic Generation
基础生成
bash
undefinedbash
undefinedSimple prompt
简单提示词
npx meigen gen --prompt "a calico cat in a sunlit kitchen"
npx meigen gen --prompt "a calico cat in a sunlit kitchen"
Specific model + aspect ratio
指定模型+宽高比
npx meigen gen -p "tech logo" -m midjourney-v8.1 -r 1:1
npx meigen gen -p "tech logo" -m midjourney-v8.1 -r 1:1
With reference image
带参考图片
npx meigen gen -p "product hero shot" --ref ~/Desktop/bottle.jpg
npx meigen gen -p "product hero shot" --ref ~/Desktop/bottle.jpg
Specific provider
指定提供商
npx meigen gen -p "portrait" --provider openai -m gpt-image-2
npx meigen gen -p "portrait" --provider openai -m gpt-image-2
ComfyUI workflow
ComfyUI工作流
npx meigen gen -p "landscape" --provider comfyui --workflow flux-dev
undefinednpx meigen gen -p "landscape" --provider comfyui --workflow flux-dev
undefinedAdvanced Options
高级选项
bash
undefinedbash
undefinedSubmit only (no polling) — good for CI
仅提交(不轮询)— 适用于CI
npx meigen gen -p "..." --no-wait
npx meigen gen -p "..." --no-wait
Machine-readable JSON output
机器可读JSON输出
npx meigen gen -p "..." --json | jq -r '.imageUrls[0]'
npx meigen gen -p "..." --json | jq -r '.imageUrls[0]'
Custom output directory
自定义输出目录
MEIGEN_OUTPUT_DIR=/tmp/images npx meigen gen -p "..."
MEIGEN_OUTPUT_DIR=/tmp/images npx meigen gen -p "..."
Video generation (MeiGen Cloud only)
视频生成(仅MeiGen Cloud)
npx meigen gen -p "cat walking" --video -m seedance-2.0-fast --duration 5
npx meigen gen -p "cat walking" --video -m seedance-2.0-fast --duration 5
Video from first frame
从首帧生成视频
npx meigen gen -p "zoom in" --video --first-frame scene.jpg
undefinednpx meigen gen -p "zoom in" --video --first-frame scene.jpg
undefinedAll CLI Flags
所有CLI标志
-p, --prompt <text> Image description (required)
-m, --model <name> AI model (default: nanobanana-2)
-r, --aspect-ratio <ratio> Aspect ratio: 1:1, 16:9, 9:16, etc. (default: 16:9)
--ref, --reference <path> Reference image (local file, auto-uploaded)
--provider <name> Force provider: meigen, openai, or comfyui
--workflow <name> ComfyUI workflow name (when provider=comfyui)
--video Generate video instead of image
--duration <seconds> Video duration: 5 or 10 (default: 5)
--first-frame <path> First frame image for video (local file)
--no-wait Submit only, don't poll for completion
--json Machine-readable JSON output-p, --prompt <text> 图片描述(必填)
-m, --model <name> AI模型(默认:nanobanana-2)
-r, --aspect-ratio <ratio> 宽高比:1:1、16:9、9:16等(默认:16:9)
--ref, --reference <path> 参考图片(本地文件,自动上传)
--provider <name> 强制指定提供商:meigen、openai或comfyui
--workflow <name> ComfyUI工作流名称(当provider=comfyui时)
--video 生成视频而非图片
--duration <seconds> 视频时长:5或10(默认:5)
--first-frame <path> 视频首帧图片(本地文件)
--no-wait 仅提交,不轮询完成状态
--json 机器可读JSON输出Common Patterns
常见模式
Parallel Batch Generation
并行批量生成
When a user asks for multiple variations, MeiGen uses specialized sub-agents to generate in parallel:
typescript
// User says: "Create 4 product images for this perfume"
// AI will:
// 1. Call enhance_prompt 4 times to craft distinct prompts
// 2. Spawn image-generator sub-agents to run generate_image in parallel
// 3. Return all 4 images in ~2 minutes
// No special code needed — MeiGen handles orchestration automatically当用户要求多个变体时,MeiGen使用专用子代理并行生成:
typescript
// 用户说:"Create 4 product images for this perfume"
// AI会:
// 1. 调用enhance_prompt 4次来制作不同的提示词
// 2. 启动图片生成子代理并行运行generate_image
// 3. 约2分钟后返回所有4张图片
// 无需特殊代码 — MeiGen自动处理编排Reference Image Upload
参考图片上传
Local images are auto-compressed and uploaded:
typescript
// User drops ~/Desktop/bottle.jpg into chat and says:
// "Make this look more professional"
// AI calls:
{
"prompt": "professional product photography, studio lighting, white background",
"model": "gpt-image-2",
"aspectRatio": "1:1",
"referenceImagePath": "/Users/you/Desktop/bottle.jpg"
}
// MeiGen auto-compresses to <10MB and uploads to MeiGen Cloud本地图片会自动压缩并上传:
typescript
// 用户将~/Desktop/bottle.jpg拖入聊天并说:
// "Make this look more professional"
// AI调用:
{
"prompt": "professional product photography, studio lighting, white background",
"model": "gpt-image-2",
"aspectRatio": "1:1",
"referenceImagePath": "/Users/you/Desktop/bottle.jpg"
}
// MeiGen自动压缩至<10MB并上传至MeiGen CloudComfyUI Workflow Import
ComfyUI工作流导入
typescript
// 1. Export workflow from ComfyUI UI (Save API Format)
// 2. Import to MeiGen
{
"action": "import",
"name": "flux-dev-txt2img",
"workflow": {
"3": {
"inputs": {
"seed": 42,
"steps": 20,
"cfg": 7,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1,
"model": ["4", 0],
"positive": ["6", 0],
"negative": ["7", 0],
"latent_image": ["5", 0]
},
"class_type": "KSampler"
},
// ... rest of workflow
}
}
// 3. Use in generate_image
{
"prompt": "a cat",
"provider": "comfyui",
"workflowName": "flux-dev-txt2img"
}typescript
// 1. 从ComfyUI界面导出工作流(保存为API格式)
// 2. 导入至MeiGen
{
"action": "import",
"name": "flux-dev-txt2img",
"workflow": {
"3": {
"inputs": {
"seed": 42,
"steps": 20,
"cfg": 7,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1,
"model": ["4", 0],
"positive": ["6", 0],
"negative": ["7", 0],
"latent_image": ["5", 0]
},
"class_type": "KSampler"
},
// ... 工作流其余部分
}
}
// 3. 在generate_image中使用
{
"prompt": "a cat",
"provider": "comfyui",
"workflowName": "flux-dev-txt2img"
}Prompt Enhancement Pipeline
提示词优化流程
typescript
// User gives minimal prompt: "a logo"
// AI automatically enhances before generating:
// Step 1: enhance_prompt
{
"userPrompt": "a logo",
"style": "minimal modern"
}
// Returns: "Minimal modern logo design, geometric shapes, bold typography, monochrome color palette, vector art style, professional brand identity, clean lines, scalable, white background"
// Step 2: generate_image with enhanced prompt
{
"prompt": "Minimal modern logo design, geometric shapes...",
"model": "midjourney-v8.1",
"aspectRatio": "1:1"
}typescript
// 用户给出极简提示词:"a logo"
// AI在生成前自动优化:
// 步骤1:enhance_prompt
{
"userPrompt": "a logo",
"style": "minimal modern"
}
// 返回:"Minimal modern logo design, geometric shapes, bold typography, monochrome color palette, vector art style, professional brand identity, clean lines, scalable, white background"
// 步骤2:使用优化后的提示词调用generate_image
{
"prompt": "Minimal modern logo design, geometric shapes...",
"model": "midjourney-v8.1",
"aspectRatio": "1:1"
}Multi-Model Workflow
多模型工作流
typescript
// User: "Generate a logo with 3 different AI models"
// AI calls list_models to see what's available
{} // Returns: nanobanana-2, midjourney-v8.1, gpt-image-2, flux-2-klein, etc.
// Then generates with different models in parallel:
const models = ["nanobanana-2", "midjourney-v8.1", "flux-2-klein"];
for (const model of models) {
generate_image({
prompt: "Minimal tech startup logo, blue and white",
model,
aspectRatio: "1:1"
});
}typescript
// 用户:"Generate a logo with 3 different AI models"
// AI调用list_models查看可用模型
{} // 返回:nanobanana-2、midjourney-v8.1、gpt-image-2、flux-2-klein等
// 然后并行使用不同模型生成:
const models = ["nanobanana-2", "midjourney-v8.1", "flux-2-klein"];
for (const model of models) {
generate_image({
prompt: "Minimal tech startup logo, blue and white",
model,
aspectRatio: "1:1"
});
}Troubleshooting
故障排除
"Provider not configured"
"Provider not configured"
Run the setup wizard:
bash
/meigen:setupOr manually set environment variables:
bash
export MEIGEN_API_TOKEN=meigen_sk_...运行设置向导:
bash
/meigen:setup或手动设置环境变量:
bash
export MEIGEN_API_TOKEN=meigen_sk_...OR
或
export OPENAI_API_KEY=sk-...
export OPENAI_API_KEY=sk-...
OR
或
export COMFYUI_URL=http://localhost:8188
undefinedexport COMFYUI_URL=http://localhost:8188
undefinedComfyUI connection failed
ComfyUI连接失败
- Check ComfyUI is running:
curl http://localhost:8188/history - Verify URL in config:
"comfyuiUrl": "http://localhost:8188" - Test workflow exists: call with
comfyui_workflow{"action": "list"}
- 检查ComfyUI是否运行:
curl http://localhost:8188/history - 验证配置中的URL:
"comfyuiUrl": "http://localhost:8188" - 测试工作流是否存在:调用并传入
comfyui_workflow{"action": "list"}
Image generation times out
图片生成超时
Video generation can take 5-10 minutes. If using Hermes Agent, increase timeout:
yaml
mcp_servers:
meigen:
timeout: 600 # 10 minutes
connect_timeout: 120 # 2 minutesFor Claude Code / Cursor, timeouts are handled automatically.
视频生成可能需要5-10分钟。如果使用Hermes Agent,增加超时时间:
yaml
mcp_servers:
meigen:
timeout: 600 # 10分钟
connect_timeout: 120 # 2分钟对于Claude Code / Cursor,超时会自动处理。
"Invalid aspect ratio"
"Invalid aspect ratio"
Supported ratios: , , , , , ,
1:116:99:164:33:421:99:21Model-specific limits:
- GPT Image 2: ,
1:1,16:99:16 - Nanobanana 2: all ratios
- Midjourney V8.1: ,
1:1,16:9,9:16,4:33:4
支持的宽高比:、、、、、、
1:116:99:164:33:421:99:21模型特定限制:
- GPT Image 2:、
1:1、16:99:16 - Nanobanana 2:所有宽高比
- Midjourney V8.1:、
1:1、16:9、9:16、4:33:4
CLI: "Command not found: meigen"
CLI: "Command not found: meigen"
Use to run without global install:
npxbash
npx meigen gen -p "..."Or install globally:
bash
npm install -g meigen
meigen gen -p "..."使用无需全局安装即可运行:
npxbash
npx meigen gen -p "..."或全局安装:
bash
npm install -g meigen
meigen gen -p "..."Video: "Model does not support video"
Video: "Model does not support video"
Video generation is MeiGen Cloud only. Supported models:
seedance-2.0-fastseedance-2.0-prohappyhorse-1.0veo-3.1
OpenAI and ComfyUI providers don't support video.
视频生成仅支持MeiGen Cloud。支持的模型:
seedance-2.0-fastseedance-2.0-prohappyhorse-1.0veo-3.1
OpenAI和ComfyUI提供商不支持视频。
Code Examples
代码示例
TypeScript: Generate Logo Variations
TypeScript: 生成标志变体
typescript
// In an AI coding agent's context, this is what happens when user says:
// "Create 3 logo variations for a tech startup"
import { spawn } from 'child_process';
const prompt = "Minimal tech startup logo, geometric, blue and white, modern";
const models = ["nanobanana-2", "midjourney-v8.1", "flux-2-klein"];
async function generateLogoVariations() {
const jobs = models.map(model => {
return new Promise((resolve, reject) => {
const proc = spawn('npx', [
'meigen', 'gen',
'--prompt', prompt,
'--model', model,
'--aspect-ratio', '1:1',
'--json'
]);
let output = '';
proc.stdout.on('data', (data) => { output += data; });
proc.on('close', (code) => {
if (code === 0) {
resolve(JSON.parse(output));
} else {
reject(new Error(`Model ${model} failed`));
}
});
});
});
const results = await Promise.all(jobs);
results.forEach((result, i) => {
console.log(`${models[i]}: ${result.imageUrls[0]}`);
});
}
generateLogoVariations();typescript
// 在AI编码代理的上下文中,当用户说以下内容时会执行此代码:
// "Create 3 logo variations for a tech startup"
import { spawn } from 'child_process';
const prompt = "Minimal tech startup logo, geometric, blue and white, modern";
const models = ["nanobanana-2", "midjourney-v8.1", "flux-2-klein"];
async function generateLogoVariations() {
const jobs = models.map(model => {
return new Promise((resolve, reject) => {
const proc = spawn('npx', [
'meigen', 'gen',
'--prompt', prompt,
'--model', model,
'--aspect-ratio', '1:1',
'--json'
]);
let output = '';
proc.stdout.on('data', (data) => { output += data; });
proc.on('close', (code) => {
if (code === 0) {
resolve(JSON.parse(output));
} else {
reject(new Error(`Model ${model} failed`));
}
});
});
});
const results = await Promise.all(jobs);
results.forEach((result, i) => {
console.log(`${models[i]}: ${result.imageUrls[0]}`);
});
}
generateLogoVariations();TypeScript: ComfyUI Workflow Execution
TypeScript: ComfyUI工作流执行
typescript
// Generate with custom ComfyUI workflow
import { exec } from 'child_process';
import { promisify } from 'util';
const execAsync = promisify(exec);
async function generateWithComfyUI() {
const { stdout } = await execAsync(
'npx meigen gen ' +
'--prompt "portrait, cinematic lighting" ' +
'--provider comfyui ' +
'--workflow flux-dev-portrait ' +
'--aspect-ratio 2:3 ' +
'--json'
);
const result = JSON.parse(stdout);
console.log('Image saved to:', result.localPath);
return result.localPath;
}typescript
// 使用自定义ComfyUI工作流生成
import { exec } from 'child_process';
import { promisify } from 'util';
const execAsync = promisify(exec);
async function generateWithComfyUI() {
const { stdout } = await execAsync(
'npx meigen gen ' +
'--prompt "portrait, cinematic lighting" ' +
'--provider comfyui ' +
'--workflow flux-dev-portrait ' +
'--aspect-ratio 2:3 ' +
'--json'
);
const result = JSON.parse(stdout);
console.log('图片保存至:', result.localPath);
return result.localPath;
}Bash: Batch Product Photos
Bash: 批量产品照片
bash
#!/bin/bashbash
#!/bin/bashGenerate product photos from a reference image
从参考图片生成产品照片
REFERENCE="product.jpg"
PROMPTS=(
"luxury still life, dramatic lighting"
"minimal white background, studio lighting"
"nature setting, botanical elements"
"lifestyle shot with model"
)
for prompt in "${PROMPTS[@]}"; do
npx meigen gen
--prompt "$prompt"
--ref "$REFERENCE"
--model gpt-image-2
--aspect-ratio 4:3
--json | jq -r '.localPath' done
--prompt "$prompt"
--ref "$REFERENCE"
--model gpt-image-2
--aspect-ratio 4:3
--json | jq -r '.localPath' done
undefinedREFERENCE="product.jpg"
PROMPTS=(
"luxury still life, dramatic lighting"
"minimal white background, studio lighting"
"nature setting, botanical elements"
"lifestyle shot with model"
)
for prompt in "${PROMPTS[@]}"; do
npx meigen gen
--prompt "$prompt"
--ref "$REFERENCE"
--model gpt-image-2
--aspect-ratio 4:3
--json | jq -r '.localPath' done
--prompt "$prompt"
--ref "$REFERENCE"
--model gpt-image-2
--aspect-ratio 4:3
--json | jq -r '.localPath' done
undefinedPython: Video Generation Pipeline
Python: 视频生成流程
python
#!/usr/bin/env python3
import subprocess
import json
import os
def generate_video(prompt, first_frame=None, duration=5):
cmd = [
'npx', 'meigen', 'gen',
'--prompt', prompt,
'--video',
'--model', 'seedance-2.0-fast',
'--duration', str(duration),
'--json'
]
if first_frame:
cmd.extend(['--first-frame', first_frame])
result = subprocess.run(cmd, capture_output=True, text=True)
data = json.loads(result.stdout)
print(f"Video saved to: {data['localPath']}")
return data['videoUrls'][0]python
#!/usr/bin/env python3
import subprocess
import json
import os
def generate_video(prompt, first_frame=None, duration=5):
cmd = [
'npx', 'meigen', 'gen',
'--prompt', prompt,
'--video',
'--model', 'seedance-2.0-fast',
'--duration', str(duration),
'--json'
]
if first_frame:
cmd.extend(['--first-frame', first_frame])
result = subprocess.run(cmd, capture_output=True, text=True)
data = json.loads(result.stdout)
print(f"视频保存至: {data['localPath']}")
return data['videoUrls'][0]Text-to-video
文本转视频
generate_video("a cat walking through a garden, cinematic")
generate_video("a cat walking through a garden, cinematic")
Image-to-video
图片转视频
generate_video("camera zooms in slowly", first_frame="scene.jpg", duration=5)
undefinedgenerate_video("camera zooms in slowly", first_frame="scene.jpg", duration=5)
undefinedJavaScript: CI Pipeline Image Generation
JavaScript: CI流程图片生成
javascript
// ci-generate-assets.js
// Run in CI to generate marketing assets
const { execSync } = require('child_process');
const fs = require('fs');
const prompts = JSON.parse(fs.readFileSync('prompts.json', 'utf8'));
prompts.forEach((item) => {
const cmd = `npx meigen gen --prompt "${item.prompt}" --model ${item.model} --aspect-ratio ${item.ratio} --no-wait --json`;
try {
const output = execSync(cmd, { encoding: 'utf8' });
const result = JSON.parse(output);
console.log(`Submitted: ${item.name} (ID: ${result.generationId})`);
} catch (error) {
console.error(`Failed: ${item.name}`, error.message);
process.exit(1);
}
});
console.log('All assets submitted. Check MeiGen dashboard for completion.');javascript
// ci-generate-assets.js
// 在CI中运行以生成营销素材
const { execSync } = require('child_process');
const fs = require('fs');
const prompts = JSON.parse(fs.readFileSync('prompts.json', 'utf8'));
prompts.forEach((item) => {
const cmd = `npx meigen gen --prompt "${item.prompt}" --model ${item.model} --aspect-ratio ${item.ratio} --no-wait --json`;
try {
const output = execSync(cmd, { encoding: 'utf8' });
const result = JSON.parse(output);
console.log(`已提交: ${item.name} (ID: ${result.generationId})`);
} catch (error) {
console.error(`失败: ${item.name}`, error.message);
process.exit(1);
}
});
console.log('所有素材已提交。请查看MeiGen仪表板获取完成状态。');Provider-Specific Notes
提供商特定说明
MeiGen Cloud
MeiGen Cloud
- Free tier: 10 images/day, search & enhance unlimited
- Get API token: https://www.meigen.ai → Settings → API Keys
- Models: nanobanana-2, gpt-image-2, midjourney-v8.1, flux-2-klein, seedream-5.0, seedance-2.0-fast, seedance-2.0-pro, happyhorse-1.0, veo-3.1
- Video: MeiGen Cloud only (OpenAI/ComfyUI don't support video)
- 免费额度: 每日10张图片,搜索与优化无限制
- 获取API令牌: https://www.meigen.ai → 设置 → API密钥
- 模型: nanobanana-2、gpt-image-2、midjourney-v8.1、flux-2-klein、seedream-5.0、seedance-2.0-fast、seedance-2.0-pro、happyhorse-1.0、veo-3.1
- 视频: 仅MeiGen Cloud支持(OpenAI/ComfyUI不支持视频)
OpenAI-Compatible
兼容OpenAI
- Works with OpenAI, Azure OpenAI, or any compatible API
- Set and optionally
OPENAI_API_KEYOPENAI_BASE_URL - Models: (or whatever your endpoint provides)
gpt-image-2 - No video support
- 支持OpenAI、Azure OpenAI或任何兼容API
- 设置及可选的
OPENAI_API_KEYOPENAI_BASE_URL - 模型: (或您的端点提供的任何模型)
gpt-image-2 - 无视频支持
Local ComfyUI
本地ComfyUI
- Full control over models, samplers, workflows
- Import any ComfyUI API-format workflow
- Auto-detects KSampler, CLIPTextEncode, EmptyLatentImage, LoadImage nodes
- No cloud dependency, images never leave your machine
- No video support (use MeiGen Cloud for video)
- 完全控制模型、采样器、工作流
- 导入任何ComfyUI API格式的工作流
- 自动检测KSampler、CLIPTextEncode、EmptyLatentImage、LoadImage节点
- 无云依赖,图片永远不会离开您的机器
- 无视频支持(视频生成请使用MeiGen Cloud)
Advanced Configuration
高级配置
Custom Workflow Node Mapping
自定义工作流节点映射
If MeiGen doesn't auto-detect your ComfyUI workflow nodes, manually specify IDs in workflow JSON:
json
{
"3": { "class_type": "KSampler", "_meigen_role": "sampler" },
"6": { "class_type": "CLIPTextEncode", "_meigen_role": "positive_prompt" },
"7": { "class_type": "CLIPTextEncode", "_meigen_role": "negative_prompt" },
"5": { "class_type": "EmptyLatentImage", "_meigen_role": "latent" }
}如果MeiGen无法自动检测您的ComfyUI工作流节点,可在工作流JSON中手动指定ID:
json
{
"3": { "class_type": "KSampler", "_meigen_role": "sampler" },
"6": { "class_type": "CLIPTextEncode", "_meigen_role": "positive_prompt" },
"7": { "class_type": "CLIPTextEncode", "_meigen_role": "negative_prompt" },
"5": { "class_type": "EmptyLatentImage", "_meigen_role": "latent" }
}Multi-Provider Fallback
多提供商 fallback
Set up multiple providers for automatic fallback:
json
{
"provider": "comfyui",
"comfyuiUrl": "http://localhost:8188",
"meigenApiToken": "${MEIGEN_API_TOKEN}",
"openaiApiKey": "${OPENAI_API_KEY}"
}If ComfyUI is offline, MeiGen auto-falls back to cloud (MeiGen or OpenAI).
设置多个提供商以实现自动 fallback:
json
{
"provider": "comfyui",
"comfyuiUrl": "http://localhost:8188",
"meigenApiToken": "${MEIGEN_API_TOKEN}",
"openaiApiKey": "${OPENAI_API_KEY}"
}如果ComfyUI离线,MeiGen会自动 fallback 至云端(MeiGen或OpenAI)。
Output Customization
输出自定义
bash
undefinedbash
undefinedCustom output directories
自定义输出目录
export MEIGEN_OUTPUT_DIR=/Desktop/ai-images
export MEIGEN_VIDEO_OUTPUT_DIR=/Desktop/ai-videos
export MEIGEN_OUTPUT_DIR=/Desktop/ai-images
export MEIGEN_VIDEO_OUTPUT_DIR=/Desktop/ai-videos
Auto-open behavior (macOS only)
自动打开行为(仅macOS)
export MEIGEN_NO_AUTO_OPEN=1 # Disable auto-opening in Preview
undefinedexport MEIGEN_NO_AUTO_OPEN=1 # 禁用在Preview中自动打开
undefinedResources
资源
- Homepage: https://meigen.ai
- GitHub: https://github.com/jau123/MeiGen-AI-Design-MCP
- Prompt Library: https://github.com/jau123/nanobanana-trending-prompts
- Discord: https://discord.gg/uX6rnersUx
- Video Demo: https://youtu.be/JQ3DZ1DXqvs