🟢 Beginner–Intermediate ⚙️ Type: Machine Translation API 💸 Free & Open Source (AGPL-3.0) ⭐ 14,600+ GitHub Stars
What is LibreTranslate?
LibreTranslate is a free, 100% open-source machine translation API that you can self-host. Unlike mainstream commercial APIs (like Google Translate, DeepL, or Azure Translator) that charge by the character and send your text to corporate servers, LibreTranslate runs entirely offline on your own hardware.
Under the hood, its primary translation engine is powered by the open-source Argos Translate library, and recent updates have introduced experimental support for LLM-powered local translation (via LTEngine). It comes with a simple, clean web interface for manual translation, but its true power lies in its robust API. You can easily integrate it into your apps to auto-detect languages, translate plain text, translate raw HTML markup (without breaking the tags), and even translate document files like .docx or .txt.
Who is it for?
- Privacy-Conscious Enterprises dealing with sensitive legal, medical, or internal documents that legally cannot be transmitted to external third-party cloud servers.
- App and Web Developers looking to add multi-language support to their projects without paying recurring API fees for millions of translated characters.
- Homelabbers and Self-Hosters who want to run their own private alternative to Google Translate on their local network.
- AI Agent Developers building multi-lingual autonomous agents that need a reliable, local API to instantly translate foreign data streams.
What makes it special?
- 100% Offline Capable — Once the language models are downloaded to your machine, it requires zero internet connection to function.
- Preserves Formatting — If you feed it an HTML file or a Word Document, it will extract the text, translate it, and rebuild the file without destroying your layout, links, or bold text.
- Massive API Ecosystem — Because it is open-source, the community has built native bindings for almost every language imaginable, including Python, Rust, Node.js, C++, Java, and Go.
- No Rate Limits or Hit-Walls — If you host it yourself, the only limitation is your server’s hardware. You will never suddenly be cut off because you hit a “monthly character limit.”
Requirements before you start
LibreTranslate is designed to be accessible, but running machine translation models locally does require some RAM:
- Docker (Recommended) — The cleanest and easiest way to deploy the API without cluttering your system with dependencies.
- Python 3.8+ — Required only if you prefer to install it natively via
pip. - RAM / Hardware — You do not strictly need a GPU, but you will need decent RAM. Loading every single language model at once will consume significant memory. If you are running on a constrained device (like a Raspberry Pi), you will want to selectively load only the languages you need.
Step-by-step installation
There are two primary ways to run LibreTranslate locally.
Method 1 — Quick Install via Docker (Recommended)
Open your terminal and run the official Docker container. The --rm flag means the container will clean up after itself when stopped, and we map port 5000 to the host:
docker run -ti --rm -p 5000:5000 libretranslate/libretranslate
(Note: The first time you run this, it will take several minutes to download the language models.)
Method 2 — Native Install via Python (pip)
If you prefer not to use Docker, ensure Python is installed and run:
pip install libretranslate
libretranslate
Step 3 — Access the Web Interface
Once the server says it is listening, open your web browser and navigate to:
http://localhost:5000
You will see a clean, familiar interface where you can type text on the left and see the translation on the right.
Step 4 — Test the API
To see how easy it is to integrate into your code, open a new terminal window and send a standard POST request to your local server:
curl -X POST http://localhost:5000/translate \
-H "Content-Type: application/json" \
-d '{"q": "Hello world!", "source": "en", "target": "es", "format": "text"}'
It will instantly return the JSON response: {"translatedText":"¡Hola mundo!"}
Common errors and fixes
| Error | What it means | How to fix it |
|---|---|---|
| Memory usage keeps rising or maxes out the server | By default, LibreTranslate may try to load multiple language models into memory for faster switching. | Launch the app with the --load-only flag to restrict memory usage. For example: libretranslate --load-only en,es,fr will only load English, Spanish, and French models into RAM. |
API request returns 403 Forbidden | You are either hitting the public libretranslate.com endpoint without an API key, or your local instance has required API keys enabled. | If using the public hosted endpoint, you must purchase a key. If you are self-hosting on localhost, ensure you did not start the server with the --req-api-key flag. Also, ensure your API request includes a User-Agent header, as some endpoints reject requests without it. |
| The server takes a very long time to start up | During initial startup, LibreTranslate checks for and downloads necessary language models from the internet. | This is normal on the first run. For subsequent runs, if you want to skip checking for model updates and boot instantly, pass the --update-models false argument when starting the server. |
Free vs Paid comparison
| Feature | LibreTranslate (Self-Hosted) | Commercial APIs (Google / DeepL) |
|---|---|---|
| Cost | $0 (Free forever) | ~$20 to $25 per 1,000,000 characters |
| Data Privacy | ✅ 100% Local and Air-gappable | ❌ Sent to external servers |
| Translation Quality | 🟡 Good (Argos Translate models) | 🟢 Excellent (Massive proprietary LLMs) |
| Maintenance | ⚠️ You must run the server | 🟢 Fully managed cloud endpoints |
Bottom line: LibreTranslate is the ultimate tool for developers who want to break free from recurring API translation costs and privacy concerns. While DeepL and Google still edge it out slightly on nuanced, conversational translation quality, LibreTranslate’s offline capabilities and native document parsing make it an indispensable tool for homelabbers and enterprise security teams alike. (Note: If you don’t want to self-host, you can buy an API key directly from libretranslate.com to support the developers).
Alternatives — 3 similar tools
1. Lingva Translate
If you don’t want to run heavy language models locally, Lingva is an open-source alternative front-end for Google Translate. It acts as a privacy proxy: it strips out the tracking scripts and passes your request to Google’s translation servers. You get Google’s translation quality without Google tracking you, but it still requires an internet connection.
🔗 github.com/TheDavidDelta/lingva-translate
2. Mozilla Bergamot (Firefox Translations)
Mozilla developed an incredible open-source translation engine that runs entirely locally inside your web browser using WebAssembly. It is built directly into Firefox now for full-page translations. It is fantastic for end-users browsing the web, but it doesn’t provide a standalone API server for developers like LibreTranslate does.
🔗 github.com/mozilla/bergamot-translator
3. DeepL Pro (Commercial)
The industry gold standard for machine translation. DeepL’s neural networks capture nuance, slang, and context better than almost any other engine. If translation accuracy is mission-critical and you have the budget, their paid API is the best in the business—but it is closed-source and strictly cloud-based.
🚀 Want more free AI tools like this?
We find, test, and write setup guides for the best free and open-source AI tools — so you don’t have to dig through GitHub yourself.Browse Free AI Tools at globalaiforce.com/shop →
📸 Follow us for daily AI tool tips and tutorials: instagram.com/globalaiforce