π€ Leon Midjourney API Generate
Real Midjourney generation inside ComfyUI β via your own proxy server
- image
- image_url
- task_id
- final_prompt_from_api
- message_hash
Leon Midjourney API Generate is the node that lets you run actual Midjourney - the closed, subscription, Discord-born model that set the artistic-quality benchmark the open-source world spent years chasing - from inside a ComfyUI graph. It submits an imagine job to a Midjourney proxy, polls until it's done, and hands you back the finished image as a tensor. Pair it with the pack's Image Split 4-Grid node and you've got the classic Midjourney Generate β Split 4-Grid β 4x Preview workflow, all inside ComfyUI.
Here's the part you have to swallow before this gets useful: there is no Midjourney API that this node calls directly. It talks to a self-hosted Midjourney proxy server - the mj_proxy_endpoint defaults to http://localhost:8080 - which is the community-standard way people run Midjourney programmatically. You stand up the proxy (there are several popular open-source ones implementing the /mj/submit/imagine and /mj/task/{id}/fetch endpoints), configure your Midjourney/Discord accounts in it, and this node is the ComfyUI client for that proxy. No proxy, no generation. That's the whole setup cost of this node, and it's not small.
How it works
Submit-then-poll, exactly like the describe node. It POSTs to {endpoint}/mj/submit/imagine with your prompt, botType, and optional base64_array_json (a JSON array of data-URI images for image prompting - the tooltip shows the format) and account_filter_remark (routes the job to a specific Discord account in the proxy). Then it polls {endpoint}/mj/task/{task_id}/fetch every polling_interval_seconds (default 5) up to max_polling_attempts (default 30) until the task reports SUCCESS or FAILURE.
The inputs that matter:
mj_proxy_endpointandapi_key- the proxy address and its key, sent as bothmj-api-secretandX-Api-Keyheaders (defaultsk-midjourneymatches common proxy configs).prompt- use Midjourney's own syntax: the defaultdog playing ball --v 7 --ar 1:1shows the flags work exactly like in Discord.bot_type-MID_JOURNEYorNIJI_JOURNEY.base64_array_json- optional image-prompt array, as JSON.
Outputs are richer than the pack's other nodes: image (tensor), image_url, task_id, final_prompt_from_api (what Midjourney actually expanded your prompt to - often includes the full --p/style hash), and message_hash.
Installing it
The ComfyUI half is the easy half:
cd ComfyUI/custom_nodes
git clone https://github.com/l3ony2k/comfyui-leon-nodes
pip install -r requirements.txt
Restart ComfyUI or install via ComfyUI Manager. The other half - running a Midjourney proxy on localhost:8080 with a working Discord account attached - is the real setup, and it's on you.
Where people get burned
The 30-attempt default poll is 150 seconds of patience; Midjourney jobs on a slow account can exceed it, so bump max_polling_attempts before blaming the node. The base64_array_json must be valid JSON (the format in the tooltip is literal). And remember this is a paid subscription model running through an unofficial proxy - you're responsible for the proxy's terms and Midjourney's ToS. The output image is a 2x2 grid, which is exactly why the 4-Grid split node exists right next to it in the pack. It's fiddly to set up and absolutely worth it if you want Midjourney quality inside ComfyUI.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| mj_proxy_endpoint | STRING | http://localhost:8080 | Base URL of your Midjourney Proxy (e.g., http://localhost:8080) |
| api_key | STRING | sk-midjourney | Your API key for the proxy (used for both mj-api-secret and X-Api-Key headers) |
| prompt | STRING | dog playing ball --v 7 --ar 1:1 | β |
| bot_type | COMBO | MID_JOURNEY | 2 options: MID_JOURNEY, NIJI_JOURNEY |
| polling_interval_seconds | INT | 51β60 | How often to check task status (seconds) |
| max_polling_attempts | INT | 301β120 | Max attempts to poll for result before timeout |
| account_filter_remarkopt | STRING | Optional: Remark for account filtering (e.g., lzn) | |
| base64_array_jsonopt | STRING | Optional: JSON string for base64Array, e.g., ["data:image/png;base64,YOUR_BASE64"] |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| image_url | STRING | β |
| task_id | STRING | β |
| final_prompt_from_api | STRING | β |
| message_hash | STRING | β |