API Tool
Wrap any REST API as a function your LLM agent can call
- tool
comfyui_LLM_party ships a handful of purpose-built tools - arXiv search, DALL-E, Amap weather - but the one that actually matters most is this one, because it's the DIY version. API Tool lets you wrap any REST API as something your agent can call on its own, using the same mechanism (function calling / tool calling) that powers OpenAI's and Anthropic's native tool support. If a service has an HTTP endpoint, you can hand it to your LLM as a capability, no code required.
How it works
Function-calling LLMs don't call APIs directly - they read a natural-language description of what a tool does, decide whether the current conversation needs it, and then generate a JSON payload matching a parameters schema you define. This node is exactly those two fields turned into a ComfyUI node, plus the plumbing (url, api_key) to actually fire the request once the LLM has decided to call it. Get the description and parameter schema right, and the LLM handles the rest of the reasoning about when and how to use your API - you never write that logic yourself.
The inputs and outputs that matter
description- the sales pitch for your tool, in plain language, aimed at the LLM. The node's default value is a working example: "a tool for checking weather" - that's the level of clarity you're going for. Vague descriptions get ignored or misused; specific ones get called correctly.parameters- a JSON schema of the arguments the LLM must fill in when it calls this tool. The default is a filled-in worked example (a weather tool takingcityandextensions), which is worth reading before you write your own - it shows the exact shape expected.urlandapi_key- the actual endpoint and credential used once the LLM's call comes back.is_enable- toggle the tool off without removing the node.- One output:
tool- plug this into your agent's tool-list input, same as every other tool node in the pack.
How to install it
- ComfyUI Manager - search "comfyui_LLM_party", install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then restart.
Then pip install -r requirements.txt from inside the comfyui_LLM_party folder, in your ComfyUI Python environment (python_embeded\python.exe -m pip install -r requirements.txt for portable Windows installs). No node-specific dependency beyond the pack's baseline.
Common issues & troubleshooting
The LLM never calls your tool. This is almost always the description being too generic or too similar to another tool already in the agent's list. Function-calling models decide whether to call a tool purely from that text - be concrete about what it does and when it's useful.
The LLM calls it with the wrong or missing arguments. Check parameters against the default example's shape closely - the JSON schema needs to actually describe what each field means (the example's city and extensions fields both carry a description of valid values), not just list field names. A schema with no guidance produces guesses.
Live credentials sitting on the node. Since api_key and url are stored in the node and saved with your workflow JSON, don't share a workflow file without checking you haven't left a real key on it. Custom-node ecosystems have a well-documented history of exactly this kind of leak, and it's an easy one to avoid by just checking before you export.
The pack itself won't install. Separately from this node, users have hit a real, current issue where comfyui_LLM_party installs via Manager but individual nodes fail to import - usually a CUDA/PyTorch mismatch with no clear compatibility list. Rule that out first if api_tool isn't showing up at all.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| is_enable | BOOLEAN | true | — |
| url | STRING | 被请求的网址 | — |
| api_key | STRING | — | |
| description | STRING | 用来查天气的工具 | — |
| parameters | STRING | { "city": "用户询问的目标区域,例如:长沙市", "extensions": "可选值:base/all base:返回实况天气 all:返回预报天气,默认为all" } | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| tool | STRING | — |