Translation Nodes

Applies to: ChengOS v0.2.0+ | Last verified: 2026-09-25 | Source: crates/cheng-nodes/src/nodes/builtin/translation

One node covers translation, with the provider chosen by a field: an LLM provider that reuses your existing model credentials, or DeepL, Baidu, and Google as direct vendor APIs. The trade-off is predictable — the vendor APIs are cheaper and more consistent for plain prose, while the LLM provider is the only one that honours tone and glossary instructions. Source language may be left on auto detection; the resolved language comes back as an output so downstream branches can act on it.

Translation — ai/translation

Translate text using LLM / DeepL / Baidu / Google with formatting and glossary preservation

Inputs

FieldTypeRequiredDefaultDescription
textstring—""Source text to translate (string port). Control: textarea
text_artifactobject—nullArtifact holding the source text to translate (preferred for long documents)
text_artifact_uristring—nullartifact:// URI for the source text to translate
contextobject—nullOptional AgentContext input (carried through with the translation appended)
providerenum—llmTranslation provider. Control: select. Options: llm (LLM-driven translation (reuses the existing LLM credential model).), deepl (DeepL Translate (free or pro).), baidu (百度翻译 通用文本翻译.), google (Google Cloud Translation v3 with API-key authentication.)
credential_idstring—nullCredential ID for the chosen vendor (DeepL / Baidu / Google). Ignored for LLM. Control: credential-select
llm_modelstring—nullLLM model selector for provider = LLM (format: credential_id::model_name). Control: llm-model-select
source_langenum—autoSource language (Auto = detect). Control: select. Options: auto (Auto-detect), en (English), zh-Hans (Chinese (Simplified) — 简体中文), zh-Hant (Chinese (Traditional) — 繁體中文), ja (Japanese — 日本語), ko (Korean — 한국어), fr (French — Français), de (German — Deutsch), es (Spanish — Español), pt (Portuguese — Português), ru (Russian — Русский), it (Italian — Italiano), … (+7)
target_langenum—zh-HansTarget language. Control: select. Options: en (English), zh-Hans (Chinese (Simplified) — 简体中文), zh-Hant (Chinese (Traditional) — 繁體中文), ja (Japanese — 日本語), ko (Korean — 한국어), fr (French — Français), de (German — Deutsch), es (Spanish — Español), pt (Portuguese — Português), ru (Russian — Русский), it (Italian — Italiano), ar (Arabic — العربية), … (+6)
styleenum—defaultTone (LLM provider only; vendor APIs ignore). Control: select. Options: default, formal, casual, technical, literary
preserve_formattingboolean—truePreserve Markdown structure (links / images) — recommended
preserve_code_blocksboolean—truePreserve fenced and inline code blocks — recommended
glossarystring—nullOptional forced-translation glossary. Either {"src":"dst"} map or [{src,dst}] array. Control: code-editor
custom_promptstring—nullOverride the LLM system prompt (LLM provider only). Control: textarea
timeout_msinteger—30000Per-request timeout in milliseconds
max_retriesinteger—2Retry budget for transient provider errors (rate-limit / timeout / 5xx)

Outputs

FieldTypeDescription
translated_textstringTranslated text (bounded when large)
translated_text_artifactobjectArtifact holding the complete translated text
translated_previewstringBounded translated-text preview
source_char_countintegerSource text character count
translated_char_countintegerTranslated text character count
segments_countintegerNumber of translation segments
contextobject (port)AgentContext with the translation appended. Connection port, not a form field.
detected_sourceenumSource language actually used (resolved when source_lang = Auto). Options: auto, en, zh-Hans, zh-Hant, ja, ko, fr, de, es, pt, ru, it, … (+7)
target_langenumTarget language used. Options: auto, en, zh-Hans, zh-Hant, ja, ko, fr, de, es, pt, ru, it, … (+7)
providerstringProvider used for this translation
modelstringModel used for the LLM provider (omitted for vendor APIs)
statsobject (port)Translation statistics (chars, bytes, retries, glossary hits, duration). Connection port, not a form field.

Next steps