🌍 Setup LibreTranslate — Self-Hosted Machine Translation API
Deploy a free, open-source translation API on your own server — no API keys, no rate limits, full privacy for your translation needs.
📦 Resources & Setup Scripts
Grab the automated bash script from GitHub to follow along with the video.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/tools/libretranslate/libretranslate-ubuntu.sh
chmod +x libretranslate-ubuntu.sh
sudo bash libretranslate-ubuntu.sh
Tutorial Steps
1 Download & Run the Installer
The script installs Docker if not already present, pulls the LibreTranslate image, and starts the container with all required language models. The initial startup may take a few minutes while language packs are downloaded.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/tools/libretranslate/libretranslate-ubuntu.sh
chmod +x libretranslate-ubuntu.sh
sudo bash libretranslate-ubuntu.sh
2 Access the Web UI
Open your browser and navigate to the LibreTranslate web interface to test translations interactively:
http://<your-server-ip>:5000
3 Test the Translation API
Use the built-in interactive API explorer at the web UI, or send direct HTTP requests to test the translation endpoint. The API accepts JSON with the source text, source language, and target language.
curl -X POST http://<your-server-ip>:5000/translate \
-H "Content-Type: application/json" \
-d '{"q":"Hello","source":"en","target":"ar"}'
4 Integrate with Your Application
Call the REST API from any programming language by sending POST requests with the source and target language codes. Replace <your-server-ip> with your server's IP address in your application configuration. The API is compatible with many LibreTranslate client libraries available for Python, JavaScript, PHP, and more.
curl -X POST http://<your-server-ip>:5000/translate \
-H "Content-Type: application/json" \
-d '{"q":"Hello","source":"en","target":"ar"}'
Ports Used
| Port | Purpose |
|---|---|
| 5000 | LibreTranslate API & Web UI |
Overview
LibreTranslate is a free and open-source machine translation API powered by the Argos Translate engine. It supports translation between dozens of languages and provides a REST API compatible with applications, scripts, and browser extensions — all without sending data to Google or DeepL.
Why Use It
Self-hosting LibreTranslate eliminates per-character API fees from commercial providers and keeps translated content private. It is ideal for internal document translation workflows, adding translation to existing apps, or complying with data residency requirements.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
LibreTranslate runs on port 5000. If used internally, keep this port firewalled from the public internet and access via VPN. For public-facing APIs, place it behind a reverse proxy with API key enforcement and rate limiting.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Alternatives include Google Translate API (cloud, per-character cost), DeepL API (higher quality, paid), Lingvanex (self-hostable, commercial), and Argos Translate (Python library only). Choose LibreTranslate for a REST API with a web UI and Docker deployment.
When Not to Use It
Avoid LibreTranslate if translation quality is critical — commercial engines like DeepL produce significantly better results especially for professional or published content. Also avoid on low-RAM servers as each language pair model requires substantial memory.
PrismaTechWork Professional Help
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Frequently Asked Questions
How good is LibreTranslate translation quality?
LibreTranslate uses the Argos Translate engine which provides decent quality for common language pairs like English-Spanish or English-French. Quality is lower than DeepL or Google Translate, especially for complex sentences or less common languages. It is best suited for internal, draft, or automated translation rather than published content.
How do I add more languages?
Languages are added by downloading Argos Translate model packages. In the LibreTranslate admin panel, go to Languages and install the language pairs you need. Each pair such as English-to-Arabic is a separate model file that must be downloaded, requiring internet access for initial setup.
Can I use LibreTranslate API in my app?
Yes. LibreTranslate provides a REST API. Send a POST request to /translate with a JSON body containing the source text, source language code, and target language code. The API returns the translated text. Full documentation is available at the /docs path on your instance.
Does LibreTranslate work offline?
Yes — once language models are downloaded during setup, LibreTranslate operates fully offline. No internet connection is required for translation. This makes it suitable for air-gapped environments after initial model installation.
How do I restrict who can use my LibreTranslate instance?
Enable API key authentication by setting the LT_API_KEYS=true environment variable. Then create API keys via the admin panel. All requests must include a valid api_key parameter. You can set per-key rate limits to prevent abuse.