Set xAI Grok LLM Service Connector ๐
The boring one, and that's a compliment
- llm_service_connector
What it is
Another provider connector in the MieNodes family: api_token and a model dropdown in, one llm_service_connector socket out, wire it into any call node in the pack. This one targets https://api.x.ai/v1/chat/completions.
If you're here because you have an xAI key and want it in a ComfyUI graph, that's the whole story. Grok is a frontier chat model; in an image pipeline its realistic job is the small structured rewrite - rough draft to prompt, image to caption, one language to another - and it does that fine. It won't do the one thing the local path does better: it filters, and it costs per call.
How it works
Of all the connectors in this pack, this is the least special-cased, which is why it's a good one to reach for when something else is misbehaving and you want to know whether the problem is your workflow or the provider. xAI's endpoint accepts the standard OpenAI parameter set, so the connector sends the standard payload - model, messages, stream: false, plus max_tokens, temperature, top_p, top_k, frequency_penalty, n and the text response_format. Compare that to its siblings: the OpenAI connector swaps in max_completion_tokens and drops sampling entirely, Kimi forwards only max_tokens because the current lineup locks temperature server-side, and the Claude compat layer quietly discards half the fields. Grok just takes them.
The shared base does the rest: 30-second per-request timeout, three retries five seconds apart on timeouts, connection errors and 5xx, and <think>-block stripping so a reasoning model's scratch-work doesn't land in your prompt.
The inputs that matter
api_token - an xai-... key. Leave it empty and let the config file supply it.
model_select - defaults to grok-4.7. Also grok-4.6, grok-4.5, grok-4.3, grok-4.20, grok-4.20-multi-agent, and Custom. The numbered frontier models are the straightforward picks; grok-4.20-multi-agent is a different product shape, so reach for it deliberately rather than by default. Anything not listed goes in custom_model with model_select set to Custom.
config_file, config_key (default grok), prefer_local_config - the shared key-file plumbing. Output: llm_service_connector.
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 ComfyUI. Manager: search ComfyUI_MieNodes. No models, no heavy dependencies - the pack's pip list is small utilities (requests, pillow, pyyaml, imagehash, toml, deepdiff, opencv-python, soundfile, huggingface_hub).
Then the key, preferably in the file:
cp mie_llm_keys.json.example mie_llm_keys.json
# fill the "grok" entry with your xai-... key
prefer_local_config is True by default, which means the file's entry wins over the node's api_token box. That's a feature - one key, every workflow - but it's also the number-one source of "my key isn't working" confusion in this pack.
Common issues
401. Either the key is in the wrong slot in mie_llm_keys.json (config_key decides which entry is read - default grok), or you pasted it into the node while a stale value was still in the file. Check both before you doubt the key itself.
Nothing reaches the model. Verify the connector before blaming the downstream node: wire CheckLLMServiceConnectivity to the output. One request, prints the status code and the head of the reply. It's the fastest way to separate "bad key" from "bad prompt" from "the node you wired it into never asked for anything."
Results wander between runs. That's the sampler temperature on the call node you wired into, not the connector - this node only chooses provider and model. If you need a stable prompt rewrite, drop the temperature on the consumer, not here.
Empty output. xAI is reached over the network from inside ComfyUI; if your ComfyUI runs in a container or behind a proxy, a blocked outbound call looks like silence rather than a tidy error. Test the same key with a plain curl from the machine ComfyUI runs on.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| api_token | STRING | โ | |
| model_select | COMBO | grok-4.7 | 7 options: grok-4.7, grok-4.6, grok-4.5, grok-4.3, grok-4.20, grok-4.20-multi-agent, +1 |
| custom_modelopt | STRING | โ | |
| config_fileopt | STRING | mie_llm_keys.json | โ |
| config_keyopt | STRING | grok | โ |
| prefer_local_configopt | BOOLEAN | true | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| llm_service_connector | LLMServiceConnector | โ |