Nodes/Api Nodes/Float API Node
ComfyUI Node

Float API Node

A Denoise Knob Your Scripts Can Turn

By hypnodes·Created 2 years ago·Updated 7 months ago· 0
Float API Node
    • output
    namename
    default_value0.00

    The Float API Node is the middle child of this pack's family and honestly the one I reach for most. It's a single number - a slider, essentially - that you can change from outside the editor. Denoise strength, CFG scale, a LoRA weight, an upscale amount. Every workflow has a few of those, and every workflow would love to tune them from a script instead of by hand.

    Despite the name, it calls no external API. No key, no credits, no network. It ships in the tiny pack hypnodes/ComfyUI_ApiNodes alongside its siblings (String, Integer, Any API Nodes), and the whole pack exists for the opposite direction: exposing a workflow's inputs as parameters so a program can run it. One heads-up so you don't get lost: ComfyUI's official "API Nodes" - the paid Partner Nodes that call closed models - are a completely different thing. This is the free, local, boring direction, and boring is good here.

    How it works

    The mechanism is a pass-through. The node takes default_value, returns it unchanged, typed as FLOAT, and does nothing else. The name field is metadata for the script; it has zero effect on the graph. When you export the workflow in API format and post it to /api/prompt, the companion library or CLI finds the node by class and name, swaps in your number, and submits. The graph runs with your value instead of the default.

    Inputs and outputs

    • name (STRING, default "name") - the parameter key your script matches on. Rename it to denoise or cfg so the JSON is readable.
    • default_value (FLOAT, default 0) - the number, and the thing the node outputs.
    • output - one FLOAT socket.

    Note that default is 0.0. You'll almost always want to set it, because a denoise of zero is not a flattering setting.

    Wiring it up

    Connect it where a float belongs. Right-click a KSampler's cfg or denoise widget, choose Convert widget to input, and wire this node in. Now the value shown here is authoritative, and a script can sweep denoise from 0.2 to 0.8 across a dozen runs without touching the canvas.

    ComfyUI is picky about INT vs FLOAT sockets, so don't cross the streams: fractional values go through this node, whole numbers like steps, seed, and batch size go through the Integer API Node.

    Install

    ComfyUI Manager → search ComfyUI_ApiNodes, or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hypnodes/ComfyUI_ApiNodes
    

    Then restart. Four small files, zero Python dependencies, no model downloads. About as painless a custom node as you'll find.

    Gotchas

    The usual pack-wide traps apply: the script's parameter key must match the node's name exactly (spelling and case), and keep names unique across the graph or the same value overwrites every node sharing that name. One extra to remember here: changing the widget in the UI sets the default for every future run, but an API override only lasts for that one submission. That's a feature once you're used to it - your UI default stays as a sane fallback, and your script is free to override it per call.

    Categoryapi

    Inputs (2)

    NameTypeDefaultDescription
    nameSTRINGname
    default_valueFLOAT0.00

    Outputs (1)

    NameTypeDescription
    outputFLOAT