---
title: "Deploy LibreTranslate"
description: "Translates text and documents between about 50 languages"
category: "AI/ML"
url: https://railway.com/deploy/libretranslate-server
---

# Deploy LibreTranslate

Translates text and documents between about 50 languages

**[Deploy LibreTranslate on Railway](https://railway.com/template/libretranslate-server)**

- **Creator:** A3A
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### Redis https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/redis.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### libretranslate https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/libretranslate-dark.svg

- **Source:** https://github.com/gridalpha/libretranslate-railway
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# 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](https://res.cloudinary.com/rroe4rtk/image/upload/v1787332795/libretranslate-architecture.png)

## 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](https://res.cloudinary.com/rroe4rtk/image/upload/v1787332797/libretranslate-translate-japanese.png)

![LibreTranslate file tab offering a translated text file to download](https://res.cloudinary.com/rroe4rtk/image/upload/v1787332799/libretranslate-file-translation.png)

![LibreTranslate Swagger docs listing the translate endpoints](https://res.cloudinary.com/rroe4rtk/image/upload/v1787332805/libretranslate-api-docs.png)

## 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`](https://github.com/gridalpha/libretranslate-railway), a thin wrapper over the official [`libretranslate/libretranslate`](https://hub.docker.com/r/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

| Variable | Default | What it does |
|---|---|---|
| `LT_LOAD_ONLY` | `en,es,fr,de,it,pt,ru,zh,ar,ja,ko,hi` | Languages installed. More needs a larger volume |
| `LT_THREADS` | `4` | Gunicorn worker processes |
| `LT_BOOTSTRAP_API_KEY` | generated | Key created on first boot |
| `LT_REQUIRE_API_KEY_ORIGIN` | the public domain | Origins that may skip the key |
| `LT_REQ_LIMIT` | `60` | Requests per minute per client |
| `LT_CHAR_LIMIT` | `5000` | Maximum characters per request |

### Deployment Dependencies

- [LibreTranslate on GitHub](https://github.com/LibreTranslate/LibreTranslate) — AGPL-3.0
- [Official documentation](https://docs.libretranslate.com)
- [Argos Translate](https://github.com/argosopentech/argos-translate) — the model runtime

## Hardware Requirements for Self-Hosting LibreTranslate

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU | 4–8 vCPU |
| RAM | 2 GB | 4–8 GB |
| Storage | 5 GB volume | 10 GB+ for all 50 languages |
| Runtime | Python 3.11 | Python 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

| | LibreTranslate | DeepL API | Google Cloud Translation |
|---|---|---|---|
| Licence | AGPL-3.0 | Proprietary | Proprietary |
| Pricing | Infrastructure only | Per character | Per character |
| Data handling | Stays on your server | Sent to DeepL | Sent to Google |
| Languages | ~50 | ~30 | 100+ |
| Runs offline | Yes | No | No |

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`.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/libretranslate-server
