Railway

Deploy LibreTranslate

Translates text and documents between about 50 languages

Deploy LibreTranslate

Just deployed

/data

Just deployed

/home/libretranslate

Deploy and Host LibreTranslate on Railway

LibreTranslate is a free and open source machine translation API that runs neural models on your own server instead of calling a commercial cloud service. It is built on Argos Translate and CTranslate2, so every request is processed locally on CPU: no text leaves your infrastructure, there is no per-character bill, and the only rate limit is the one you set. Teams self-host LibreTranslate to translate user-generated content, localise documentation, or keep translation inside a network where sending customer text to an external API is not acceptable. It ships with a browser UI, a documented REST API, a Swagger page, and document translation for .txt, .docx, .pptx, .odt, .epub, .html and .pdf.

This template deploys LibreTranslate with a Railway-managed Redis instance and a persistent volume. The service runs four Gunicorn workers behind a public HTTPS domain and keeps its translation models and API-key database on the volume, so a redeploy reuses the models instead of re-downloading gigabytes. Redis is private and holds what a multi-worker deployment must share: rate-limit counters, the flood-ban list and a seven-day translation cache. Twelve languages install on first boot and an API key is generated for you.

Diagram of the LibreTranslate and Redis services on Railway

Getting Started with LibreTranslate on Railway

Deploy the template and wait for the build. The first boot downloads roughly 2.6 GB of models onto the volume and takes about a minute and a half; later boots start in a second or two. Open the public URL and you land on the translation UI — there is no account to create, because LibreTranslate has no user system. Pick a source language or leave it on Auto Detect, type a sentence, and the translation appears as you type with the detected language and its confidence. Switch to the Translate Files tab to upload a document and download the translated copy. Visit /docs for Swagger.

Programmatic access is protected. Requests from the deployment's own web UI work without a key; anything else must send the key generated at deploy time in LT_BOOTSTRAP_API_KEY. Copy it from the Variables tab and pass it as api_key in the request body. To open the API to another front end, add that origin to LT_REQUIRE_API_KEY_ORIGIN.

LibreTranslate translating detected English text into Japanese

LibreTranslate file tab offering a translated text file to download

LibreTranslate Swagger docs listing the translate endpoints

About Hosting LibreTranslate

Commercial translation APIs charge per character and require sending text off your infrastructure. That is fine for marketing copy and awkward for support tickets, medical notes or anything under a data-residency clause. LibreTranslate solves both by running the models where you run everything else.

Key features:

  • REST API — /translate, /detect, /languages, /translate_file — documented in Swagger
  • Automatic language detection with a confidence score, plus alternative translations
  • Batch translation: pass an array of strings, get an array back
  • Document translation that preserves the original file format
  • Per-key and per-IP rate limits, character limits and flood banning

LibreTranslate serves the UI and API and owns the volume holding Argos translation models, MiniSBD sentence-boundary models and the SQLite key database. Redis is the shared state layer: with several worker processes, in-memory counters give each worker its own copy of every limit, so a 60-per-minute limit quietly becomes 240. Redis also backs the translation cache.

Why Deploy LibreTranslate on Railway

Railway removes the setup work self-hosted translation usually involves:

  • Redis, the volume, the domain and the health check are provisioned together
  • Models persist on the volume, so redeploys do not re-download gigabytes
  • HTTPS and a public hostname are issued automatically
  • Scaling up is a slider, not a migration
  • Deploy logs, metrics and rollbacks are built in

Common Use Cases

  • Translating reviews, comments and support tickets without shipping them to a third party
  • Localising documentation and product strings from a CI job that batches API calls
  • Adding an in-product language switcher for a fixed monthly cost
  • Preprocessing multilingual text before search indexing or classification

Dependencies for LibreTranslate

  • LibreTranslate — built from gridalpha/libretranslate-railway, a thin wrapper over the official libretranslate/libretranslate image that prepares the volume, sizes inference threads to the container's CPU quota and seeds the first API key. Port 5000.
  • Redis — Railway-managed redis:8.2, private. Rate-limit counters, flood bans, cached translations.
  • Volume — 5 GB at /home/libretranslate for models and the key database.

Environment Variables Reference

VariableDefaultWhat it does
LT_LOAD_ONLYen,es,fr,de,it,pt,ru,zh,ar,ja,ko,hiLanguages installed. More needs a larger volume
LT_THREADS4Gunicorn worker processes
LT_BOOTSTRAP_API_KEYgeneratedKey created on first boot
LT_REQUIRE_API_KEY_ORIGINthe public domainOrigins that may skip the key
LT_REQ_LIMIT60Requests per minute per client
LT_CHAR_LIMIT5000Maximum characters per request

Deployment Dependencies

Hardware Requirements for Self-Hosting LibreTranslate

ResourceMinimumRecommended
CPU2 vCPU4–8 vCPU
RAM2 GB4–8 GB
Storage5 GB volume10 GB+ for all 50 languages
RuntimePython 3.11Python 3.11

Translation is CPU-bound: more cores mean faster responses and more concurrency. Extra languages cost disk, not memory.

Self-Hosting LibreTranslate with Docker

The quickest local run pulls the official image with two languages:

docker run -ti --rm -p 5000:5000 \
  -e LT_LOAD_ONLY=en,es \
  -e LT_UPDATE_MODELS=true \
  libretranslate/libretranslate:latest

Once it is up, translate a string with the REST API:

curl -X POST http://localhost:5000/translate \
  -H "Content-Type: application/json" \
  -d '{"q":"Good morning","source":"en","target":"es","format":"text"}'

For a persistent setup, mount a volume at /home/libretranslate so models survive restarts, put LT_API_KEYS_DB_PATH inside it, and point LT_SHARED_STORAGE at a Redis URL whenever you run more than one worker.

How Much Does LibreTranslate Cost to Self-Host?

LibreTranslate is free and open source under AGPL-3.0 — no licence fee, no seat cost, no charge per translated character, which is the main difference from Google Cloud Translation, DeepL and Azure Translator. Self-hosting costs only infrastructure: on Railway, the container, Redis and the volume. Anyone translating millions of characters a month usually finds a fixed bill far cheaper than metered pricing.

LibreTranslate vs DeepL and Google Translate

LibreTranslateDeepL APIGoogle Cloud Translation
LicenceAGPL-3.0ProprietaryProprietary
PricingInfrastructure onlyPer characterPer character
Data handlingStays on your serverSent to DeepLSent to Google
Languages~50~30100+
Runs offlineYesNoNo

DeepL and Google produce better output on hard sentences and cover more languages. LibreTranslate wins when privacy, cost predictability or offline operation matter more.

FAQ

What is LibreTranslate? An open source machine translation API and web UI that runs Argos Translate models locally, so text never leaves your server.

What does this Railway template deploy? A LibreTranslate service with a public HTTPS domain and a persistent volume, plus a private Redis instance for rate limits, flood protection and the translation cache.

Why does the template include Redis? LibreTranslate runs several worker processes. Without shared storage each keeps its own counters, so a configured limit is multiplied by the worker count.

How do I add more languages to self-hosted LibreTranslate? Add the codes to LT_LOAD_ONLY and redeploy; missing models download on the next boot. The full catalogue is 100 models across 50 languages and needs about 9 GB, so grow the volume before installing everything.

How do I call the API from my own application? POST to /translate with q, source, target and the api_key from LT_BOOTSTRAP_API_KEY. q accepts an array for batch translation.

Is the translation quality good enough for production? For common pairs such as English to Spanish, French or German it is solid for user-generated content, search preprocessing and internal tooling. Review the output before using it for customer-facing marketing copy.

How do I monitor a self-hosted LibreTranslate deployment? /metrics exposes Prometheus counters for request duration and in-flight requests, labelled by endpoint, client IP and API key, behind the token in LT_METRICS_AUTH_TOKEN.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
3
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
63