Midjourney Generate (Direct via LegNext)
Midjourney in ComfyUI without Discord — for a price
- image
- cost_info
- cache_key
Midjourney Generate (Direct via LegNext) is the one node in the ComfyUI-Midjourney-Direct pack, and the name deserves a footnote: it doesn't talk to Midjourney directly, and it isn't free. Midjourney has no official public API, so this node calls LegNext.ai, a pool-based proxy that rents real Midjourney accounts and bills you per image - roughly $0.08 for a fast render, no monthly minimum. What you get out is genuine Midjourney output (v6 through v7, niji-6, and the v8 line with a Pro sub) as a normal IMAGE tensor in your graph. No Discord, no subscription juggling, no moderation roulette.
Why bother when Flux and friends run locally? Because Midjourney still has a look. Our KB's closed-source-models essay calls it "the defining benchmark the open-source community measures against" - consistent artistic finish that keeps pulling people back even as the open gap shrinks. This node is for the person who wants that look as a building block - drop the 4-grid into an upscaler, a face-restore pass, or an img2img chain. It is not for people who just want MJ pictures; Midjourney's own web app is easier and cheaper at volume. This is a pipeline tool, not a gateway.
How it works
It's a thin REST client, and the source is refreshingly honest about it. The node assembles your prompt into a plain Midjourney flag string - --v 7 --ar 2:3 --style raw and friends - POSTs it to LegNext's diffusion endpoint with your key in an x-api-key header, gets back a job_id, then polls the job endpoint every few seconds until it's done. Then it downloads the result and hands you the familiar 4-grid as a single composite IMAGE, typically 1024×1024 with four 512×512 tiles. All the actual MJ inference happens on LegNext's servers; your GPU just waits, usually 45–90 seconds.
The inputs that matter
Only four are required, and you'll set three of them:
prompt- your imagine prompt, multiline. Don't stuff flags in here; wire them as structured inputs below.version- defaults tov7 (default), which is right for the standard pay-as-you-go tier.v8.1/v8/v8 hdneed a LegNext Pro subscription on top.niji-6is the anime/East-Asian aesthetic model.aspect_ratio- 1:1 through 21:9, default 2:3.seed- 0 is random; a fixed seed plus the same prompt and params gives consistent output.
The optional list is where the Midjourney muscle lives: style_raw (on by default - reduces MJ's heavy default stylization, the AKURATE-realism move), stylize (0–1000, lower is more prompt-faithful), weird (0–3000, unconventional aesthetics), chaos (0–100, variety across the grid tiles), quality (0.25–4, higher costs more), turbo (4× faster, 2× price), draft (cheap fast preview for ideation), image_weight (only matters if your prompt contains an image URL), negative (the --no list), and tile. Leave poll_interval_seconds (3) and timeout_seconds (300) alone until something times out.
Outputs
image(IMAGE) - the 4-grid composite. Split or crop it downstream; individual-tile upscaling is a v0.2 feature that doesn't exist yet.cost_info(STRING) - points consumed, approximate USD, elapsed time, and the actual seed. A nice reality check on how much ideation costs.cache_key(STRING) - a deterministic hash of prompt + flags + seed. Wire it into the same author's ComfyUI-API-Optimizer Hash Vault and identical re-runs return instantly at $0. This is the pack's smartest feature - reuse it.
Install
ComfyUI Manager (search "ComfyUI Midjourney Direct") or the manual way:
cd ComfyUI/custom_nodes/
git clone https://github.com/jeremieLouvaert/ComfyUI-Midjourney-Direct.git
pip install -r ComfyUI-Midjourney-Direct/requirements.txt
Restart ComfyUI and it appears under Midjourney Direct. Dependencies are just requests, Pillow, numpy - no model downloads, no heavy wheels, nothing to hurt your VRAM.
API key setup
Grab a key at legnext.ai. The node looks for it in order: the api_key input → the LEGNEXT_API_KEY environment variable → a legnext_api_key.txt file in your ComfyUI root. The file is the recommended option - set it once and forget it.
Where people get burned
- "No LegNext API key found" - you forgot all three places. Do the file, it's the least fiddly.
- Flag rejections. LegNext occasionally rejects flag combos Midjourney itself accepts. Job fails with a flag-ish error? Strip the exotic stuff (
weird,chaos, odd quality values) and retry. - Timeout on a busy pool. Default cap is 300s; generations normally land in 45–90s, but a backed-up pool can blow past that. Bump
timeout_secondsif you keep hitting the wall. - Low-res tiles. You're getting four 512×512 images in one grid, so plan an upscale pass.
This is v0.1, remember - imagine-only, no U1–U4 upscaling, no V1–V4 variation, no reroll or zoom. If that matters, it isn't there yet. What is there works, costs nickels, and drops Midjourney into your graph like it always belonged.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Midjourney prompt. Don't include flags here — wire the structured inputs below. | |
| version | COMBO | v7 (default) | v7 is the default for the standard LegNext pay-as-you-go tier. v8 / v8.1 / v8 hd require a LegNext Pro subscription. niji-6 is the anime / East-Asian aesthetic model. |
| aspect_ratio | COMBO | 2:3 | 10 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4 |
| seed | INT | 00–4294967295 | 0 = random. Same seed + same prompt + same params = consistent output. |
| style_rawopt | BOOLEAN | true | --style raw. Reduces MJ's default heavy stylization. ON for AKURATE-style realism. |
| stylizeopt | INT | 1000–1000 | --s. Lower = more prompt-faithful. Higher = more artistic interpretation. |
| weirdopt | INT | 00–3000 | --weird. Unconventional aesthetic exploration. 0 = off. |
| chaosopt | INT | 00–100 | --chaos. Variety across the four grid tiles. |
| qualityopt | COMBO | 1 | --q. Higher = more compute = more cost. 1 is standard. |
| turboopt | BOOLEAN | false | --turbo. 4x faster, 2x cost. |
| draftopt | BOOLEAN | false | --draft. Half-power preview (cheap + fast). Use for ideation passes. |
| image_weightopt | FLOAT | 1.000–3 | --iw. Influence of any image prompt. Only meaningful when prompt includes a URL. |
| negativeopt | STRING | --no. Comma-separated tokens to exclude (e.g. 'people, text, frame'). | |
| tileopt | BOOLEAN | false | --tile. Generate seamless tileable patterns. |
| poll_interval_secondsopt | FLOAT | 3.01–30 | How often to check job status. 3s is a reasonable default. |
| timeout_secondsopt | FLOAT | 30030–1800 | Hard cap on total wait time before raising an error. |
| api_keyopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| cost_info | STRING | — |
| cache_key | STRING | — |