GitPedia

TranslateBooksWithLLMs

Translate full-length books and documents with Ollama, OpenAI (comptatible), Gemini, Mistral, Poe or OpenRouter. Preserves formatting. Resumes where you left off. No file size limits.

From hydropix·Updated June 27, 2026·View on GitHub·

A desktop app that translates **books**, **subtitles**, and **documents** with AI - local or cloud. Drop a file, pick a language, get the result. The project is written primarily in Python, distributed under the GNU Affero General Public License v3.0 license, first published in 2025. It has gained significant community traction with 1,903 stars and 251 forks on GitHub. Key topics include: docx, epub, gemini, gemini-api, llm.

Latest release: v1.4.10
June 16, 2026View Changelog →
<div align="center"> <h1>TBL - Translate Books with LLMs</h1> </div> <div align="center">

Download Windows Download macOS Intel Download macOS Apple Silicon

</div>

A desktop app that translates books, subtitles, and documents with AI - local or cloud. Drop a file, pick a language, get the result.

Formats: EPUB, SRT, DOCX, TXT

  • No size limit. Process documents of any length - from a single page to thousand-page novels. The intelligent chunking system handles unlimited content while preserving context between segments.
  • Perfect preservation. Your documents come out exactly as they went in: EPUB formatting, styles, and structure remain intact. SRT timecodes stay perfectly synchronized. Every tag, every timestamp, every formatting detail is preserved.
  • Resume anytime. Interrupted translation? Pick up exactly where you left off. The checkpoint system saves progress automatically.

<img width="867" height="861" alt="image" src="https://github.com/user-attachments/assets/3efcb2a4-e1f0-4d18-ac90-1068a694a2da">

Translation Quality Benchmarks - Find the best model for your target language.


Quick Start

  1. Download the release for your platform (buttons above), or grab it from the releases page.
  2. Extract the archive.
  3. Run TranslateBook.exe (Windows) or ./TranslateBook (macOS).
  4. Open http://localhost:5000 in your browser.

That's it. On first launch, you choose a translation provider:

  • Free & local - Install Ollama and pull a model (e.g. ollama pull qwen3:14b). Nothing leaves your machine.
  • Cloud (often free tier available) - Paste an API key from one of the providers below.

Note: First run creates a TranslateBook_Data folder with your settings.

macOS: On first launch, go to System Settings > Privacy & Security and click Open Anyway.


Providers

<p align="center"> <a href="https://ollama.com/"><img src="src/web/static/img/providers/ollama.png" alt="Ollama" height="32"></a>&nbsp;&nbsp; <a href="https://poe.com/"><img src="src/web/static/img/providers/poe.png" alt="Poe" height="32"></a>&nbsp;&nbsp; <a href="https://openrouter.ai/"><img src="src/web/static/img/providers/openrouter.png" alt="OpenRouter" height="32"></a>&nbsp;&nbsp; <a href="https://openai.com/"><img src="src/web/static/img/providers/openai.png" alt="OpenAI" height="32"></a>&nbsp;&nbsp; <a href="https://mistral.ai/"><img src="src/web/static/img/providers/mistral.png" alt="Mistral" height="32"></a>&nbsp;&nbsp; <a href="https://www.deepseek.com/"><img src="src/web/static/img/providers/deepseek.png" alt="DeepSeek" height="32"></a>&nbsp;&nbsp; <a href="https://deepmind.google/technologies/gemini/"><img src="src/web/static/img/providers/gemini.png" alt="Gemini" height="32"></a>&nbsp;&nbsp; <a href="https://build.nvidia.com/"><img src="src/web/static/img/providers/nvidia.png" alt="NVIDIA NIM" height="32"></a> </p>
ProviderTypeGet started
DeepSeekCloudplatform.deepseek.com
GeminiCloudGoogle AI Studio
MistralCloudconsole.mistral.ai
NVIDIA NIMCloudbuild.nvidia.com
OllamaLocalollama.com
OpenAICloudplatform.openai.com
OpenAI-CompatibleLocal (llama.cpp, LM Studio, vLLM, LocalAI...)Point to your server's endpoint
OpenRouterCloud (200+ models)openrouter.ai/keys
PoeCloud (multi-model)poe.com/api_key

See docs/PROVIDERS.md for detailed setup instructions.


Troubleshooting

ProblemSolution
Ollama won't connectCheck Ollama is running, test curl http://localhost:11434/api/tags
Model not foundRun ollama list, then ollama pull model-name

See docs/TROUBLESHOOTING.md for more solutions.


Advanced

<details> <summary><b>Install from source</b></summary>

Prerequisites: Python 3.8+, Ollama, Git

bash
git clone https://github.com/hydropix/TranslateBooksWithLLMs.git cd TranslateBookWithLLM ollama pull qwen3:14b # Download a model # Windows start.bat # Mac/Linux chmod +x start.sh && ./start.sh

The web interface opens at http://localhost:5000.

</details> <details> <summary><b>Command line</b></summary>
bash
# Basic (auto-generates "book (Chinese).epub") python translate.py -i book.epub -sl English -tl Chinese # With OpenRouter python translate.py -i book.txt --provider openrouter \ --openrouter_api_key YOUR_KEY -m anthropic/claude-sonnet-4 -tl French # With OpenAI python translate.py -i book.txt --provider openai \ --openai_api_key YOUR_KEY -m gpt-4o -tl French # With Gemini python translate.py -i book.txt --provider gemini \ --gemini_api_key YOUR_KEY -m gemini-2.0-flash -tl French # With Mistral python translate.py -i book.txt --provider mistral \ --mistral_api_key YOUR_KEY -m mistral-large-latest -tl French # With DeepSeek python translate.py -i book.txt --provider deepseek \ --deepseek_api_key YOUR_KEY -m deepseek-v4-pro -tl French # With Poe python translate.py -i book.txt --provider poe \ --poe_api_key YOUR_KEY -m Claude-Sonnet-4 -tl French # With NVIDIA NIM python translate.py -i book.txt --provider nim \ --nim_api_key YOUR_KEY -m meta/llama-3.1-8b-instruct -tl French # With local OpenAI-compatible server (llama.cpp, LM Studio, vLLM, etc.) python translate.py -i book.txt --provider openai \ --api_endpoint http://localhost:8080/v1/chat/completions -m your-model -tl French

Main options

OptionDescriptionDefault
-i, --inputInput fileRequired
-o, --outputOutput fileAuto: {name} ({lang}).{ext}
-sl, --source_langSource languageEnglish
-tl, --target_langTarget languageChinese
-m, --modelModel nameqwen3:14b
--providerollama/openrouter/openai/gemini/mistral/deepseek/poe/nimollama
--parallelChunks translated concurrently (cloud only; Ollama stays at 1)1
--text-cleanupOCR/typographic cleanupdisabled
--refineSecond pass for literary polishdisabled
--ttsGenerate audio (Edge-TTS)disabled

See docs/CLI.md for all options (TTS voices, rates, formats, etc.).

</details> <details> <summary><b>Configuration (.env)</b></summary>

Copy .env.example to .env and edit:

bash
# Provider LLM_PROVIDER=ollama # Ollama API_ENDPOINT=http://localhost:11434/api/generate DEFAULT_MODEL=qwen3:14b # API Keys (if using cloud providers) OPENROUTER_API_KEY=sk-or-v1-... OPENAI_API_KEY=sk-... GEMINI_API_KEY=... MISTRAL_API_KEY=... DEEPSEEK_API_KEY=... POE_API_KEY=... NIM_API_KEY=... # Performance REQUEST_TIMEOUT=900 MAX_TOKENS_PER_CHUNK=450 # Token-based chunking (default: 450 tokens) PARALLEL_TRANSLATIONS=1 # Concurrent chunks (cloud only; Ollama stays at 1)

Faster on cloud providers? Set PARALLEL_TRANSLATIONS (or --parallel N, or the "Parallel requests" field in the web UI) above 1 to translate several chunks at once. Local providers (Ollama) ignore it since a single instance serializes requests. Higher values are faster but can hit provider rate limits.

Multiple API keys? Any *_API_KEY variable accepts a comma-separated list (e.g. GEMINI_API_KEY=key1,key2,key3). The system rotates between keys automatically when one hits a rate limit - useful to chain free-tier accounts. See docs/API_KEY_ROTATION.md.

Long jobs? Get a push notification on your phone (via ntfy), Discord, Slack, gotify, or any HTTP endpoint when a translation finishes. Set NOTIFY_WEBHOOK_URL in .env. See docs/NOTIFICATIONS.md.

</details> <details> <summary><b>Docker</b></summary>
bash
docker build -t translatebook . docker run -p 5000:5000 -v $(pwd)/translated_files:/app/translated_files translatebook

See docs/DOCKER.md for more options.

</details>

Documentation

GuideDescription
docs/PROVIDERS.mdDetailed provider setup (Ollama, LM Studio, OpenRouter, OpenAI, Gemini)
docs/API_KEY_ROTATION.mdUse multiple API keys per provider with automatic failover on rate-limit
docs/NOTIFICATIONS.mdWebhook notifications on completion (ntfy, gotify, Discord, Slack, custom)
docs/GLOSSARY.mdForce consistent term translations across a book (Web UI + CLI, auto-extract via NER)
docs/CLI.mdComplete CLI reference
docs/TROUBLESHOOTING.mdProblem solutions
docs/DOCKER.mdDocker deployment guide

Star History

<a href="https://www.star-history.com/#hydropix/TranslateBooksWithLLMs&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=hydropix/TranslateBooksWithLLMs&type=Date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=hydropix/TranslateBooksWithLLMs&type=Date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=hydropix/TranslateBooksWithLLMs&type=Date&legend=top-left" /> </picture> </a>

Support

If TBL saves you time, you can support its development on Ko-fi:

<a href="https://ko-fi.com/Y1M021FYBG" target="_blank"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Support me on Ko-fi" height="36"></a>


License: AGPL-3.0

Contributors

Showing top 6 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from hydropix/TranslateBooksWithLLMs via the GitHub API.Last fetched: 6/27/2026