Enjoy reading with your favorite style.
See the codeModernized ebook translation toolkit for TXT, EPUB, DOCX, PDF, and optional MOBI input. Supports Codex, Claude Code, and Gemini CLI as local translation providers alongside OpenAI/Azure APIs. This version upgrades the original single-file project into a package with a real CLI, modern OpenAI SDK support, multi-provider support, resume cache, glossary handling, tests, and release-ready packaging.

Direct link: ebook.gif
openai, azure, compatible, and offline mocksettings.toml, .env, and full legacy settings.cfg compatibilitysrc/text_translation.py entrypoint as a compatibility wrappercodex: local Codex CLI using your ChatGPT subscription loginclaude: Claude Code CLI using your Anthropic account (models: claude-sonnet-4-6, claude-opus-4-6, claude-haiku-4-5-20251001)gemini: Gemini CLI using your Google account (models: gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite)openai: official OpenAI APIazure: Azure OpenAI deploymentcompatible: any OpenAI-compatible endpoint, including Venice.ai-style APIsmock: offline smoke testing without any API keytxt, md, epub, docx, pdfmobi with pip install mobitxt and epubgit clone https://github.com/jesselau76/ebook-GPT-translator.git
cd ebook-GPT-translator
python3 -m pip install -r requirements.txt
Optional MOBI support:
python3 -m pip install mobi
Optional XLSX glossary support:
python3 -m pip install openpyxl
Create config:
python3 -m ebook_gpt_translator init-config
Launch the desktop GUI:
PYTHONPATH=src python3 -m ebook_gpt_translator.gui
Or, after installation:
ebook-gpt-translator-gui
GUI notes:
Config file is optional. Leave it empty to use the values currently selected in the GUI.Model field in the GUI is a dropdown that updates automatically when you switch providers (Codex, Claude Code, or Gemini models).Target language field in the GUI is a common-language dropdown, but you can still type a custom language.Custom prompt box for style instructions such as Translate into Chinese in a Dream of the Red Chamber style.Check resume and Resume previous job actions. If translation is interrupted, rerun the same file and settings to continue from cached chunks while rebuilding the same consistency state.CLI Tools panel showing install/auth status for Codex, Claude Code, and Gemini CLI with one-click login for each.Run a real translation:
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--config settings.toml \
--provider codex \
--model gpt-5.2-codex \
--reasoning-effort medium \
--target-language "Simplified Chinese"
Run with Codex subscription login:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider codex
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider codex \
--model gpt-5.2-codex \
--reasoning-effort medium \
--target-language "Simplified Chinese"
Run with Claude Code:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider claude
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider claude \
--model claude-sonnet-4-6 \
--target-language "Simplified Chinese"
Run with Gemini CLI:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider gemini
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider gemini \
--model gemini-2.5-pro \
--target-language "Simplified Chinese"
Run an offline smoke test:
PYTHONPATH=src python3 -m ebook_gpt_translator translate sample.txt \
--provider mock \
--target-language German
Save OpenAI credentials locally:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider openai
Default provider notes:
codexgpt-5.2-codexmediumcontext_window_blocks = 6--reasoning-effort low--model, for example gpt-5.2-codex, gpt-5.1-codex, or gpt-5-codex-mini--context-windowUse Codex login status:
PYTHONPATH=src python3 -m ebook_gpt_translator auth status
List available models:
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source codex
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source claude
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source gemini
Use the legacy entrypoint:
PYTHONPATH=src python3 text_translation.py translate sample.txt --provider mock
[provider]
kind = "azure"
model = "your-deployment-name"
api_key = "..."
api_base_url = "https://your-resource.openai.azure.com/"
api_version = "2024-02-01"
api_mode = "chat"
[provider]
kind = "compatible"
model = "llama-3.1-405b"
api_key = "..."
api_base_url = "https://api.example.com/v1"
api_mode = "chat"
--skip-existing skips files when translated outputs already exist--test translates only the first few blocks for prompt validation.cache/jobs/*.memory.json for cross-chapter reuse and restartstranslation field, with automatic retry on empty responses--txt-only and --epub-only support lighter workflowssettings.toml.example: recommended formatsettings.cfg.example: legacy-compatible [option] format from the original project.env.example: environment variable override referenceexamples.glossary.csv: sample glossary filetransliteration-list-example.xlsx: original sample glossary workbookRun tests:
PYTHONPATH=src python3 -m unittest discover -s tests -v
Package build:
python3 -m pip install -e .
206 followers · starred May 2023
10,378 followers · starred Mar 2023
23 followers · starred Mar 2023
60 followers · starred Jul 2023
Enjoy reading with your favorite style.
See the codeModernized ebook translation toolkit for TXT, EPUB, DOCX, PDF, and optional MOBI input. Supports Codex, Claude Code, and Gemini CLI as local translation providers alongside OpenAI/Azure APIs. This version upgrades the original single-file project into a package with a real CLI, modern OpenAI SDK support, multi-provider support, resume cache, glossary handling, tests, and release-ready packaging.

Direct link: ebook.gif
openai, azure, compatible, and offline mocksettings.toml, .env, and full legacy settings.cfg compatibilitysrc/text_translation.py entrypoint as a compatibility wrappercodex: local Codex CLI using your ChatGPT subscription loginclaude: Claude Code CLI using your Anthropic account (models: claude-sonnet-4-6, claude-opus-4-6, claude-haiku-4-5-20251001)gemini: Gemini CLI using your Google account (models: gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite)openai: official OpenAI APIazure: Azure OpenAI deploymentcompatible: any OpenAI-compatible endpoint, including Venice.ai-style APIsmock: offline smoke testing without any API keytxt, md, epub, docx, pdfmobi with pip install mobitxt and epubgit clone https://github.com/jesselau76/ebook-GPT-translator.git
cd ebook-GPT-translator
python3 -m pip install -r requirements.txt
Optional MOBI support:
python3 -m pip install mobi
Optional XLSX glossary support:
python3 -m pip install openpyxl
Create config:
python3 -m ebook_gpt_translator init-config
Launch the desktop GUI:
PYTHONPATH=src python3 -m ebook_gpt_translator.gui
Or, after installation:
ebook-gpt-translator-gui
GUI notes:
Config file is optional. Leave it empty to use the values currently selected in the GUI.Model field in the GUI is a dropdown that updates automatically when you switch providers (Codex, Claude Code, or Gemini models).Target language field in the GUI is a common-language dropdown, but you can still type a custom language.Custom prompt box for style instructions such as Translate into Chinese in a Dream of the Red Chamber style.Check resume and Resume previous job actions. If translation is interrupted, rerun the same file and settings to continue from cached chunks while rebuilding the same consistency state.CLI Tools panel showing install/auth status for Codex, Claude Code, and Gemini CLI with one-click login for each.Run a real translation:
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--config settings.toml \
--provider codex \
--model gpt-5.2-codex \
--reasoning-effort medium \
--target-language "Simplified Chinese"
Run with Codex subscription login:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider codex
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider codex \
--model gpt-5.2-codex \
--reasoning-effort medium \
--target-language "Simplified Chinese"
Run with Claude Code:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider claude
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider claude \
--model claude-sonnet-4-6 \
--target-language "Simplified Chinese"
Run with Gemini CLI:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider gemini
PYTHONPATH=src python3 -m ebook_gpt_translator translate book.epub \
--provider gemini \
--model gemini-2.5-pro \
--target-language "Simplified Chinese"
Run an offline smoke test:
PYTHONPATH=src python3 -m ebook_gpt_translator translate sample.txt \
--provider mock \
--target-language German
Save OpenAI credentials locally:
PYTHONPATH=src python3 -m ebook_gpt_translator auth login --provider openai
Default provider notes:
codexgpt-5.2-codexmediumcontext_window_blocks = 6--reasoning-effort low--model, for example gpt-5.2-codex, gpt-5.1-codex, or gpt-5-codex-mini--context-windowUse Codex login status:
PYTHONPATH=src python3 -m ebook_gpt_translator auth status
List available models:
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source codex
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source claude
PYTHONPATH=src python3 -m ebook_gpt_translator list-models --source gemini
Use the legacy entrypoint:
PYTHONPATH=src python3 text_translation.py translate sample.txt --provider mock
[provider]
kind = "azure"
model = "your-deployment-name"
api_key = "..."
api_base_url = "https://your-resource.openai.azure.com/"
api_version = "2024-02-01"
api_mode = "chat"
[provider]
kind = "compatible"
model = "llama-3.1-405b"
api_key = "..."
api_base_url = "https://api.example.com/v1"
api_mode = "chat"
--skip-existing skips files when translated outputs already exist--test translates only the first few blocks for prompt validation.cache/jobs/*.memory.json for cross-chapter reuse and restartstranslation field, with automatic retry on empty responses--txt-only and --epub-only support lighter workflowssettings.toml.example: recommended formatsettings.cfg.example: legacy-compatible [option] format from the original project.env.example: environment variable override referenceexamples.glossary.csv: sample glossary filetransliteration-list-example.xlsx: original sample glossary workbookRun tests:
PYTHONPATH=src python3 -m unittest discover -s tests -v
Package build:
python3 -m pip install -e .
206 followers · starred May 2023
10,378 followers · starred Mar 2023
23 followers · starred Mar 2023
60 followers · starred Jul 2023