A fast, reliable, and modular translation API designed to meet the scale required by FxEmbed.
With our native multi-provider architecture, we support multiple kinds of providers:
- Free translations from popular services like Google Translate, DeepL, and Bing Translate
- Official APIs using your own API keys for services like Azure AI Translator, DeepL API, and AWS Translate. Each of which have free tiers or trials.
- Self-hosted alternative LibreTranslate
- Dynamic Selection: Chooses between providers based on target language, input string length, and availability
- Load Balancing and Rate Limit Leveling: Distributes requests across translation providers
- Automatic Failover: If one provider fails, automatically tries others (free first, then paid)
- Designed to Scale: Use higher rate limits for free services by scaling across servers and network providers
Edit the docker-compose.yml file to set bound port and your API keys if you want to use paid translation providers.
docker compose up -d# Pull and run the latest image
docker run -p 3220:3220 ghcr.io/fxembed/polyglot:latest
# Or run with environment variables
docker run -p 3220:3220 \
-e AZURE_TRANSLATOR_KEY="your_azure_key" \
-e AZURE_TRANSLATOR_REGION="eastus" \
-e DEEPL_API_KEY="your_deepl_key" \
ghcr.io/fxembed/polyglot:latestThis requires the Bun runtime installed.
# Clone the repository
git clone <your-repo-url>
cd polyglot
# Install dependencies
bun install
# Start the server
bun run index.tsThe API will be available at http://localhost:3220 (port configurable in .env or docker-compose.yml)
Relying on free services alone is not ideal since requests can be throttled or blocked (DeepL in particular is very aggressive at this). So we support a variety of paid translation providers, which luckily have free tiers:
- Azure AI Translator - 2M characters free per month, forever
- DeepL - 500K characters free per month, forever
- AWS Translate - 2M characters free per month, 12 months only
# Azure AI Translator
AZURE_TRANSLATOR_KEY="your_azure_key"
AZURE_TRANSLATOR_REGION="eastus"
# DeepL Official API
DEEPL_API_KEY="your_deepl_key"
# AWS Translate
AWS_ACCESS_KEY_ID="your_access_key_id"
AWS_SECRET_ACCESS_KEY="your_access_key"
AWS_REGION="your_region" # optional, defaults to us-east-1
# LibreTranslate (self-hosted or public instance)
LIBRETRANSLATE_URL="https://translate.example.com"
LIBRETRANSLATE_API_KEY="your_api_key_if_required" # optional for some instances
Note: Free providers (Google Translate, Bing, DeepLX) work without configuration.
Endpoint: POST /translate
If you configured an ACCESS_TOKEN, please provide it in the Authorization header as Bearer <token>.
Request Body:
{
"text": "Hello, world!",
"target_lang": "es",
"source_lang": "en" // Optional - auto-detected if not provided
}Response:
{
"translated_text": "¡Hola Mundo!",
"source_lang": "en",
"target_lang": "es",
"provider": "google"
}# Basic translation, auto detect language
curl -X POST http://localhost:3220/translate \
-H "Content-Type: application/json" \
-d '{"text": "Hello, world!", "target_lang": "es"}'
# With source language specified
curl -X POST http://localhost:3220/translate \
-H "Content-Type: application/json" \
-d '{"text": "Bonjour le monde", "source_lang": "fr", "target_lang": "en"}'This project is licensed under AGPL-3.0.
This project is not affiliated with any of the providers listed above. The names of the providers may be trademarks or registered trademarks of their respective owners. Scraping from free APIs may violate their respective EULA.