RunningHub ComfyUI Workflow Runner
This skill provides tools to execute ComfyUI workflows on the RunningHub cloud platform via API.
Prerequisites
- 1. RunningHub Account - Register at https://www.runninghub.ai/?inviteCode=kol01-rh124
- API Access - Basic membership or above (free users cannot use API)
- API Key - Get your 32-character API KEY from the API Console
- Workflow ID - The workflow must have been successfully run manually at least once
Getting API Key
- 1. Login to RunningHub
- Click your avatar in the top-right corner
- Go to "API Console"
- Copy your API KEY (keep it secure!)
Getting Workflow ID
- 1. Open the target workflow page
- Get the ID from the URL: INLINECODE0
- Example: ID is INLINECODE1
Setup API Key
Option 1: Save to Config File (Recommended)
CODEBLOCK0
The API key will be saved to config.json and automatically loaded for future runs.
Option 2: Environment Variable
CODEBLOCK1
Option 3: Command Line (Each Time)
CODEBLOCK2
Usage
Submit Workflow Task (Default Configuration)
For workflows using default configuration:
CODEBLOCK3
Run Workflow with Custom Image (NEW!)
Upload an image and run the workflow with it:
CODEBLOCK4
Parameters:
- -
--image: Path to the local image file - INLINECODE4 : The node ID for image input (default: 107)
- INLINECODE5 : The field name for image input (default: image)
Query Task Status
CODEBLOCK5
Wait for Completion
CODEBLOCK6
Python API Usage
CODEBLOCK7
API Reference
RunningHubClient Class
__init__(api_key: str)
Initialize the client with your API KEY.
upload_image(image_path: str) -> Optional[str]
Upload an image file to RunningHub and get the URL.
Returns:
- - Image URL on success
- INLINECODE8 on failure
submit_workflow(workflow_id: str, node_info_list: Optional[list]) -> Dict
Submit a workflow task for execution.
Parameters:
- -
workflow_id: The workflow ID from RunningHub - INLINECODE11 : Node configuration list (optional)
Important: Use fieldValue (not value) in nodeinfolist:
CODEBLOCK8
Returns:
CODEBLOCK9
submit_workflow_with_image(workflow_id: str, node_id: str, field_name: str, image_url: str) -> Dict
Submit a workflow with an image input (convenience method).
Example:
CODEBLOCK10
query_task(task_id: str) -> Dict
Query the status of a submitted task.
Returns:
CODEBLOCK11
wait_for_completion(task_id: str, poll_interval: int, max_attempts: int) -> Dict
Wait for a task to complete by polling status.
Image Upload
Endpoint: INLINECODE17
Headers:
Body:
- - Multipart form-data with file field
Response:
CODEBLOCK12
Submit Workflow with Custom Input
Endpoint: INLINECODE19
Headers:
- - INLINECODE20
- INLINECODE21
Request Body:
CODEBLOCK13
Important: Use fieldValue not value for node input values!
Important Notes
- 1. Use
fieldValue not value: When passing node input values via API, always use fieldValue:
CODEBLOCK14
- 2. Rate Limiting: Basic members have concurrency limits (usually 1 task at a time)
- 3. Error 421: "API queue limit reached" - Wait for previous tasks to complete
- 4. Authentication: Uses
Authorization: Bearer <api_key> header
- 5. API Endpoints:
- Submit:
POST /openapi/v2/run/workflow/{workflow_id}
- Query:
POST /openapi/v2/query
- Upload: INLINECODE30
Troubleshooting
"Invalid node info" (Error 803)
- - Check that you're using
fieldValue not INLINECODE32 - Verify the nodeId and fieldName match the workflow configuration
- Use the workflow's
getJsonApiFormat endpoint to check available nodes
"API queue limit reached" (Error 421)
- - Wait 2-3 minutes and retry
- Check RunningHub web console for running tasks
- Cancel tasks from web console if needed
"TOKEN_INVALID" (Error 412)
- - Verify your API KEY is correct (32 characters)
- Check if your membership is active
- Try regenerating the API KEY from console
Task stuck in "RUNNING"
- - Large workflows may take several minutes
- Check RunningHub web console for actual progress
- Contact support if task runs too long
RunningHub ComfyUI 工作流运行器
该技能提供通过API在RunningHub云平台上执行ComfyUI工作流的工具。
前置条件
- 1. RunningHub账户 - 在 https://www.runninghub.ai/?inviteCode=kol01-rh124 注册
- API访问权限 - 基础会员及以上(免费用户无法使用API)
- API密钥 - 从API控制台获取32位API密钥
- 工作流ID - 工作流必须至少手动成功运行过一次
获取API密钥
- 1. 登录RunningHub
- 点击右上角头像
- 进入API控制台
- 复制您的API密钥(请妥善保管!)
获取工作流ID
- 1. 打开目标工作流页面
- 从URL中获取ID:https://www.runninghub.ai/#/workflow/WORKFLOW_ID
- 示例:ID为 1987728214757978114
设置API密钥
选项1:保存到配置文件(推荐)
bash
cd /root/.openclaw/workspace/skills/runninghub-comfyui
python3 scripts/runninghubclient.py --save-key YOURAPI_KEY
API密钥将保存到 config.json,并在后续运行时自动加载。
选项2:环境变量
bash
export RUNNINGHUBAPIKEY=YOURAPIKEY
选项3:命令行(每次运行)
bash
python3 scripts/runninghubclient.py --api-key YOURAPI_KEY ...
使用方法
提交工作流任务(默认配置)
对于使用默认配置的工作流:
bash
cd /root/.openclaw/workspace/skills/runninghub-comfyui
python3 scripts/runninghub_client.py \
--workflow-id 1987728214757978114 \
--action submit
使用自定义图片运行工作流(新功能!)
上传图片并使用该图片运行工作流:
bash
python3 scripts/runninghub_client.py \
--workflow-id 1987728214757978114 \
--action run-with-image \
--image /path/to/your/image.png \
--node-id 107 \
--field-name image
参数说明:
- - --image:本地图片文件路径
- --node-id:图片输入的节点ID(默认:107)
- --field-name:图片输入的字段名(默认:image)
查询任务状态
bash
python3 scripts/runninghub_client.py \
--task-id TASK_ID \
--action query
等待任务完成
bash
python3 scripts/runninghub_client.py \
--task-id TASK_ID \
--action wait \
--poll-interval 5 \
--max-attempts 60
Python API 使用方法
python
from runninghubclient import RunningHubClient, loadconfig, getapikey
从配置获取API密钥
api
key = getapi_key()
初始化客户端
client = RunningHubClient(api_key)
上传图片并获取URL
image
url = client.uploadimage(/path/to/image.png)
print(f图片URL: {image_url})
使用自定义图片提交工作流
result = client.submit
workflowwith_image(
workflow_id=1987728214757978114,
node_id=107,
field_name=image,
image
url=imageurl
)
task_id = result[taskId]
等待任务完成
final
result = client.waitfor
completion(taskid)
获取输出URL
if final_result.get(status) == SUCCESS:
for item in final_result.get(results, []):
print(f输出: {item.get(url)})
API 参考
RunningHubClient 类
init(api_key: str)
使用您的API密钥初始化客户端。
uploadimage(imagepath: str) -> Optional[str]
将图片文件上传到RunningHub并获取URL。
返回值:
submitworkflow(workflowid: str, nodeinfolist: Optional[list]) -> Dict
提交工作流任务进行执行。
参数说明:
- - workflowid:RunningHub中的工作流ID
- nodeinfo_list:节点配置列表(可选)
重要提示: 在nodeinfolist中使用 fieldValue(而非 value):
python
nodeinfolist = [
{
nodeId: 107,
fieldName: image,
fieldValue: https://... # ✅ 使用 fieldValue,而非 value
}
]
返回值:
json
{
taskId: TASK_ID,
status: RUNNING,
clientId: CLIENT_ID
}
submitworkflowwithimage(workflowid: str, nodeid: str, fieldname: str, image_url: str) -> Dict
提交带有图片输入的工作流(便捷方法)。
示例:
python
result = client.submitworkflowwith_image(
1987728214757978114, # workflow_id
107, # node_id
image, # field_name
https://... # image_url
)
querytask(taskid: str) -> Dict
查询已提交任务的状态。
返回值:
json
{
status: RUNNING|SUCCESS|FAILED,
results: [
{url: https://..., filename: ...}
]
}
waitforcompletion(taskid: str, pollinterval: int, max_attempts: int) -> Dict
通过轮询状态等待任务完成。
图片上传
接口地址: POST /openapi/v2/media/upload/binary
请求头:
请求体:
响应:
json
{
code: 0,
msg: success,
data: {
type: image,
download_url: https://...,
fileName: openapi/...,
size: 3490
}
}
使用自定义输入提交工作流
接口地址: POST /openapi/v2/run/workflow/{workflow_id}
请求头:
- - Authorization: Bearer
- Content-Type: application/json
请求体:
json
{
apiKey: your-api-key,
workflowId: 1987728214757978114,
addMetadata: true,
nodeInfoList: [
{
nodeId: 107,
fieldName: image,
fieldValue: https://... // ✅ 使用 fieldValue,而非 value
}
],
instanceType: default,
usePersonalQueue: false
}
重要提示: 节点输入值请使用 fieldValue 而非 value!
重要说明
- 1. 使用 fieldValue 而非 value:通过API传递节点输入值时,始终使用 fieldValue:
json
{nodeId: 107, fieldName: image, fieldValue: ...} // ✅ 正确
{nodeId: 107, fieldName: image, value: ...} // ❌ 错误
- 2. 速率限制:基础会员有并发限制(通常一次只能执行1个任务)
- 3. 错误421:API队列限制已满 - 请等待之前的任务完成
- 4. 身份验证:使用 Authorization: Bearer 请求头
- 5. API接口地址:
- 提交:POST /openapi/v2/run/workflow/{workflow_id}
- 查询:POST /openapi/v2/query
- 上传:POST /openapi/v2/media/upload/binary
故障排除
无效的节点信息(错误803)
- - 检查是否使用了 fieldValue 而非 value
- 确认nodeId和fieldName与工作流配置匹配
- 使用工作流的 getJsonApiFormat 接口检查可用节点
API队列限制已满(错误421)
- - 等待2-3分钟后重试
- 在RunningHub网页控制台检查正在运行的任务
- 如有需要,在网页控制台取消任务
TOKEN_INVALID(错误412)
- - 确认您的API密钥正确(32位字符)
- 检查您的会员状态是否有效
- 尝试在控制台重新生成API密钥
任务卡在RUNNING状态
- - 大型工作流可能需要几分钟时间
- 在RunningHub网页控制台查看实际进度
-