Nodes/ComfyUI Midjourney Direct/Midjourney Generate (Direct via LegNext)
ComfyUI Node

Midjourney Generate (Direct via LegNext)

Midjourney in ComfyUI without Discord — for a price

By jeremieLouvaert·Created 4 months ago·Updated 15 days ago· 1
Midjourney Generate (Direct via LegNext)
    • image
    • cost_info
    • cache_key
    prompt
    versionv7 (default)
    aspect_ratio2:3
    seed0
    style_rawtrue
    stylize100
    weird0
    chaos0
    quality1
    turbofalse
    draftfalse
    image_weight1.00
    negative
    tilefalse
    poll_interval_seconds3.0
    timeout_seconds300
    api_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 to v7 (default), which is right for the standard pay-as-you-go tier. v8.1 / v8 / v8 hd need a LegNext Pro subscription on top. niji-6 is 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_seconds if 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.

    CategoryMidjourney Direct

    Inputs (17)

    NameTypeDefaultDescription
    promptSTRINGMidjourney prompt. Don't include flags here — wire the structured inputs below.
    versionCOMBOv7 (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_ratioCOMBO2:310 options: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, +4
    seedINT00–42949672950 = random. Same seed + same prompt + same params = consistent output.
    style_rawoptBOOLEANtrue--style raw. Reduces MJ's default heavy stylization. ON for AKURATE-style realism.
    stylizeoptINT1000–1000--s. Lower = more prompt-faithful. Higher = more artistic interpretation.
    weirdoptINT00–3000--weird. Unconventional aesthetic exploration. 0 = off.
    chaosoptINT00–100--chaos. Variety across the four grid tiles.
    qualityoptCOMBO1--q. Higher = more compute = more cost. 1 is standard.
    turbooptBOOLEANfalse--turbo. 4x faster, 2x cost.
    draftoptBOOLEANfalse--draft. Half-power preview (cheap + fast). Use for ideation passes.
    image_weightoptFLOAT1.000–3--iw. Influence of any image prompt. Only meaningful when prompt includes a URL.
    negativeoptSTRING--no. Comma-separated tokens to exclude (e.g. 'people, text, frame').
    tileoptBOOLEANfalse--tile. Generate seamless tileable patterns.
    poll_interval_secondsoptFLOAT3.01–30How often to check job status. 3s is a reasonable default.
    timeout_secondsoptFLOAT30030–1800Hard cap on total wait time before raising an error.
    api_keyoptSTRING

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    cost_infoSTRING
    cache_keySTRING