ComfyUI Node

AI-HIVE 查询任务

Rescue a Timed-Out AI-HIVE Job Without Paying Twice

By wubin1836·Created 2 months ago·Updated 2 months ago· 1
AI-HIVE 查询任务
    • result_urls_json
    • status
    • task_json
    ◄task_id►

    The most money-saving node in the AI-HIVE pack is also the most boring one, and that's exactly why you'll be glad it exists. AI-HIVE 查询任务 (class AIHiveGetTask) does one thing: you give it a task_id, it asks AI-HIVE's servers what's happening with that job, and it hands back the current status plus the result URLs. That's it. If you've ever watched a video generation poll for 600 seconds and then error out, you already understand the point.

    Here's the situation it saves you from. Every generate node in this pack submits a job to AI-HIVE's cloud, and that job keeps running server-side even after the node's own wait_for_result polling gives up (timeout range 30–1200s, default 600) or you deliberately turned waiting off to submit-and-forget. Either way, the job is going to finish and you're going to be billed for it. The natural beginner move after a timeout is to hit run again - which means paying for the same job twice. This node is the correct move instead.

    The pattern to use

    Run your generation with wait_for_result off, or let it time out. Note the task_id that came out of the generate node. Then feed that id into this node - wired in, or typed in - and re-run it every couple of minutes until status reads COMPLETED.

    Outputs:

    • result_urls_json - JSON array of result URLs (images or videos, whichever the task produced)
    • status - RUNNING, COMPLETED, FAILED, or PARTIAL (a batch where some items succeeded and some didn't)
    • task_json - the full server response, including errors if any items failed

    Mechanically it's a GET /openapi/v1/generation/tasks/{task_id} call, with the response summarized into those three fields. It's not an output node, so you can chain it - for example into a node that fetches a URL, once status flips to COMPLETED.

    Inputs

    Just task_id, a STRING. Leave it empty and the node raises an error on purpose. It needs the AI_HIVE_API_KEY like everything in the pack, so "no key" will bite you here too even though this node generates nothing.

    Installing

    ComfyUI Manager: search AI-HIVE, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wubin1836/comfyui-ai-hive.git
    pip install -r comfyui-ai-hive/requirements.txt
    

    Only requests and Pillow. Restart ComfyUI after.

    One honest caveat: this pack is brand new with zero community track record, and this node is the one that will quietly call the server on every run while doing nothing visible. That's fine - it's read-only and cheap. Just keep the pattern in mind: time out, keep the id, query here. Resubmitting is how people double-pay on metered APIs.

    CategoryAI-HIVE

    Inputs (1)

    NameTypeDefaultDescription
    task_idSTRING—

    Outputs (3)

    NameTypeDescription
    result_urls_jsonSTRING—
    statusSTRING—
    task_jsonSTRING—