Nodes/ERPK Collection/Claude API Client
ComfyUI Node

Claude API Client

Where the model and key live

By eRepublik-Labs·Created 11 months ago·Updated 21 days ago· 1
Claude API Client
    • client
    modelclaude-sonnet-5
    api_key
    enable_streamingfalse
    enable_cachingtrue

    Claude API Client is the config node for the whole ERPK/Claude family. It initializes the Anthropic connection - model, API key, streaming, and prompt caching - and hands a client object to the nodes downstream of it: text generation, prompt enhancement, vision analysis, conversation. If you've seen any ComfyUI LLM pack, you know the pattern: one setup node at the top, everything else plugs into it.

    The nice surprise is that it's optional. The ERPK Claude nodes are built to run standalone - if you've set your Anthropic key in ComfyUI Settings (right-click canvas → ERPK Settings), every Claude node resolves it on its own and the client node is purely for when you want explicit control. So think of it less as a required boilerplate node and more as the place to make decisions once: which model, caching on or off, streaming on or off.

    What it sets

    • model - defaults to claude-sonnet-5, described as the best performance/cost balance; Opus-tier and Haiku-tier models are also in the dropdown. This becomes the default model for downstream nodes unless they override it.
    • api_key - optional. Empty means "use Settings or config.ini." The README is blunt that pasting keys into node widgets is not recommended for shared workflows - keys in Settings stay per-user and never land in the saved workflow.
    • enable_streaming - streaming responses, off by default. The tooltip warns ComfyUI may not display streaming in real time, so don't expect a chat-style trickle.
    • enable_caching - prompt caching, on by default. Anthropic's cache can cut repeated-prompt costs by up to 90%, and it's the single best cost lever in this whole pack. Leave it on unless you have a reason not to.

    The single output is the client object - wire it into any CLAUDE_API_CLIENT input on the other Claude nodes.

    How it works

    The node constructs an Anthropic client with the resolved key and your settings, and it's also where usage tracking lives: the client counts input/output/cache tokens and dollar cost, which is what the Claude Usage Stats node reads. So connecting the client isn't just plumbing - it's what makes cost visibility work.

    Installing it

    Part of the ERPK Collection (eRepublik-Labs/comfyui-nodes-erpk). ComfyUI Manager: search erpkERPK Custom Nodes → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
    cd erpk
    pip install -r requirements.txt
    

    Claude integration needs anthropic>=0.96.0 (in the root requirements) and an Anthropic API key under Settings → ERPK → API Keys. No models to download - everything is server-side.

    Common issues

    • "No API key found" - the key isn't in Settings, config.ini, or the widget. Add it once under ERPK Settings.
    • Streaming seems broken - it isn't. ComfyUI just doesn't render the stream live; the final text still arrives. Turn it off unless you have a reason.
    • Cost creeping up - check that caching is on. Repeated identical prompts without caching are the classic way to blow through a budget here.
    • Client node not connected? - fine. Every Claude node runs standalone from Settings. Only add the client when you need per-workflow overrides.
    CategoryERPK/Claude

    Inputs (4)

    NameTypeDefaultDescription
    modelCOMBOclaude-sonnet-5Claude model to use. Sonnet 5 offers the best balance of performance and cost; Opus 5 is the highest-capability tier.
    api_keyoptSTRINGAnthropic API key. If empty, will use ComfyUI Settings or config.ini.
    enable_streamingoptBOOLEANfalseEnable streaming responses. Note: ComfyUI may not display streaming in real-time.
    enable_cachingoptBOOLEANtrueEnable prompt caching for cost optimization (up to 90% savings on repeated prompts).

    Outputs (1)

    NameTypeDescription
    clientCLAUDE_API_CLIENT