Nodes/SDXL Auto Prompter/APNext H3 LLM Backend (Ollama / local / API)
ComfyUI Node

APNext H3 LLM Backend (Ollama / local / API)

Run every H3 writer on Ollama instead of the Claude Code CLI

By dagthomas·Created 3 years ago·Updated about 6 hours ago· 287
APNext H3 LLM Backend (Ollama / local / API)
    • llm
    • model_used
    modelcustom (use model_name below)
    model_nameollama:qwen3:8b
    base_url
    temperature1.00
    max_tokens8000
    inline_skill_referencesfalse

    Here's the deal with the Claude Code H3 writers: they default to your locally installed Claude Code CLI, using its login and your subscription seat. That's great until you don't have a Claude subscription, or you'd rather the whole thing be free, offline, and uncensored. APNext H3 LLM Backend is the one-node answer: pick a model here, drag its pink llm output into any number of H3 writers' llm sockets, and those nodes stop calling the CLI and write with whatever you chose - Ollama, LM Studio, any OpenAI-compatible server, or a cloud API model.

    This is the local-vs-API decision the LLM-in-the-graph world keeps landing on: for the job of "turn a short idea into a structured, spec-compliant prompt," an 8B model on your own card is enough, and it buys you three things an API can't - it's uncensored, it's free per call, and it never phones home. The node's model dropdown lists every ollama: / lmstudio: / local: model your servers were serving when the ComfyUI page loaded, then the cloud API models, then custom.

    The inputs that matter

    • model - discovered local models, cloud entries, or custom (the default). The dropdown is built at page load, so start your server before reloading ComfyUI.
    • model_name - used with custom, and it's the escape hatch for anything undiscovered: ollama:qwen3:8b, lmstudio:qwen/qwen3-8b, local:my-model, even claude:claude-sonnet-5. A bare qwen3:8b is understood as an Ollama tag.
    • base_url - point a node at a LAN box or odd port, like http://192.168.1.10:11434. Empty uses the prefix default: Ollama on 11434, LM Studio on 1234, local: on 8000.
    • temperature and max_tokens - sampling and answer length. Multi-scene crossover runs need headroom; leave max_tokens at 8000 unless you're hitting truncation.
    • inline_skill_references - the sleeper. With the writer's director on, this pastes the H3 director skills' whole reference library (gold examples, grammar, style anchors) into the system prompt instead of just the rules. Noticeably better prompts - and it needs a big context window, so raise Ollama's num_ctx when you flip it on.

    Outputs: llm (the socket you connect) and model_used (what actually answered, handy for the info-style housekeeping).

    What changes off the CLI

    Three things quietly swap when you go local: research is ignored (a local model has no web tools), the director skills are pasted into the system prompt rather than Read from disk, and session_id / resume_session_id still work but through a text-only local session kept under ComfyUI's temp folder. A Claude Code session id can't be resumed with a local model and vice versa - the error says exactly that. Everything else - wardrobe locks, template variables, outputs - is identical, so you can A/B a Claude run and an Ollama run of the same workflow without changing anything else.

    Installing and troubleshooting

    Same pack as the rest of H3: ComfyUI Manager, search comfyui_dagthomas; or clone https://github.com/dagthomas/comfyui_dagthomas into custom_nodes and pip install -r requirements.txt (openai, anthropic, google-genai, httpx, huggingface_hub, chardet). Then restart.

    The classic traps: a model not in the dropdown almost always means the server wasn't running when the page loaded - start Ollama, refresh, it appears. The probe can be disabled entirely with APNEXT_LOCAL_LLM_DISCOVERY=0 if it's ever slow or noisy. If you connect images, the model must be vision-capable - ollama:qwen3-vl:8b or similar, or the vision input is silently wasted. And if you've been burned by this pack before: an early 2024 release changed the working directory on load and broke ComfyUI's restart button; that was fixed long ago (PR #8), so don't let an old horror story stop you. Unplug the llm socket and the writer drops straight back onto Claude Code - the backend is fully optional.

    Categorycomfyui_dagthomas/H3

    Inputs (6)

    NameTypeDefaultDescription
    modelCOMBOcustom (use model_name below)ollama: / lmstudio: / local: entries are whatever your local servers were serving when the page loaded (start the server, reload the page). Cloud entries need their API key in the environment. Pick 'custom' to type any provider:model string in model_name.
    model_nameSTRINGollama:qwen3:8bUsed when model = custom. Any router string: 'ollama:qwen3:8b', 'lmstudio:qwen/qwen3-8b', 'local:my-model', 'claude:claude-sonnet-5', 'gpt:gpt-5.6', 'gemini:gemini-3.7-flash'.
    base_urlSTRINGWhere to reach a local server, e.g. 'http://192.168.1.10:11434'. Empty uses the default for the prefix: ollama 11434, lmstudio 1234, local 8000 (or OLLAMA_BASE_URL / LMSTUDIO_BASE_URL / LOCAL_LLM_BASE_URL). Ignored by cloud providers.
    temperatureFLOAT1.000–2
    max_tokensINT8000256–128000Answer length cap. Multi-scene crossover / scenes runs need room.
    inline_skill_referencesBOOLEANfalseWith the H3 node's director on: paste the skills' full reference library (gold examples, grammar, style anchors) into the system prompt, not just the skill rules. Noticeably better prompts, but tens of thousands of tokens - the model needs a big context window. Ollama: raise num_ctx (OLLAMA_CONTEXT_LENGTH or a Modelfile), the official guide alone is ~12k tokens.

    Outputs (2)

    NameTypeDescription
    llmAPNEXT_LLM
    model_usedSTRING