Nodes/KIE.ai Nodes Next/Generate or Edit Image · flux-kontext-pro
ComfyUI Node

Generate or Edit Image · flux-kontext-pro

The same edit, one tier down

By felipederosilva·Created about a month ago·Updated about 22 hours ago· 3
Generate or Edit Image · flux-kontext-pro
    • image
    • url
    • all_urls_json
    • task_id
    • raw_json
    • credits_consumed
    • credits_left
    ◄promptA serene mountain landscape at sunset with a lake reflecting the orange sky►
    ◄enableTranslationtrue►
    ◄aspectRatio16:9►
    ◄outputFormatjpeg►
    ◄promptUpsamplingfalse►
    ◄safetyTolerance2►
    ◄uploadCnfalse►
    ◄inputImagehttps://example.com/input-image.jpg►
    ◄watermarkyour-watermark-id►
    ◄timeout_seconds1200►
    ◄callback_url►

    Two Kontext nodes ship in this pack - Pro and Max - with identical controls and different model IDs. If you're here, the practical question is "should I have clicked Max?" The answer, most of the time: start here, and only pay for Max when Pro keeps missing.

    Kontext itself is the 12B instruction editor that turned "describe the change" into the normal way to edit an image, and it's still the most reliable thing at keeping a face recognisable across passes. It's also infamous for the licence update that came with it, which is a separate argument; the hosted node doesn't care either way.

    How it works

    The node runs KIE's Kontext endpoint in whichever mode your inputs imply. Prompt only → text-to-image generation. Prompt plus inputImage → the same prompt becomes an edit instruction. Then it polls the job, downloads the result and returns a native ComfyUI IMAGE tensor.

    The catch, same as the Max node: inputImage is a string URL, not an IMAGE socket. Kontext's documented page doesn't declare it as media, so the pack leaves it as text and you supply a URL the API can fetch. In practice you get it from the pack's own upload node - wire KIE • Upload Image and take its first_url, or use any public link.

    Inputs

    prompt - required, English only. For edits, write the change, not the picture: "make the sky overcast and remove the people on the left" beats a full re-description, because the model already has the image.

    inputImage - the URL. Leave it as the placeholder and you'll get a generation instead of an edit, which is a confusing way to find out you forgot it.

    enableTranslation (default on) - auto-translates a non-English prompt before sending. Turn it off when you're writing English and want your exact wording preserved.

    aspectRatio - dropdown, 16:9 by default, six choices. In generation mode it sets the output shape; in editing mode, setting it asks for a re-frame. Leave it out of the edit's way unless you want that.

    safetyTolerance - dropdown defaulting to 2. The tooltip distinguishes the modes: generation accepts 0 (strict) through 6 (permissive), editing caps at 2, described as balanced. So a value that feels conservative in generation is the maximum permissiveness for an edit.

    outputFormat - jpeg by default. Switch to PNG if the output is going back into the graph for more work; JPEG between passes loses detail you'll want later.

    promptUpsampling (default off) - the service rewrites your prompt first. Good for one-liners, bad for prompts you thought about, and it adds latency either way.

    uploadCn - picks a China or non-China server for the image upload, based on where you're sitting. Leave the default unless uploads drag.

    watermark - pre-filled with a placeholder string, and any non-empty value means a watermark gets added. Clear the field.

    Plus timeout_seconds (1200 default) and callback_url (empty unless you run a webhook).

    Outputs

    image is the edit or generation as a native tensor. Then the pack's standard suit: url for the hosted file, all_urls_json for all returned URLs, task_id for the job, raw_json for the raw response, and credits_consumed / credits_left as floats, mirrored on the node after each run.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    

    ComfyUI Manager does the same job if you search "KIE.ai Nodes Next". Restart ComfyUI, then paste your KIE key once in Settings → KIE.ai Nodes Next → Connection - validated against KIE before it replaces a saved key, kept out of your workflow, masked in the UI. On a server you can set KIE_API_KEY and skip the UI entirely; it takes priority.

    The install is requests, Pillow, numpy, PyYAML. Nothing to download, because the model is running on someone else's hardware.

    Notes from using it

    • Kontext drifts. It'll nudge details you never mentioned and get softer over repeated edits. Keep the original in the graph and re-edit from it rather than editing an edit.
    • Pro vs Max is a quality tier on the same feature set. Work the prompt on Pro; escalate when you've stopped gaining anything.
    • The watermark field is the most common accidental mistake on this node after inputImage, thanks to that pre-filled placeholder.
    • First-run "endpoint not resolved" - the pack builds nodes from KIE's live documentation and refreshes the catalog in the background. Restart or hit the catalog refresh node and the endpoint fills in.
    CategoryKIE Next/Image/Black Forest Labs/Flux Kontext

    Inputs (11)

    NameTypeDefaultDescription
    promptSTRINGA serene mountain landscape at sunset with a lake reflecting the orange skyText prompt describing the desired image or edit. Required for both generation and editing modes. - Should be detailed and specific - For image editing, describe the desired changes - For image generation, describe the complete scene - IMPORTANT: Only English language is supported
    enableTranslationoptBOOLEANtrueWhether to enable automatic translation feature. - Since prompt only supports English, when this parameter is true, the system will automatically translate non-English prompts to English - If your prompt is already in English, you can set this to false - Default value: true
    aspectRatiooptCOMBO16:9Output image aspect ratio. You Applicable in both text-to-image generation and image editing modes. For **text-to-image generation** , the output image will follow the specified aspect ratio. For **image editing** , if aspectRatio is provided, the edited image will follow that ratio. If not provided, the image will retain its original aspect ratio. Supported Aspect Ratios: | Ratio | Format Type | Common Use Cases | |-------|-------------|-----------------| | 21:9 | Ultra-wide | Cinematic displays, panoramic views | | 16:9 | Widescreen | HD video, desktop wallpapers | | 4:3 | Standard | Traditional displays, presentations | | 1:1 | Square | Social media posts, profile pictures | | 3:4 | Portrait | Magazine layouts, portrait photos | | 9:16 | Mobile Portrait | Smartphone wallpapers, stories | > Note: Default ratio is "16:9" if not specified.
    outputFormatoptCOMBOjpegOutput image format.
    promptUpsamplingoptBOOLEANfalse- If true, performs upsampling on the prompt - May increase processing time
    safetyToleranceoptCOMBO2**For Image Generation Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive). **For Image Editing Mode:** Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 2 (balanced). Default: 2
    uploadCnoptBOOLEANfalse(Optional) Specifies the server region for image upload. Set to true to use servers in China, false to use non-China servers. Choose based on your geographical location for optimal upload speeds.
    inputImageoptSTRINGhttps://example.com/input-image.jpgURL of the input image for editing mode. Required when editing an existing image. - Must be a valid image URL - Image must be accessible to the API server
    watermarkoptSTRINGyour-watermark-idWatermark identifier to add to the generated image. - Optional - If provided, a watermark will be added to the output image
    timeout_secondsoptINT120030–7200—
    callback_urloptSTRINGOptional KIE callback URL. Leave empty for normal ComfyUI use.

    Outputs (7)

    NameTypeDescription
    imageIMAGE—
    urlSTRING—
    all_urls_jsonSTRING—
    task_idSTRING—
    raw_jsonSTRING—
    credits_consumedFLOAT—
    credits_leftFLOAT—