Deploy LibreTranslate — Private Translation API
Self-host translation — REST API, 30+ languages, no per-word fees
LibreTranslate
Just deployed
/home/libretranslate/.local
Deploy and Host LibreTranslate on Railway
LibreTranslate is a free, open-source machine translation API — a private, self-hosted alternative to Google Translate and DeepL that runs entirely on your own infrastructure. Translate text and documents across 30+ languages through a clean web UI or a REST API, with no per-word fees and no data sent to a third-party cloud. This template deploys it with sensible memory defaults and model persistence, so it boots reliably on a normal plan instead of crashing on startup.
What This Template Deploys
| Service | Purpose |
|---|---|
| LibreTranslate | The translation engine, web UI, and REST API on port 5000 |
A single service. Persistent volumes hold the language models (which are gigabytes) and the API-key database, so neither is re-downloaded nor lost on redeploy. Translation runs on CPU — no GPU or external API needed.
About Hosting
LibreTranslate is simple to run, but one memory detail decides whether it starts at all — and it's the mistake most deployments make.
Loading every language crashes on a normal plan — start lean with LT_LOAD_ONLY. Loading all 30+ languages needs 8 GB+ RAM and about 10 GB of storage, and each additional language adds roughly 200 MB of memory. If you deploy expecting all languages and don't limit them, the container runs out of memory and crashes on startup. This template sets LT_LOAD_ONLY to a sensible default (for example en,es,fr,de) so it boots cleanly, and you add languages deliberately by extending that list and raising the memory limit to match. Start with the languages you actually need, not all thirty.
Models must persist on a volume, or they re-download every redeploy. The language models live under /home/libretranslate/.local and are gigabytes in size. Without a persistent volume they're re-downloaded on every restart — slow and wasteful. This template mounts that volume so models are cached once.
API keys live in SQLite and need their own persistence. With LT_API_KEYS=true, keys are stored in a SQLite database on the volume. Persist it, or the keys you issue vanish on redeploy. Generate keys by running ltmanage keys add inside the container.
File translation works out of the box. The UI and API translate uploaded PDF, DOCX, PPTX, and HTML files. It's enabled by default; raise LT_CHAR_LIMIT for large documents.
Typical cost: ~$5–15/month on Railway depending on how many languages you load. LibreTranslate is AGPL-3.0 and free — no translation fees, unlike Google's or DeepL's per-character pricing.
How It Compares
| LibreTranslate (self-hosted) | Google Translate API | DeepL API | Azure Translator | |
|---|---|---|---|---|
| Cost model | Flat infra, unlimited | Per character | Per character | Per character |
| Data privacy | Fully private | Google cloud | DeepL cloud | Azure cloud |
| REST API | Yes | Yes | Yes | Yes |
| Offline capable | Yes | No | No | No |
| Languages | 30+ | 100+ | 30+ | 100+ |
| Self-hostable | Yes | No | No | No |
Google and Azure cover more languages, and DeepL edges out on quality for some pairs — but all three bill per character and send your text to their servers. LibreTranslate's value is unlimited, private, offline-capable translation for the 30+ common languages, at flat infrastructure cost, with your data never leaving your own deployment.
Deploy in Under 5 Minutes
- Click Deploy on Railway — LibreTranslate builds and downloads the default language models (~3 minutes)
- Confirm
LT_LOAD_ONLYis set to the languages you need (add codes to load more) - Confirm the model volume and, if using auth, the API-key database volume are mounted
- Open your Railway domain to use the web UI, or POST to the
/translateAPI endpoint - To require API keys, set
LT_API_KEYS=trueand runltmanage keys addin the container
Point any app at the REST API with a source and target language, and translations return as JSON.
Common Use Cases
- Private document translation — translate sensitive PDFs, contracts, or records without sending them to a third-party cloud
- App translation backend — a REST API powering multilingual features in a website, mobile app, or chatbot
- Cost-free translation at scale — unlimited translations at flat infrastructure cost instead of per-character API billing
- Offline / air-gapped translation — run translation in restricted environments with no external internet dependency
- Localization pipelines — batch-translate content for i18n workflows through the API
- Internal tooling — a translation service for corporate intranets and internal apps that keeps data in-house
Configuration
| Variable | Required | Description |
|---|---|---|
LT_LOAD_ONLY | Recommended | Languages to load, e.g. en,es,fr,de. Each adds ~200 MB RAM — don't load all 30+ on a small plan |
LT_API_KEYS | Optional | true to require API keys (issued with ltmanage keys add) |
LT_REQ_LIMIT | Optional | Requests per minute per client, e.g. 60 |
LT_CHAR_LIMIT | Optional | Max characters per request — raise for large file translation |
LT_DISABLE_FILES_TRANSLATION | Optional | false (default) keeps PDF/DOCX/PPTX/HTML translation enabled |
LT_DISABLE_WEB_UI | Optional | true to serve the API only, without the web interface |
PORT | Pre-set | 5000 |
Set
LT_LOAD_ONLYto avoid an out-of-memory crash. Loading all 30+ languages needs 8 GB+ RAM. Start with the languages you need and add more deliberately, raising Railway's memory limit as you go — the most common LibreTranslate deployment mistake.
Persist both volumes. The model volume (
/home/libretranslate/.local) prevents multi-gigabyte re-downloads on redeploy; the API-key SQLite volume keeps issued keys. Without them, models re-download and keys reset.
Dependencies for LibreTranslate Hosting
- Railway account — ~$5–15/month depending on languages loaded
- Persistent volumes for language models and the API-key database (included)
- Enough RAM for your chosen languages (~200 MB each, more for all 30+)
- No GPU or external API required — translation runs on CPU
Deployment Dependencies
- LibreTranslate GitHub Repository
- LibreTranslate Documentation
- Configuration & Environment Variables
- Railway Volumes Documentation
Implementation Details
The template runs libretranslate/libretranslate on port 5000, served by Gunicorn as recommended for production to avoid memory leaks. Language models — powered by the open-source Argos Translate library — are stored under /home/libretranslate/.local on a persistent volume so they're downloaded once rather than on every restart.
LT_LOAD_ONLY controls which language models load into memory, and it's the key operational lever: each language consumes roughly 200 MB of RAM, so loading a targeted set keeps the service within a modest memory footprint while loading all 30+ requires 8 GB or more. The template defaults to a small set so it boots reliably, leaving language expansion to the operator. With LT_API_KEYS=true, per-key rate limits are enforced and keys persist in a SQLite database on the volume, issued via the ltmanage CLI.
File translation for PDF, DOCX, PPTX, and HTML is enabled by default and bounded by LT_CHAR_LIMIT. Translation runs entirely on CPU with no external calls, which is what makes LibreTranslate fully private and offline-capable.
Frequently Asked Questions
Why did my deployment crash on startup? Almost always memory — loading all 30+ languages needs 8 GB+ RAM. Set LT_LOAD_ONLY to just the languages you need (each adds ~200 MB), and raise Railway's memory limit as you add more. This template ships a sensible default.
How do I add more languages? Extend LT_LOAD_ONLY with additional codes (e.g. en,es,fr,de,nl,pl) and increase the memory limit to match, since each language adds around 200 MB of RAM.
Do my models persist across redeploys? Yes, with the model volume mounted at /home/libretranslate/.local. Without it, the multi-gigabyte models re-download on every restart.
How do I require API keys? Set LT_API_KEYS=true, then run ltmanage keys add inside the container. Keys are stored in SQLite on the volume and persist across restarts.
Can it translate files? Yes — the UI and API handle PDF, DOCX, PPTX, and HTML uploads, enabled by default. Raise LT_CHAR_LIMIT for large files.
Is my data private? Completely. Translation runs on your Railway service with no external calls, so text and documents never leave your infrastructure — the core reason to self-host instead of using Google or DeepL.
How good is the translation quality? Good for common language pairs, powered by Argos Translate. It may trail Google or DeepL on some pairs, but it's private, unlimited, and free — the right trade-off when data control matters.
Why Deploy LibreTranslate on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying LibreTranslate on Railway you get a private translation API with the memory pitfall solved — a sensible LT_LOAD_ONLY default so it boots reliably, persistent model and key storage, and automatic HTTPS. Unlimited, private translation across 30+ languages via REST API, on infrastructure you own.
Template Content
LibreTranslate
libretranslate/libretranslate:latest