Set Qianfan ERNIE LLM Service Connector ๐
ERNIE, plus hosted GLM and DeepSeek behind one Baidu key
- llm_service_connector
What it is
Baidu's Qianfan (ๅๅธ) platform, connected. If you have a Baidu Cloud account, this is the node that gets an LLM into your graph from it - and the interesting part of the dropdown is that Qianfan doesn't only serve Baidu's own ERNIE family, it also hosts third-party models like GLM and DeepSeek. One key, several vendors' models, dropdown-switched.
For the job an LLM actually does in a ComfyUI graph - turning a rough draft into a prompt, captioning an image, translating a caption - ERNIE is plenty. The honest framing: a local abliterated 8B is enough for most of this and costs nothing per call, and an API filters. You're here because you already have the key.
How it works
The connector posts to https://qianfan.baidubce.com/v2/chat/completions - Qianfan's ModelBuilder v2 OpenAI-compatible endpoint - with your key as a Bearer token, sending the standard parameter set: temperature, top_p, top_k, penalties, n, max_tokens, and a text response_format. Nothing provider-bespoke here, which is nice: unlike the OpenAI, Kimi and Claude connectors in this pack, Qianfan takes the ordinary fields.
The shared base class handles retries (three attempts, five seconds apart, covering timeouts, connection errors and 5xx), a 30-second per-request timeout, and stripping <think> reasoning blocks out of replies. That last one matters here - ernie-5.0-thinking-preview is exactly the kind of model that emits a deliberation block before its answer, and for a prompt-rewriting job that deliberation is noise you'd otherwise be feeding into your sampler.
Inputs and output
api_token - the Baidu Qianfan API key. Leave it blank and use the key file.
model_select - defaults to ernie-5.1. Also ernie-5.0, ernie-5.0-thinking-preview, ernie-4.5-turbo-128k, ernie-4.5-turbo-32k, ernie-4.5-turbo-vl, glm-5.3, deepseek-v4.1-flash, and Custom. Two picks worth naming: ernie-4.5-turbo-vl is the vision-capable entry, which is what you want if you're feeding an image into CallLLMService for a caption; deepseek-v4.1-flash is there for when you want a different house style without opening another account.
custom_model - with model_select on Custom, for any newer id from the console.
config_file, config_key (default qianfan), prefer_local_config. Output: llm_service_connector, into any call node - or into CheckLLMServiceConnectivity, which fires one request and prints the HTTP status plus the head of the reply.
Installing and keying it
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
cd ComfyUI-MieNodes && python -m pip install -r requirements.txt
Restart. Manager: search ComfyUI_MieNodes. Light pip dependencies, no model downloads - nothing here touches your GPU.
cp mie_llm_keys.json.example mie_llm_keys.json
# "qianfan": "<your key>"
And the pack-wide gotcha, worth repeating because it causes most of the 401s people report: prefer_local_config defaults to True, so the JSON entry wins over the node's api_token field. Fill the file once and leave the node box empty; that's the intended workflow.
Common issues
401 with a key that works in Baidu's own playground. Qianfan has accumulated more than one credential style over the years, and this connector speaks the v2 ModelBuilder endpoint. If your key predates that, issuing a fresh key from the v2 console is usually faster than debugging it. Also make sure the key landed in the qianfan slot and not a sibling's - several vendors in this pack share the plain sk- shape.
Empty replies from a "thinking" model. The thinking variant spends tokens deliberating. The connector strips the <think> block from the final text, but if the call node's token budget is small the model can run out mid-deliberation and return nothing useful. Raise the budget downstream, or use the non-thinking model for prompt work.
Truncated captions. Token budget on the consumer node, not the connector. Qianfan's -128k variants give you the context; the output cap is set where you call it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| api_token | STRING | โ | |
| model_select | COMBO | ernie-5.1 | 9 options: ernie-5.1, ernie-5.0, ernie-5.0-thinking-preview, ernie-4.5-turbo-128k, ernie-4.5-turbo-32k, ernie-4.5-turbo-vl, +3 |
| custom_modelopt | STRING | โ | |
| config_fileopt | STRING | mie_llm_keys.json | โ |
| config_keyopt | STRING | qianfan | โ |
| prefer_local_configopt | BOOLEAN | true | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| llm_service_connector | LLMServiceConnector | โ |