Skip to main content
50% off all plans, limited time. Starting at $2.48/mo
LibreTranslate

LibreTranslate

LibreTranslate is a self-hosted machine translation API that runs on your own server, with no requests sent to Google or DeepL. Translate text, HTML and files through a REST API or the built-in web page, offline once the language models are downloaded. AGPL-3.0 licensed with 16,300+ GitHub stars.

At a glance

License AGPL-3.0 Version Latest OS Ubuntu Server 24.04 LTS Min RAM 4 GB IP IPV4,IPV6

Access

  • Open http://<SERVER_IP> in a browser.
  • The API documentation is available at /docs.
  • Use the generated API key for API requests. It is stored in /root/libretranslate/.credentials.

API Usage

Example translation request:

curl -X POST http://<SERVER_IP>/translate \
  -d q='Hello' \
  -d source=en \
  -d target=es \
  -d api_key='<API_KEY>'

Replace <API_KEY> with the generated API key.

Configuration

The main environment variables are stored in /root/libretranslate/.env.

  • LT_VERSION: LibreTranslate image version
  • REQ_LIMIT: Maximum requests per minute per client
  • CHAR_LIMIT: Maximum characters allowed per request

Modify the configuration as needed.

After changing the configuration, apply it with:

cd /root/libretranslate
docker compose up -d

Important Files & Directories

  • Install Path: /root/libretranslate
  • Compose File: /root/libretranslate/docker-compose.yml
  • Environment: /root/libretranslate/.env
  • Credentials: /root/libretranslate/.credentials
  • Models: /var/lib/docker/volumes/libretranslate_models
  • Key DB: /var/lib/docker/volumes/libretranslate_db
  • Caddy Config: /etc/caddy/Caddyfile

Domain & HTTPS (Caddy)

0. HTTPS certificates cannot be issued for IP addresses.

1. Point a domain (for example, example.com) to your server's IP address.

2. Update /etc/caddy/Caddyfile:

example.com {
    reverse_proxy localhost:5000
}

3. Reload Caddy:

systemctl reload caddy

4. Access LibreTranslate at example.com.

Notes

  • Modify the configuration based on your preferences in /root/libretranslate/.env.
  • Under Attack mode is enabled by default to help protect the public API from abusive or automated requests.
  • Request limiting is enabled with a default limit of 60 requests per minute per client.
  • Requests are limited to 5000 characters by default.
  • The LibreTranslate container listens only on 127.0.0.1:5000; Caddy provides public access.

More in Self Hosted

Related apps.

Deploy LibreTranslate now. From $2.48/mo.