{"id":29662961,"url":"https://github.com/fxembed/polyglot","last_synced_at":"2026-05-19T03:09:33.875Z","repository":{"id":305583685,"uuid":"1022574500","full_name":"FxEmbed/polyglot","owner":"FxEmbed","description":"Scalable Translation Service","archived":false,"fork":false,"pushed_at":"2025-07-20T23:25:57.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-21T00:14:32.846Z","etag":null,"topics":["api","bun","translate","translation","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FxEmbed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-19T11:17:18.000Z","updated_at":"2025-07-20T23:26:01.000Z","dependencies_parsed_at":"2025-07-21T00:24:51.322Z","dependency_job_id":null,"html_url":"https://github.com/FxEmbed/polyglot","commit_stats":null,"previous_names":["fxembed/polyglot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/FxEmbed/polyglot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FxEmbed%2Fpolyglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FxEmbed%2Fpolyglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FxEmbed%2Fpolyglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FxEmbed%2Fpolyglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FxEmbed","download_url":"https://codeload.github.com/FxEmbed/polyglot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FxEmbed%2Fpolyglot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266481732,"owners_count":23935938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bun","translate","translation","typescript"],"created_at":"2025-07-22T11:06:24.930Z","updated_at":"2026-05-19T03:09:33.835Z","avatar_url":"https://github.com/FxEmbed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🗣️ Polyglot - Scalable Translation Service\n\nA fast, reliable, and modular translation API designed to meet the scale required by FxEmbed.\n\nWith our native multi-provider architecture, we support multiple kinds of providers:\n- **Free translations** from popular services like *Google Translate*, *DeepL*, and *Bing Translate*\n- **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.\n- **Self-hosted alternative** *LibreTranslate*\n\n## Features\n\n- **Dynamic Selection**: Chooses between providers based on target language, input string length, and availability\n- **Load Balancing and Rate Limit Leveling**: Distributes requests across translation providers\n- **Automatic Failover**: If one provider fails, automatically tries others (free first, then paid)\n- **Designed to Scale**: Use higher rate limits for free services by scaling across servers and network providers\n\n## Quick Start\n\n### Using Docker Compose\n\nEdit the `docker-compose.yml` file to set bound port and your API keys if you want to use paid translation providers.\n\n```bash\ndocker compose up -d\n```\n### Using Docker\n\n```bash\n# Pull and run the latest image\ndocker run -p 3220:3220 ghcr.io/fxembed/polyglot:latest\n\n# Or run with environment variables \ndocker run -p 3220:3220 \\\n  -e AZURE_TRANSLATOR_KEY=\"your_azure_key\" \\\n  -e AZURE_TRANSLATOR_REGION=\"eastus\" \\\n  -e DEEPL_API_KEY=\"your_deepl_key\" \\\n  ghcr.io/fxembed/polyglot:latest\n```\n\n\n### Standalone\n\nThis requires the [Bun](https://bun.sh) runtime installed.\n\n```bash\n# Clone the repository\ngit clone \u003cyour-repo-url\u003e\ncd polyglot\n\n# Install dependencies\nbun install\n\n# Start the server\nbun run index.ts\n```\n\nThe API will be available at `http://localhost:3220` (port configurable in `.env` or `docker-compose.yml`)\n\n### Optional: Configure Paid APIs\n\nRelying 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:\n- [Azure AI Translator](https://azure.microsoft.com/en-us/products/ai-services/ai-translator) - 2M characters free per month, forever\n- [DeepL](https://www.deepl.com/en/pro-api) - 500K characters free per month, forever\n- [AWS Translate](https://aws.amazon.com/translate/) - 2M characters free per month, 12 months only\n\n```\n# Azure AI Translator \nAZURE_TRANSLATOR_KEY=\"your_azure_key\"\nAZURE_TRANSLATOR_REGION=\"eastus\"\n\n# DeepL Official API  \nDEEPL_API_KEY=\"your_deepl_key\"\n\n# AWS Translate\nAWS_ACCESS_KEY_ID=\"your_access_key_id\"\nAWS_SECRET_ACCESS_KEY=\"your_access_key\"\nAWS_REGION=\"your_region\" # optional, defaults to us-east-1\n\n# LibreTranslate (self-hosted or public instance)\nLIBRETRANSLATE_URL=\"https://translate.example.com\"\nLIBRETRANSLATE_API_KEY=\"your_api_key_if_required\" # optional for some instances\n```\n\n**Note**: Free providers (Google Translate, Bing, DeepLX) work without configuration.\n\n## 📖 API Usage\n\n### Translate Text\n\n**Endpoint:** `POST /translate`\n\nIf you configured an `ACCESS_TOKEN`, please provide it in the `Authorization` header as `Bearer \u003ctoken\u003e`.\n\n**Request Body:**\n```json\n{\n  \"text\": \"Hello, world!\",\n  \"target_lang\": \"es\",\n  \"source_lang\": \"en\"  // Optional - auto-detected if not provided\n}\n```\n\n**Response:**\n```json\n{\n  \"translated_text\": \"¡Hola Mundo!\",\n  \"source_lang\": \"en\",\n  \"target_lang\": \"es\",\n  \"provider\": \"google\"\n}\n```\n\n### Example with cURL\n\n```bash\n# Basic translation, auto detect language\ncurl -X POST http://localhost:3220/translate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Hello, world!\", \"target_lang\": \"es\"}'\n\n# With source language specified\ncurl -X POST http://localhost:3220/translate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Bonjour le monde\", \"source_lang\": \"fr\", \"target_lang\": \"en\"}'\n```\n\n## 📄 License\n\nThis project is licensed under AGPL-3.0.\n\n## Disclaimer\n\nThis 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.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxembed%2Fpolyglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffxembed%2Fpolyglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxembed%2Fpolyglot/lists"}