Try it online! | API Docs | Community Forum | Bluesky
Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary software such as Google or Azure to perform translations. Instead, its translation engine is powered by the open source Argos Translate library.
This fork adds optional Ollama integration, allowing you to use LLM-based translation models such as Translategemma as an alternative translation backend.
- A running Ollama instance
- The Translategemma model pulled into Ollama:
ollama pull translategemma
Enable the feature via CLI arguments or environment variables:
| CLI Argument | Environment Variable | Default | Description |
|---|---|---|---|
--ollama |
LT_OLLAMA_ENABLED=true |
false |
Enable the Ollama translation backend |
--ollama-host |
LT_OLLAMA_HOST |
http://localhost:11434 |
Ollama API URL |
--ollama-model |
LT_OLLAMA_MODEL |
translategemma |
Model to use for translation |
--ollama-system-prompt |
LT_OLLAMA_SYSTEM_PROMPT |
(see below) | System prompt to constrain model output |
The default system prompt is:
You are a translation engine. Output only the translated text without any explanation, notes, or additional content.
You can override it to fine-tune the model behaviour, e.g.:
libretranslate --ollama --ollama-system-prompt "Translate the following text. Return only the translation, nothing else."Example:
libretranslate --ollama --ollama-host http://localhost:11434 --ollama-model translategemmaOr with environment variables:
LT_OLLAMA_ENABLED=true LT_OLLAMA_HOST=http://localhost:11434 libretranslateWhen Ollama is enabled, a toggle switch labeled "LLM Translation (Ollama)" appears in the web UI between the language selectors and the text fields. Users can switch between the standard Argos Translate engine and the Ollama-backed LLM translation at any time. The preference is stored in the browser and persists across page reloads.
The feature can also be used via the API by adding use_ollama=true to the /translate request:
curl -X POST http://localhost:5000/translate \
-d "q=Hello world&source=en&target=de&use_ollama=true"This work is largely possible thanks to Argos Translate, which powers the translation engine.
