Nodes/KIE.ai Nodes Next/Get Remaining Credits
ComfyUI Node

Get Remaining Credits

What Get Remaining Credits Really Returns

By felipederosilva·Created about a month ago·Updated a day ago· 3
Get Remaining Credits
    • raw_json
    • first_url
    • task_id
    ◄expert_override_json{}►

    What this thing is for

    Every node in ComfyUI-KIE-Nodes-Next spends money when it runs. Not metaphorically - each generation node calls KIE.ai, KIE.ai meters it, and the charge lands in real credits. Get Remaining Credits is the sanity check that sits in front of that spending: it asks KIE how much you have left.

    If you've ever wired up an API node pack and then discovered two hours later that your key had a balance of four cents and every job had been failing silently downstream, this is the node that stops that. It's also the one you reach for when you're not sure your key works at all - a bad key fails here instantly, before you've burned anything on a 4K video submit.

    And it's cheap in the way that matters: this is a read-only account call with no generation behind it, so there's nothing to pay for.

    How it works

    Under the hood the node hits KIE's account-balance endpoint (GET /api/v1/chat/credit in the bundled catalog) through the same authenticated client every other node in the pack uses. Nothing is generated, no task is created, no poll loop starts. It's one HTTP GET with your key in the header, and the JSON comes back into the graph.

    The client caches the latest known balance locally too, which is why the pack's Connection Settings panel can show a balance long after you last ran anything, and why generation nodes can print a "credits spent / credits left" receipt on the node body after each job. That receipt is stitched together from this same call, plus whatever creditsConsumed the provider reported for the task.

    The one honest wrinkle: this node's output sockets are the pack's generic utility triple - raw_json, first_url, task_id - because it's built from a docs page with no media result. There is no tidy credits float socket here. The number you want is inside raw_json, so if you need it downstream, plan on a small text/JSON node to pull it out rather than a direct wire.

    Inputs and outputs that matter

    There are no required inputs. Zero. Drop the node on the canvas with nothing connected and queue it.

    expert_override_json (optional, defaults to {}) is the escape hatch the pack adds for API pages whose documentation has no request schema. On a GET node like this one, anything you put in that object is sent as query parameters. For a plain balance check you should leave it alone.

    On the output side you get raw_json (the full provider response - this is where the balance lives), plus first_url and task_id, which will be empty for this endpoint and exist only because the pack keeps one output signature for all utility-shaped nodes. Wire raw_json into a text preview or a JSON-parsing node; don't expect a pretty number socket.

    Installing it

    Standard pack install. From your ComfyUI root:

    cd ComfyUI/custom_nodes
    git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
    pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
    

    Then restart ComfyUI. The dependencies are genuinely light - requests, Pillow, numpy, PyYAML - and there are no model weights to download, because nothing in this pack runs a model locally. The README's own preferred route on Windows is the one-click installer in the repo's dist/ folder, which finds your ComfyUI install (Desktop, Portable or manual) and installs into it; the ZIP there works the same way if you extract it into custom_nodes yourself.

    Then give it a key: ComfyUI → Settings → KIE.ai Nodes Next → Connection → Paste / replace KIE.ai API key. The pack validates the key against KIE before it overwrites anything, then shows a masked fingerprint and a CONNECTED status. Headless or server setups can skip the UI entirely with a KIE_API_KEY environment variable, which takes priority over the saved key.

    Where people get burned

    The most common confusion is expecting a numeric output. People wire this node expecting a float they can feed into a logic switch that halts the workflow at zero credits. That's not what the sockets give you - you get JSON. A tiny parser node in between solves it.

    Second: a balance of -1 or "unavailable" is not a billing error. The pack reports the balance as unknown rather than failing the graph when KIE's balance service is temporarily unreachable - the generation result is still returned. Don't debug your key over that.

    Third, the real-world one. KIE.ai is a reseller marketplace: pricing and model availability move under you. Community threads about API-wrapper packs are full of "the model just isn't available on KIE anymore" moments, and the practical defense is checking your balance and your model's availability before you queue a batch of a hundred renders, not after. This node is the cheap front-door check for exactly that.

    CategoryKIE Next/Utility

    Inputs (1)

    NameTypeDefaultDescription
    expert_override_jsonoptSTRING{}Expert-only payload overrides for APIs whose documentation has no request schema yet.

    Outputs (3)

    NameTypeDescription
    raw_jsonSTRING—
    first_urlSTRING—
    task_idSTRING—