nodes.py:
- move json/urllib/logging imports to module top
- replace inline imports inside _get_balance with module-level log
- extract endpoint/key constants instead of inline literals
- add from __future__ import annotations for cleaner typing
- document the error-path padding to 4-tuple matching RETURN_TYPES
Root __init__.py:
- expose WEB_DIRECTORY pointing at custom_nodes/credit_tracker/js so the
live-update extension loads when the repo is installed as custom_fns/
pyproject.toml:
- fix invalid build-backend (was setuptools.backends.legacy:build)
- bump to 0.2.0, add author/homepage fields
README + CONFLUENCE:
- document balance check, block_if_insufficient, and optional wired inputs
- update sample output to include Balance / After run / Status lines
- drop stale "no API calls" line and inaccurate "41 models total" claim
- mention JS pricing mirror must be updated alongside Python PRICING
Made-with: Cursor
Switch to comfy-core ImageScale node which combines center-cropping and
resizing in a single built-in step (bilinear, 854x480, center). AspectCrop
class removed from the package since it is no longer needed in the
reference workflow.
Trade-off: changing aspect_ratio on the PrimitiveNode no longer auto-adjusts
the crop dims. The two ImageScale width/height widgets must be updated
manually (e.g. 1080x1920 for 9:16, 480x480 for 1:1 at 480p).
Made-with: Cursor
AspectCrop takes IMAGE + aspect_ratio (+ optional target resolution) and
center-crops the image in pure PyTorch. Seedance workflow inserts two
AspectCrop nodes (first frame and last frame) between LoadImage and
ByteDance, all driven by the same PrimitiveNode, so switching 16:9 →
9:16 → 1:1 reshapes both input frames and the ByteDance output in one go.
Made-with: Cursor
Allows a PrimitiveNode (or any COMBO source) to drive aspect_ratio and
resolution for CreditDisplay directly, taking priority over the widget
dropdown. The Python calculate() uses the wired value when present.
Made-with: Cursor
ComfyUI combo/dropdown widgets often set widget.value directly without
calling widget.callback, so the previous approach missed changes.
Object.defineProperty on the value property catches every write regardless
of how LiteGraph or ComfyUI triggers it, firing refresh via queueMicrotask.
Made-with: Cursor
- Try 4 endpoint patterns: /api/credits, /internal/credits, /api/user/credits,
/comfyui-credits
- Handle raw float response, flat key lookup, and nested data/user/account wrappers
- Log every attempt (DEBUG) and failures (WARNING) with [credit_tracker] prefix
so the ComfyUI server console shows exactly what is happening
- Improve the "balance unavailable" message to point users to the server log
Made-with: Cursor
- patchSourceNode() is called lazily inside refresh() so it runs whether
the wire exists at creation time or is added later
- WeakSet prevents double-wrapping source widget callbacks
- setTimeout(refresh, 500) handles workflow-load case where links are
fully resolved only after graph configuration completes
- onConnectionsChange now triggers refresh via queueMicrotask (not a
separate patch loop) so new wires are picked up in one step
Made-with: Cursor
When ByteDance (or any node) is wired to the trigger input, the JS extension
reads its resolution, aspect_ratio and duration_s widgets by name (with positional
fallback at indices 2/3/4) and mirrors them into CreditDisplay automatically.
Widget callbacks on the upstream node are patched on connection so any change
to ByteDance settings immediately recalculates the cost display.
Made-with: Cursor
- _get_balance() calls /api/credits or /internal/credits via urllib (no deps)
- _format_output() gains Balance / After run / Status lines when balance available
- CreditDisplay gains check_balance (BOOLEAN) and block_if_insufficient (BOOLEAN)
- block_if_insufficient=True raises RuntimeError before the model runs if funds are low
- New output slot: balance_after (FLOAT)
- JS updated to show balance placeholder and read check_balance widget
Made-with: Cursor