Nodes/ComfyUI OpenAI API/OpenAI API - Temperature
ComfyUI Node

OpenAI API - Temperature

The randomness dial for in-workflow LLM calls

By hekmon·Created about a year ago·Updated 9 months ago· 46
OpenAI API - Temperature
  • other_options
  • Options
temperature1.0

Every LLM API has a temperature knob, and this is the pack's version of it. OAIAPI_Temperature controls how much randomness the chat model gets to play with: low values make output more focused and deterministic, high values make it more varied and creative. If you're using a language model inside ComfyUI to rewrite prompts or classify images, this is usually the first option node you want - because the default 1.0 is honestly a bit wild for automation, and 0.5–0.7 tends to be the sweet spot for "turn these tags into a coherent prompt" work.

How it works

Same pattern as every option node in the pack: you set a float, it gets packed into an OAIAPI_OPTIONS payload, and the Chat Completion node extracts it and passes it as the named temperature argument to the request. The slider runs 0.0 to 2.0 (step 0.1, default 1.0), which mirrors the OpenAI API's own range. Note the semantics: 0 isn't "off," it's "greedy" - the model picks the single most likely token at every step, which gives you the most stable, boring, repeatable output. Below 0 isn't a thing here, despite some sampling tools allowing it.

The inputs and output

  • temperature - the only real control. Low (0.0–0.5): deterministic, consistent, good for structured outputs and classification. Mid (0.5–0.9): creative but coherent, the right zone for prompt rewriting. High (1.2+): increasingly unhinged, fun for ideation, terrible for anything you need to parse.
  • other_options (optional) - chain it with other option nodes; the last one to set a key wins.
  • Output: Options (OAIAPI_OPTIONS), wired into the next option node or Chat Completion's options input.

Installing it

It ships with the rest of the pack, so it's the same one-liner. ComfyUI Manager → search "OpenAI API" → install, or clone the repo:

cd ComfyUI/custom_nodes
git clone https://github.com/hekmon/comfyui-openai-api

Restart after, no models to download, only openai as a new pip dependency.

Where people get burned

The trap is cranking temperature up because output feels "dull," then discovering that high temperature is exactly why your workflow's answers are inconsistent run-to-run. If you need stability, low temperature does more than a seed ever will. And a real quirk of this pack's design: temperature and top_p are alternatives - OpenAI recommends changing one or the other, not both - so if you wire in a Top P node too, you're double-dipping on randomness. For a workflow that rewrites prompts for a downstream model, start at 0.6, and don't touch it again unless the output quality genuinely demands it.

CategoryOpenAI API/Options

Inputs (2)

NameTypeDefaultDescription
temperatureFLOAT1.00–2Number between 0.0 and 2.0. Defaults to 1.0.
other_optionsoptOAIAPI_OPTIONSOthers options to merge with

Outputs (1)

NameTypeDescription
OptionsOAIAPI_OPTIONSMerged options to forward