Nodes/comfyui-local-ollama-translator/Local Ollama Translator
ComfyUI Node

Local Ollama Translator

The prompt translator that calls no API and needs no key

By InfernusIntraMe·Created 2 months ago·Updated 5 days ago· 2
Local Ollama Translator
    • translated_text
    • source_text
    texta cinematic mountain landscape, storm clouds, dramatic lighting
    directionEnglish → Simplified Chinese
    styleImage Prompt
    preserve_termsComfyUI, LoRA, GGUF, Flux, Krea 2, Z-Image, Qwen, Wan, SDXL
    extra_instruction
    modelqwen2.5:7b
    endpointhttp://127.0.0.1:11434
    keep_alive0
    num_ctx32768
    temperature0.00
    top_p0.70
    timeout_seconds120
    allow_remote_endpointfalse
    force_rerunfalse
    debug_loggingfalse

    If you've ever pulled a workflow off Civitai or grabbed a Chinese creator's graph (Qwen, Wan, and a big chunk of the video-community workflows ship with prompts in Simplified Chinese), you know the moment where you paste the prompt into some free translator, get machine-garbled text, and give up. Local Ollama Translator is the fix: an English ↔ Simplified Chinese translation node that runs entirely against the Ollama server on your own machine.

    The name is a lie in the best way. It doesn't call Google Translate, DeepL, ChatGPT, or any external API, and it needs no key. By default it only talks to http://127.0.0.1:11434, and the code refuses to touch anything else unless you flip allow_remote_endpoint. Leave that off - your prompts never leave the box.

    Also worth saying up front: this is a translator, not a prompt enhancer. It won't add detail or restructure your prompt the way an LLM enhancer does. It takes text in, translates it, and hands you back the same prompt in another language. That's a genuinely useful niche once you're running a multilingual-model workflow - Qwen, Wan, and Z-Image are all prompt-hungry and prompt-translation-aware - and for people working across the English and Chinese communities, it removes a real wall.

    How it works

    The node is a small, careful client for Ollama's /api/chat endpoint. It builds a strict system prompt from your settings - direction, style, and the preserve_terms list - sends your text as a chat message with stream: false, and reads back the model's reply. It then strips the usual LLM junk: <think> tags, "Translation:" preambles, code fences, and stray quotes. The whole thing runs on Python's standard library - no requests, no transformers, no heavy deps. requirements.txt is literally "no external Python dependencies," which for an LLM node is almost suspiciously clean - and it's the exact property the ecosystem's security lessons tell you to check for before installing any node that talks to a model.

    The inputs that matter

    You can ignore most of the fifteen inputs. These are the ones you'll actually touch:

    • direction - Auto, English → Simplified Chinese, or Chinese → American English. Auto guesses the way to go, which is fine for one-off text.
    • style - Natural, Image Prompt, Literal, or UI Text. Image Prompt is the default and the one you want: it preserves the comma-separated prompt structure and keeps proper nouns, model names, and LoRA trigger words untranslated.
    • preserve_terms - the safety net for exactly those tokens. Defaults to ComfyUI, LoRA, GGUF, Flux, Krea 2, Z-Image, Qwen, Wan, SDXL; add your own model names and trigger words so they don't get translated into gibberish.
    • model - defaults to qwen2.5:7b, which is a sensible pick: small, multilingual, fits on a consumer card alongside the diffusion model. Whatever you set has to exist in Ollama.
    • num_ctx - the Ollama context window, not a seed. Default 32768 is generous; drop to 8192 for short prompt work. The README is explicit about this because people keep mistaking it for a seed.

    The outputs are translated_text and source_text, both STRING. Wire translated_text into a CLIP Text Encode's text input - and keep your own text encoder feeding the clip input, because this node only translates; it does not replace the encoder. There's also a GUI preview on the node itself (a DOM widget, not just a console log), so you can eyeball the translation before anything gets queued.

    Installing

    Ollama has to be installed and running first - this node is a client, not a server:

    ollama pull qwen2.5:7b
    

    Then install the pack itself, either via ComfyUI Manager (search "comfyui-local-ollama-translator") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/InfernusIntraMe/ComfyUI-Local-Ollama-Translator.git
    

    Restart ComfyUI and it appears under Local/Ollama/Local Ollama Translator. No pip step, no model download into ComfyUI - the only moving part is Ollama.

    Gotchas

    • "Could not reach Ollama at …" - that's the node's own error, and it means Ollama isn't running, or the model field names something you haven't pulled. Check ollama list.
    • "Remote Ollama endpoint blocked" - the privacy guard doing its job. If you genuinely have Ollama on another machine, flip allow_remote_endpoint; don't be surprised it defaults to off.
    • Sharing workflows - ComfyUI bakes widget values into the JSON, so your prompt and the translation preview get saved with the file. The README tells you to clear them before uploading a public workflow, and that's not paranoia.

    The honest caveat: a 7B chat model is not a frontier translation engine, so idiomatic phrasing will occasionally come back stiffer than DeepL would give you. What you trade for that is a translation that's private, offline, and free per call - and for prompt work, that's usually a good deal.

    CategoryLocal/Ollama

    Inputs (15)

    NameTypeDefaultDescription
    textSTRINGa cinematic mountain landscape, storm clouds, dramatic lighting
    directionCOMBOEnglish → Simplified Chinese3 options: Auto, English → Simplified Chinese, Chinese → American English
    styleCOMBOImage Prompt4 options: Natural, Image Prompt, Literal, UI Text
    preserve_termsSTRINGComfyUI, LoRA, GGUF, Flux, Krea 2, Z-Image, Qwen, Wan, SDXL
    extra_instructionSTRING
    modelSTRINGqwen2.5:7b
    endpointSTRINGhttp://127.0.0.1:11434
    keep_aliveSTRING0
    num_ctxINT327680–262144
    temperatureFLOAT0.000–2
    top_pFLOAT0.700–1
    timeout_secondsINT12010–600
    allow_remote_endpointBOOLEANfalse
    force_rerunBOOLEANfalse
    debug_loggingBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    translated_textSTRING
    source_textSTRING