setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMeiGen Plugin Setup
MeiGen插件设置
You are guiding the user through configuring the MeiGen plugin for image generation. Follow this flow step by step.
你将引导用户完成用于图片生成的MeiGen插件配置,请按以下步骤逐步操作。
Step 1: Welcome
步骤1:欢迎
First, check if a config file already exists:
bash
cat ~/.config/meigen/config.json 2>/dev/nullAlso check for existing ComfyUI workflows:
bash
ls ~/.config/meigen/workflows/*.json 2>/dev/nullIf config exists, show the current configuration (mask API keys: show first 10 chars + "...") and any saved workflows. Ask if they want to reconfigure.
If no config exists, present this introduction:
MeiGen Plugin ConfigurationThis is optional. Without configuration, you can still use free features:
- Search gallery for inspiration and prompts
- Enhance simple ideas into professional prompts
- Browse available AI models
Configuring a provider unlocks image generation.
Then proceed to Step 2.
首先,检查配置文件是否已存在:
bash
cat ~/.config/meigen/config.json 2>/dev/null同时检查是否存在已有的ComfyUI工作流:
bash
ls ~/.config/meigen/workflows/*.json 2>/dev/null如果配置已存在,显示当前配置(隐藏API密钥:显示前10个字符+“...”)以及所有已保存的工作流。询问用户是否需要重新配置。
如果配置不存在,展示以下介绍内容:
MeiGen插件配置此配置为可选操作。未配置时,你仍可使用免费功能:
- 搜索灵感图库及提示词
- 将简单想法优化为专业提示词
- 浏览可用AI模型
配置提供商后即可解锁图片生成功能。
之后进入步骤2。
Step 2: Choose Provider
步骤2:选择提供商
Present these options to the user:
为用户提供以下选项:
Option A: MeiGen Platform (Recommended)
选项A:MeiGen平台(推荐)
- Supports Nanobanana Pro, GPT image 1.5, Seedream 4.5 and more
- Reference image support for style transfer
- No additional accounts needed — just get a token from meigen.ai
- 支持Nanobanana Pro、GPT image 1.5、Seedream 4.5等更多模型
- 支持参考图片进行风格迁移
- 无需额外注册账号——只需从meigen.ai获取令牌
Option B: ComfyUI (Local)
选项B:ComfyUI(本地)
- Use your local ComfyUI installation for image generation
- Full control over models, samplers, and workflow settings
- No cloud API needed — runs entirely on your machine
- Import your own workflow from ComfyUI
- 使用本地ComfyUI安装环境进行图片生成
- 完全控制模型、采样器及工作流设置
- 无需云API——完全在本地设备运行
- 可从ComfyUI导入自定义工作流
Option C: Custom OpenAI-Compatible API
选项C:自定义OpenAI兼容API
- Use your own OpenAI, Together AI, Fireworks AI, or any OpenAI-compatible service
- Bring your own API key and billing
- Supports any model that uses the OpenAI endpoint
/v1/images/generations
- 使用自有OpenAI、Together AI、Fireworks AI或任何OpenAI兼容服务
- 自带API密钥及计费方式
- 支持所有使用OpenAI 接口的模型
/v1/images/generations
Option D: Import from curl Example
选项D:从curl示例导入
- Already have a working curl command from your API provider's docs? Paste it directly!
- We'll automatically extract the API key, base URL, and model name
- 已有API提供商文档中的可用curl命令?直接粘贴即可!
- 系统将自动提取API密钥、基础URL及模型名称
Option E: Skip image generation for now
选项E:暂时跳过图片生成配置
- Free features still available (inspiration search, prompt enhancement, model listing)
- You can run anytime later to enable image generation
/meigen:setup
If user chooses Skip, say goodbye and exit. Otherwise continue to the appropriate Step 3.
- 仍可使用免费功能(灵感搜索、提示词优化、模型列表浏览)
- 之后随时运行即可启用图片生成功能
/meigen:setup
如果用户选择跳过,告知用户并退出流程。否则进入对应步骤3。
Step 3A: MeiGen Platform Setup
步骤3A:MeiGen平台设置
Ask the user:
Do you already have a MeiGen API token, or do you need to create one?
询问用户:
你是否已拥有MeiGen API令牌,还是需要创建新令牌?
If they need to create one:
如果用户需要创建令牌:
Provide these instructions:
- Go to https://www.meigen.ai
- Sign in or create an account
- Navigate to Settings (click your avatar) → API Keys
- Click Create API Key, give it a name
- Copy the token (starts with )
meigen_sk_
Then ask them to paste the token.
提供以下操作说明:
- 访问https://www.meigen.ai
- 登录或创建账号
- 进入设置(点击头像)→ API密钥
- 点击创建API密钥,为其命名
- 复制令牌(以开头)
meigen_sk_
之后请用户粘贴该令牌。
If they already have one:
如果用户已拥有令牌:
Ask them to paste their token.
meigen_sk_...请用户粘贴其格式的令牌。
meigen_sk_...Validate the token:
验证令牌:
- Must start with
meigen_sk_ - Must be at least 30 characters long
If valid, proceed to Step 4 with this config:
json
{
"meigenApiToken": "<the token>"
}- 必须以开头
meigen_sk_ - 长度至少为30个字符
如果验证通过,使用以下配置进入步骤4:
json
{
"meigenApiToken": "<令牌内容>"
}Step 3B: ComfyUI (Local) Setup
步骤3B:ComfyUI(本地)设置
3B-1: Check Connection
3B-1:检查连接
Ask the user for their ComfyUI server URL:
What is your ComfyUI server URL? (default:)http://localhost:8188
Test the connection:
bash
curl -s <URL>/system_stats | head -c 200- Success: Show confirmation and continue to 3B-2
- Failure: Tell the user:
Cannot connect to ComfyUI at. Please make sure:
<URL>- ComfyUI is running (start it with or your launcher)
python main.py - The URL and port are correct
- No firewall is blocking the connection
- ComfyUI is running (start it with
询问用户ComfyUI服务器地址:
你的ComfyUI服务器地址是什么?(默认:)http://localhost:8188
测试连接:
bash
curl -s <URL>/system_stats | head -c 200- 连接成功:显示确认信息并进入3B-2
- 连接失败:告知用户:
无法连接到地址的ComfyUI。请确保:
<URL>- ComfyUI已启动(使用或启动器运行)
python main.py - 地址及端口正确
- 无防火墙阻止连接
- ComfyUI已启动(使用
3B-2: Import Workflow
3B-2:导入工作流
Explain the workflow export process to the user:
To use ComfyUI with this plugin, you need to export a workflow in API format:
- Open ComfyUI in your browser (usually
)http://localhost:8188- Load or create your preferred workflow
- Click ⚙️ Settings → enable "Enable Dev mode options"
- Click the "Save (API Format)" button that appears
- Save the downloaded
file somewhere convenient.json
Then ask them to provide the file path:
Please provide the path to your exported workflow JSON file: Example:~/Downloads/workflow_api.json
Use the tool with action to import the workflow:
comfyui_workflowimport- Ask for a short name for the workflow (e.g., "txt2img", "anime", "realistic")
- Call: with
comfyui_workflow importandfilePathname - Show the detected nodes and parameters to the user for confirmation
If the import succeeds, ask if they want to import additional workflows. If yes, repeat this step.
向用户说明工作流导出流程:
要在本插件中使用ComfyUI,你需要以API格式导出工作流:
- 在浏览器中打开ComfyUI(通常为
)http://localhost:8188- 加载或创建你偏好的工作流
- 点击**⚙️ 设置** → 启用**“启用开发者模式选项”**
- 点击出现的**“保存(API格式)”**按钮
- 将下载的
文件保存至方便访问的位置.json
之后请用户提供文件路径:
请提供你导出的工作流JSON文件路径: 示例:~/Downloads/workflow_api.json
使用工具并指定动作来导入工作流:
comfyui_workflowimport- 请用户为工作流设置简短名称(例如:“txt2img”、“anime”、“realistic”)
- 调用:并传入
comfyui_workflow import和filePath参数name - 向用户展示检测到的节点及参数以确认
如果导入成功,询问用户是否需要导入更多工作流。如果是,重复此步骤。
3B-3: Save Configuration
3B-3:保存配置
Build the config JSON:
json
{
"comfyuiUrl": "<the URL, omit if http://localhost:8188>",
"comfyuiDefaultWorkflow": "<the first imported workflow name>"
}Proceed to Step 4 to save. The workflow files are already saved by the import step.
构建配置JSON:
json
{
"comfyuiUrl": "<服务器地址,默认地址可省略>",
"comfyuiDefaultWorkflow": "<首个导入的工作流名称>"
}进入步骤4保存配置。工作流文件已在导入步骤中完成保存。
Step 3C: Custom OpenAI-Compatible API Setup
步骤3C:自定义OpenAI兼容API设置
Collect the following information. Present common presets first for convenience:
收集以下信息。为方便操作,先展示常用预设:
Quick Presets
快速预设
| Service | Base URL | Default Model |
|---|---|---|
| OpenAI | | |
| Together AI | | (check their docs) |
| Fireworks AI | | (check their docs) |
Ask the user to either pick a preset or provide custom values.
| 服务 | 基础URL | 默认模型 |
|---|---|---|
| OpenAI | | |
| Together AI | | (请查阅其官方文档) |
| Fireworks AI | | (请查阅其官方文档) |
询问用户选择预设或提供自定义参数。
Required Fields
必填字段
-
API Key (required): Their API key for the service
- Example: for OpenAI
sk-...
- Example:
-
Base URL (optional): API endpoint URL
- Default:
https://api.openai.com - Only needed if using a non-OpenAI service
- Default:
-
Model Name (optional): Which model to use
- Default:
gpt-image-1.5 - Different services use different model names
- Default:
-
API密钥(必填):对应服务的API密钥
- 示例:OpenAI的密钥格式为
sk-...
- 示例:OpenAI的密钥格式为
-
基础URL(可选):API接口地址
- 默认:
https://api.openai.com - 仅在使用非OpenAI服务时需要填写
- 默认:
-
模型名称(可选):要使用的模型
- 默认:
gpt-image-1.5 - 不同服务使用的模型名称不同
- 默认:
Optional: Test the connection
可选:测试连接
After collecting the info, suggest testing with curl:
bash
curl -s <BASE_URL>/v1/models \
-H "Authorization: Bearer <API_KEY>" | head -c 500This helps catch invalid keys or wrong URLs before saving.
Proceed to Step 4 with config from the collected fields (see bottom of this section for format).
Only include fields that differ from defaults. Omit if it's , omit if it's .
openaiBaseUrlhttps://api.openai.comopenaiModelgpt-image-1.5收集信息后,建议使用curl测试连接:
bash
curl -s <BASE_URL>/v1/models \
-H "Authorization: Bearer <API_KEY>" | head -c 500这有助于在保存配置前发现无效密钥或错误地址。
使用收集到的字段构建配置,进入步骤4(格式见本节末尾)。
仅保留与默认值不同的字段。如果为则省略,如果为则省略。
openaiBaseUrlhttps://api.openai.comopenaiModelgpt-image-1.5Step 3D: Import from curl Example
步骤3D:从curl示例导入
Ask the user to paste their curl command. Common formats they might paste:
Format 1: Image generation endpoint
bash
curl https://api.openai.com/v1/images/generations \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-1.5", "prompt": "a cat", "n": 1, "size": "1024x1024"}'Format 2: Simple model list test
bash
curl https://api.together.xyz/v1/models \
-H "Authorization: Bearer xxx"Format 3: With -u flag or other auth styles
bash
curl -u :sk-xxx https://api.fireworks.ai/inference/v1/images/generations \
-d '{"model": "accounts/fireworks/models/flux", "prompt": "a cat"}'请用户粘贴其curl命令。用户可能粘贴的常见格式如下:
格式1:图片生成接口
bash
curl https://api.openai.com/v1/images/generations \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-1.5", "prompt": "a cat", "n": 1, "size": "1024x1024"}'格式2:简单模型列表测试
bash
curl https://api.together.xyz/v1/models \
-H "Authorization: Bearer xxx"格式3:带-u标志或其他认证方式
bash
curl -u :sk-xxx https://api.fireworks.ai/inference/v1/images/generations \
-d '{"model": "accounts/fireworks/models/flux", "prompt": "a cat"}'Parse the curl command and extract:
解析curl命令并提取信息:
-
Base URL: The URL hostname + base path (strip,
/v1/images/generations, etc.)/v1/models- →
https://api.openai.com/v1/images/generationshttps://api.openai.com - →
https://api.together.xyz/v1/modelshttps://api.together.xyz/v1 - If URL ends with , keep the
/v1/...part only if it's NOT/v1api.openai.com
-
API Key: Fromheader, or
Authorization: Bearer <key>flag, or-u :<key>variants--header -
Model: From the JSON request bodyif present
"model": "<value>"
-
基础URL:URL主机名+基础路径(移除、
/v1/images/generations等后缀)/v1/models- →
https://api.openai.com/v1/images/generationshttps://api.openai.com - →
https://api.together.xyz/v1/modelshttps://api.together.xyz/v1 - 如果URL以结尾,仅当地址不是
/v1/...时保留api.openai.com部分/v1
-
API密钥:从请求头、
Authorization: Bearer <密钥>标志或-u :<密钥>变体中提取--header -
模型:如果JSON请求体中存在,则提取对应值
"model": "<值>"
Show parsed results for confirmation:
展示解析结果供用户确认:
I extracted the following from your curl command:
- API Key:
(first 10 chars)sk-xxx...- Base URL:
https://api.together.xyz/v1- Model:
black-forest-labs/FLUX.1-schnellDoes this look correct?
If user confirms, proceed to Step 4. If not, let them correct individual fields.
已从你的curl命令中提取以下信息:
- API密钥:
(前10个字符)sk-xxx...- 基础URL:
https://api.together.xyz/v1- 模型:
black-forest-labs/FLUX.1-schnell以上信息是否正确?
如果用户确认,进入步骤4。如果不正确,允许用户修改单个字段。
Step 4: Save Configuration
步骤4:保存配置
Build the config JSON based on the chosen provider:
For MeiGen:
json
{
"meigenApiToken": "<the token>"
}For ComfyUI:
json
{
"comfyuiUrl": "<url, omit if default>",
"comfyuiDefaultWorkflow": "<workflow name>"
}For OpenAI-compatible (manual or curl import):
json
{
"openaiApiKey": "<the key>",
"openaiBaseUrl": "<base url, omit if default>",
"openaiModel": "<model, omit if default>"
}Create the config directory and write the file:
bash
mkdir -p ~/.config/meigenThen use the Write tool to write the JSON config to .
~/.config/meigen/config.jsonImportant: If the user already has a config file with other providers configured, merge the new config into the existing one rather than overwriting. For example, a user might have both MeiGen and ComfyUI configured.
After writing, set permissions:
bash
chmod 600 ~/.config/meigen/config.json根据用户选择的提供商构建配置JSON:
MeiGen平台配置:
json
{
"meigenApiToken": "<令牌内容>"
}ComfyUI配置:
json
{
"comfyuiUrl": "<服务器地址,默认地址可省略>",
"comfyuiDefaultWorkflow": "<工作流名称>"
}OpenAI兼容API配置(手动或curl导入):
json
{
"openaiApiKey": "<密钥内容>",
"openaiBaseUrl": "<基础URL,默认地址可省略>",
"openaiModel": "<模型名称,默认模型可省略>"
}创建配置目录并写入文件:
bash
mkdir -p ~/.config/meigen然后使用写入工具将JSON配置写入。
~/.config/meigen/config.json重要提示:如果用户已存在包含其他提供商配置的文件,请将新配置合并到现有文件中,而非覆盖。例如,用户可能同时配置了MeiGen和ComfyUI。
写入完成后,设置文件权限:
bash
chmod 600 ~/.config/meigen/config.jsonStep 5: Completion
步骤5:配置完成
Tell the user:
Configuration saved! To activate the new settings, please start a new Claude Code session (close and reopen, or open a new terminal tab).After restarting, you can:
- Use
to create AI imagesgenerate_image- Run
to see available models and workflowslist_models- Try: "Generate a beautiful sunset over mountains"
You can runagain anytime to change your configuration./meigen:setup
For ComfyUI users, additionally mention:
ComfyUI tips:
- Use
to see your saved workflowscomfyui_workflow list- Use
to see adjustable parameters (steps, CFG, sampler, etc.)comfyui_workflow view- Ask me to change any workflow parameter — e.g., "increase steps to 30" or "switch sampler to dpmpp_2m"
- You can import more workflows anytime with
comfyui_workflow import
告知用户:
配置已保存!请重启Claude Code会话(关闭并重新打开,或打开新终端标签页)以激活新设置。重启后,你可以:
- 使用
命令生成AI图片generate_image- 运行
查看可用模型及工作流list_models- 尝试输入:“生成一幅山脉上的绝美日落图”
你可随时再次运行修改配置。/meigen:setup
针对ComfyUI用户,额外补充:
ComfyUI使用提示:
- 使用
查看已保存的工作流comfyui_workflow list- 使用
查看可调整参数(步数、CFG、采样器等)comfyui_workflow view- 可要求修改任意工作流参数——例如:“将步数增加至30”或“切换采样器为dpmpp_2m”
- 你可随时使用
导入更多工作流comfyui_workflow import