Nodes/Leon's Utility and API Integration Nodes/πŸ€– Leon Midjourney API Generate
ComfyUI Node

πŸ€– Leon Midjourney API Generate

Real Midjourney generation inside ComfyUI β€” via your own proxy server

By l3ony2kΒ·Created about a year agoΒ·Updated 2 months agoΒ· 3
πŸ€– Leon Midjourney API Generate
    • image
    • image_url
    • task_id
    • final_prompt_from_api
    • message_hash
    β—„mj_proxy_endpointhttp://localhost:8080β–Ί
    β—„api_keysk-midjourneyβ–Ί
    β—„promptdog playing ball --v 7 --ar 1:1β–Ί
    β—„bot_typeMID_JOURNEYβ–Ί
    β—„polling_interval_seconds5β–Ί
    β—„max_polling_attempts30β–Ί
    β—„account_filter_remarkβ–Ί
    β—„base64_array_jsonβ–Ί

    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_endpoint and api_key - the proxy address and its key, sent as both mj-api-secret and X-Api-Key headers (default sk-midjourney matches common proxy configs).
    • prompt - use Midjourney's own syntax: the default dog playing ball --v 7 --ar 1:1 shows the flags work exactly like in Discord.
    • bot_type - MID_JOURNEY or NIJI_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.

    CategoryLeon_API

    Inputs (8)

    NameTypeDefaultDescription
    mj_proxy_endpointSTRINGhttp://localhost:8080Base URL of your Midjourney Proxy (e.g., http://localhost:8080)
    api_keySTRINGsk-midjourneyYour API key for the proxy (used for both mj-api-secret and X-Api-Key headers)
    promptSTRINGdog playing ball --v 7 --ar 1:1β€”
    bot_typeCOMBOMID_JOURNEY2 options: MID_JOURNEY, NIJI_JOURNEY
    polling_interval_secondsINT51–60How often to check task status (seconds)
    max_polling_attemptsINT301–120Max attempts to poll for result before timeout
    account_filter_remarkoptSTRINGOptional: Remark for account filtering (e.g., lzn)
    base64_array_jsonoptSTRINGOptional: JSON string for base64Array, e.g., ["data:image/png;base64,YOUR_BASE64"]

    Outputs (5)

    NameTypeDescription
    imageIMAGEβ€”
    image_urlSTRINGβ€”
    task_idSTRINGβ€”
    final_prompt_from_apiSTRINGβ€”
    message_hashSTRINGβ€”