Nodes/ComfyUI_MieNodes/Set Claude (OpenAI-compat) LLM Service Connector ๐Ÿ‘
ComfyUI Node

Set Claude (OpenAI-compat) LLM Service Connector ๐Ÿ‘

Your Anthropic key on Anthropic's own compat layer

By MieMieeeeeยทCreated 2 years agoยทUpdated 3 days agoยท 273
Set Claude (OpenAI-compat) LLM Service Connector ๐Ÿ‘
    • llm_service_connector
    โ—„api_tokenโ–บ
    โ—„model_selectclaude-sonnet-5-5โ–บ
    โ—„custom_modelโ–บ
    โ—„config_filemie_llm_keys.jsonโ–บ
    โ—„config_keyanthropicโ–บ
    โ—„prefer_local_configtrueโ–บ

    What it is

    One of the pack's provider connectors - same shape as its twenty-odd siblings, same single llm_service_connector output, except this one talks to Claude. Not through some third-party proxy: it hits api.anthropic.com/v1/chat/completions, which is Anthropic's own OpenAI SDK compatibility layer. So you get a Claude model answering an OpenAI-shaped request, which is exactly what you want when the thing that's holding your workflow together speaks OpenAI.

    Why Claude specifically? In an image pipeline the LLM's job is short structured rewriting - a rough idea into a prompt, or an image into a caption - and that job rewards a model that follows a format and stops. Claude is a reasonable pick for careful prose in the rewrite. It is a worse pick if you need NSFW or want to run offline; an API filters, a local abliterated 8B doesn't, and the local path is free per call.

    How it works

    The connector builds a Claude service object at node-load and stays silent until a downstream call node fires. The payload is intentionally slim - model, messages, stream, and max_tokens - because on the compat layer a pile of OpenAI fields (response_format, penalties, seed, logprobs) are silently ignored and n has to be 1. Sending them would buy you nothing but a false sense that they're doing something. If you want prompt caching, structured outputs or extended thinking, that requires Anthropic's native API, not the compat layer, and this node isn't it.

    Underneath, the shared base class handles the boring parts: a 30-second per-request timeout, three retries at five-second intervals for timeouts/connection errors/5xx, and stripping of <think>-style reasoning blocks out of replies so scratch-work doesn't get spliced into your prompt.

    Inputs and output

    api_token (sk-ant-...), model_select, custom_model, config_file, config_key (default anthropic), prefer_local_config. Output: llm_service_connector.

    The dropdown carries claude-sonnet-5-5 (default), claude-opus-5-5, claude-fable-5-1, claude-haiku-4-5, claude-opus-5, claude-sonnet-5, and Custom. Note the spelling: Anthropic's dashed ids, not dotted. Sonnet is the sensible default for rewriting work; Haiku is the cheap one and fine for batch jobs like captioning a dataset where you're going to eyeball the output anyway. For anything not in the list, Custom plus the exact id.

    Wire the output into any call node in the pack - CallLLMService, Translator, PromptGenerator, BerniniPromptGenerator, QwenImage21PromptGenerator - or into CheckLLMServiceConnectivity for a one-request smoke test that prints the HTTP status and 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
    

    Nothing here downloads a model; the whole pack's dependency list is small pip packages, so there's no torch surgery and no restart loop. Manager users: search ComfyUI_MieNodes (publisher mie).

    Then put the key in the file, not the node:

    cd ComfyUI/custom_nodes/ComfyUI-MieNodes
    cp mie_llm_keys.json.example mie_llm_keys.json
    

    and fill the "anthropic" entry. This trips people up: prefer_local_config defaults to True, so the JSON entry beats the api_token field. Paste a new key into the node, leave a stale one in the file, and you'll get a 401 that makes no sense until you look at the file.

    Common issues

    401 with a key you know works. Check the slot, not the key. The file has one entry per provider and the connector reads the entry named by config_key; a Claude key sitting in the openai slot (or vice versa) is the classic version of this.

    A parameter that "isn't working." On the compat layer, some of them genuinely aren't wired - they're accepted and dropped rather than rejected, so nothing errors and nothing changes. That's the compat layer, not the node.

    Blunt, over-long rewrites. Claude will happily write you an essay when the sampler wants 60 tokens of scene. The fix isn't the connector - it's the system prompt or the token budget on the call node you wired it into.

    Category๐Ÿ‘ MieNodes/๐Ÿ‘ LLM Service Config

    Inputs (6)

    NameTypeDefaultDescription
    api_tokenSTRINGโ€”
    model_selectCOMBOclaude-sonnet-5-57 options: claude-sonnet-5-5, claude-opus-5-5, claude-fable-5-1, claude-haiku-4-5, claude-opus-5, claude-sonnet-5, +1
    custom_modeloptSTRINGโ€”
    config_fileoptSTRINGmie_llm_keys.jsonโ€”
    config_keyoptSTRINGanthropicโ€”
    prefer_local_configoptBOOLEANtrueโ€”

    Outputs (1)

    NameTypeDescription
    llm_service_connectorLLMServiceConnectorโ€”