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
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | — | "" | Source text to translate (string port). Control: textarea |
text_artifact | object | — | null | Artifact holding the source text to translate (preferred for long documents) |
text_artifact_uri | string | — | null | artifact:// URI for the source text to translate |
context | object | — | null | Optional AgentContext input (carried through with the translation appended) |
provider | enum | — | llm | Translation 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_id | string | — | null | Credential ID for the chosen vendor (DeepL / Baidu / Google). Ignored for LLM. Control: credential-select |
llm_model | string | — | null | LLM model selector for provider = LLM (format: credential_id::model_name). Control: llm-model-select |
source_lang | enum | — | auto | Source 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_lang | enum | — | zh-Hans | Target 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) |
style | enum | — | default | Tone (LLM provider only; vendor APIs ignore). Control: select. Options: default, formal, casual, technical, literary |
preserve_formatting | boolean | — | true | Preserve Markdown structure (links / images) — recommended |
preserve_code_blocks | boolean | — | true | Preserve fenced and inline code blocks — recommended |
glossary | string | — | null | Optional forced-translation glossary. Either {"src":"dst"} map or [{src,dst}] array. Control: code-editor |
custom_prompt | string | — | null | Override the LLM system prompt (LLM provider only). Control: textarea |
timeout_ms | integer | — | 30000 | Per-request timeout in milliseconds |
max_retries | integer | — | 2 | Retry budget for transient provider errors (rate-limit / timeout / 5xx) |
Outputs
| Field | Type | Description |
|---|---|---|
translated_text | string | Translated text (bounded when large) |
translated_text_artifact | object | Artifact holding the complete translated text |
translated_preview | string | Bounded translated-text preview |
source_char_count | integer | Source text character count |
translated_char_count | integer | Translated text character count |
segments_count | integer | Number of translation segments |
context | object (port) | AgentContext with the translation appended. Connection port, not a form field. |
detected_source | enum | Source 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_lang | enum | Target language used. Options: auto, en, zh-Hans, zh-Hant, ja, ko, fr, de, es, pt, ru, it, … (+7) |
provider | string | Provider used for this translation |
model | string | Model used for the LLM provider (omitted for vendor APIs) |
stats | object (port) | Translation statistics (chars, bytes, retries, glossary hits, duration). Connection port, not a form field. |