ComfyUI Node

Calculate Plus

The node that adds two numbers — dressed up as machine learning

By jhj0517·Created 2 years ago·Updated 2 years ago· 44
Calculate Plus
  • model
  • plus_value
a5
b10

Calculate Plus adds two integers. That's it. But it demands you feed it a MY_MODEL object first - an object that contains nothing but the number 1 and a print statement - because the actual point of this node is not the addition. It's to teach you how a custom node works.

This ships in ComfyUI-CustomNodes-Template, jhj0517's starter repo for people who want to write their own ComfyUI nodes (the author of Whisper-WebUI and the finetuning-notebooks LoRA trainers - a serious name in the ecosystem, which is why the template is worth a look even though these demo nodes aren't). If you google "Calculate Plus" you've landed on a commented teaching example, not a tool for your workflow.

How it works

The node is the template's most canonical example: it shows the exact anatomy every custom node needs - INPUT_TYPES declaring inputs, RETURN_TYPES/RETURN_NAMES declaring the output, FUNCTION pointing at a method. That method calls CalculatorModel.plus(a, b), a @staticmethod that returns a + b. No model is actually consulted; the model socket is there to demonstrate how your own custom type flows through the graph.

The inputs that matter:

  • model (required, type MY_MODEL) - wire in the pack's (Down)Load My Model node. It's a mock. The math ignores it entirely.
  • a (optional INT, default 5) - first addend.
  • b (optional INT, default 10) - second addend.
  • Output plus_value (INT) - a + b.

That's the whole surface. Both operands default to something sensible, so you can add the node, click it, and get 15 with zero wiring - as long as the fake model is connected.

Why it exists

The bundled example workflow chains the whole cast of template demos: (Down)Load My ModelCalculate Plus (with widgets set to 1 + 2) → Calculate MinusExample Output Node → a display node. It's a miniature course in node authoring: dropdowns, a custom type, required-versus-optional inputs, arithmetic on a "model," and an output node so the graph can be queued. If you're learning to write nodes, this is the cleanest reference - every pattern is one screen apart.

If you just need a + b in a real pipeline, this is not the node you want. It's demo code, and its pointless model dependency proves it. Use a core value node or any math utility instead.

Installing it

ComfyUI Manager won't find it - the template isn't in the Manager community index (only jhj0517's functional packs like Moondream-Gaze-Detection and Kokoro-Onnx are). Clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/jhj0517/ComfyUI-CustomNodes-Template

Then restart ComfyUI. No pip install - requirements.txt is empty and pyproject.toml has no dependencies. Nothing to download, no models to place.

Common issues

  • Missing model input. This node will not run until a MY_MODEL wire lands on it, and nothing in the real world produces that type except the template's own loader. Instant giveaway that you're using demo code for real work.
  • The example workflow throws "missing node type". example-1.json ends in Display Any (rgthree), so you need rgthree-comfy installed to load it as-is. Swap in any display node if you don't have it.
  • The README's clone command is a placeholder. It reads git clone https://github.com/replace-this-with-your-github-repository-url.git - that's the string you'd replace when publishing your own fork, not a real URL. Use the one above.
CategoryCustomNodesTemplate

Inputs (3)

NameTypeDefaultDescription
modelMY_MODEL
aoptINT5
boptINT10

Outputs (1)

NameTypeDescription
plus_valueINT