Gå til hovedinnhold

Translation

neokapi exposes translation through a single translate tool. One --provider flag selects the backend, and the command, flags, and credential model are the same whichever backend you choose:

  • LLM providers: Anthropic, OpenAI, Google Gemini, Azure OpenAI, Ollama. Context-aware, full prompt control, and (with Ollama) fully on-device.
  • The offline demo provider: keyless, deterministic, clearly-marked illustrative output for trying flows without credentials. Its drafts use the approved rendering of each term the project defines, so they pass the terminology check.

The tool's --engine flag selects between the LLM engine (the default) and a machine-translation engine; no classic MT engine (DeepL, Google Translate, Microsoft Translator, and the like) ships in the core binary.

The generated Tool reference lists the current parameters and default model for each provider.

Configuring a provider is a task, not a concept

Selecting a model, supplying credentials, and setting a default are walked step by step in the recipe Choose a translation model, including on-device translation with Ollama. This page covers what translation is and how it composes.

A single tool

Because every backend is a value of --provider on the same translate command, switching between them is a configuration change only. Replace provider: anthropic with provider: ollama and the rest of a flow is unchanged. The API key is never read from the recipe; credentials are supplied out-of-band (see the recipe).

Translation composes with other LLM-backed tools in the same flow:

ToolPurpose
translateTranslate untranslated blocks with the selected provider
qaLLM-judged quality check (fluency, accuracy, terminology)
reviewDetailed translation review with explanations
term-extractExtract candidate terminology from source blocks

The qa tool runs deterministic rule-based checks without --provider, and switches to LLM-judged review when a provider is given. See Rule-based checks for the full check catalogue.

Composing in flows

The translate tool composes into flows like any other stage. A production flow typically chains memory leverage, a translate pass, and a review step:

steps:
- tool: recycle
- tool: translate
config:
provider: anthropic
- tool: review
- tool: qa

Switching providers (anthropic to ollama, or vice versa) is a configuration change; the surrounding steps are unchanged.

Prompts

Every prompt kapi sends is built in core/ai/prompt/, composed from framework rules (return only the translation; preserve placeholders and inline tags) plus the steering your project declares: an instruction, a voice profile, and a terms store. The prompt is the same for every provider; only the transport differs.

You do not have to take that on trust: --explain-prompts prints the exact text sent to the model, attributed section by section. See Prompts.

Content memory reaches the prompt in one bounded way. Fuzzy and exact matches are applied by recycle, a deterministic step that runs before translation and fills what it can; they are never offered to the model as examples. A block's own previously approved translation is different: when a block has been edited since it was last translated, translate sends that prior version as reference under reuse: prior (the default), gated by the governing context, so the model revises rather than starts over. reuse: none turns it off.