[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71011":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":9,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},71011,"bilingual_book_maker","yihong0618\u002Fbilingual_book_maker","yihong0618","Make bilingual epub books Using AI translate",null,"Python",9308,1245,53,136,0,4,17,50,12,86.79,"MIT License",false,"main",true,[],"2026-06-12 04:00:58","**[中文](.\u002FREADME-CN.md) | English**\n[![litellm](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%20%F0%9F%9A%85%20liteLLM-OpenAI%7CAzure%7CAnthropic%7CPalm%7CCohere%7CReplicate%7CHugging%20Face-blue?color=green)](https:\u002F\u002Fgithub.com\u002FBerriAI\u002Flitellm)\n\n# bilingual_book_maker\n\nThe bilingual_book_maker is an AI translation tool that uses ChatGPT to assist users in creating multi-language versions of epub\u002Ftxt\u002Fsrt\u002Fpdf files and books. This tool is exclusively designed for translating epub and other public domain works and is not intended for copyrighted works. Before using this tool, please review the project's **[disclaimer](.\u002Fdisclaimer.md)**.\n\n![image](https:\u002F\u002Fuser-images.githubusercontent.com\u002F15976103\u002F222317531-a05317c5-4eee-49de-95cd-04063d9539d9.png)\n\n## Supported Models\n\ngpt-5-mini, gpt-4, gpt-3.5-turbo, claude-2, palm, llama-2, azure-openai, command-nightly, gemini, qwen-mt-turbo, qwen-mt-plus\nFor using Non-OpenAI models, use class `liteLLM()` - liteLLM supports all models above.\nFind more info here for using liteLLM: https:\u002F\u002Fgithub.com\u002FBerriAI\u002Flitellm\u002Fblob\u002Fmain\u002Fsetup.py\n\n## Preparation\n\n1. ChatGPT or OpenAI token [^token]\n2. epub\u002Ftxt\u002Fpdf books\n3. Environment with internet access or proxy\n4. Python 3.8+\n\n## Quick Start\n\nA sample book, `test_books\u002Fanimal_farm.epub`, is provided for testing purposes.\n\n```shell\npip install -r requirements.txt\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key} --test\nOR\npip install -U bbook_maker\nbbook --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key} --test\n```\n\n## Translate Service\n\n- Use `--openai_key` option to specify OpenAI API key. If you have multiple keys, separate them by commas (xxx,xxx,xxx) to reduce errors caused by API call limits.\n  Or, just set environment variable `BBM_OPENAI_API_KEY` instead.\n- A sample book, `test_books\u002Fanimal_farm.epub`, is provided for testing purposes.\n- The default underlying model is [GPT-3.5-turbo](https:\u002F\u002Fopenai.com\u002Fblog\u002Fintroducing-chatgpt-and-whisper-apis), which is used by ChatGPT currently. Use `--model gpt4` to change the underlying model to `GPT4`. You can also use `GPT4omini`.\n- Important to note that `gpt-4` is significantly more expensive than `gpt-4-turbo`, but to avoid bumping into rate limits, we automatically balance queries across `gpt-4-1106-preview`, `gpt-4`, `gpt-4-32k`, `gpt-4-0613`,`gpt-4-32k-0613`.\n- If you want to use a specific model alias with OpenAI (eg `gpt-4-1106-preview` or `gpt-3.5-turbo-0125`), you can use `--model openai --model_list gpt-4-1106-preview,gpt-3.5-turbo-0125`. `--model_list` takes a comma-separated list of model aliases.\n- If using chatgptapi, you can add `--use_context` to add a context paragraph to each passage sent to the model for translation (see below).\n\n* DeepL\n  Support DeepL model [DeepL Translator](https:\u002F\u002Frapidapi.com\u002FsplintPRO\u002Fapi\u002Fdpl-translator) need pay to get the token\n\n  ```\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model deepl --deepl_key ${deepl_key}\n  ```\n\n* DeepL free\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model deeplfree\n  ```\n\n* [Claude](https:\u002F\u002Fconsole.anthropic.com\u002Fdocs)\n\n  Use [Claude](https:\u002F\u002Fconsole.anthropic.com\u002Fdocs) model to translate\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model claude --claude_key ${claude_key}\n  ```\n\n* Google Translate\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model google\n  ```\n\n* Caiyun Translate\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model caiyun --caiyun_key ${caiyun_key}\n  ```\n\n* Gemini\n\n  Support Google [Gemini](https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey) model, use `--model gemini` for Gemini Flash or `--model geminipro` for Gemini Pro.\n  If you want to use a specific model alias with Gemini (eg `gemini-1.5-flash-002` or `gemini-1.5-flash-8b-exp-0924`), you can use `--model gemini --model_list gemini-1.5-flash-002,gemini-1.5-flash-8b-exp-0924`. `--model_list` takes a comma-separated list of model aliases.\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model gemini --gemini_key ${gemini_key}\n  ```\n\n* Qwen\n\n  Support Alibaba Cloud [Qwen-MT](https:\u002F\u002Fbailian.console.aliyun.com\u002F) specialized translation model. Supports 92 languages with features like terminology intervention and translation memory.\n  Use `--model qwen-mt-turbo` for faster\u002Fcheaper translation, or `--model qwen-mt-plus` for higher quality.\n\n  Use `source_lang` to specify the source language explicitly, or leave it empty for auto-detection.\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --qwen_key ${qwen_key} --model qwen-mt-turbo --language \"Simplified Chinese\"\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --qwen_key ${qwen_key} --model qwen-mt-plus --language \"Japanese\" --source_lang \"English\"\n  ```\n\n* [Tencent TranSmart](https:\u002F\u002Ftransmart.qq.com)\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model tencentransmart\n  ```\n\n* [xAI](https:\u002F\u002Fx.ai)\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model xai --xai_key ${xai_key}\n  ```\n\n* [Ollama](https:\u002F\u002Fgithub.com\u002Follama\u002Follama)\n\n  Support [Ollama](https:\u002F\u002Fgithub.com\u002Follama\u002Follama) self-host models,\n  If ollama server is not running on localhost, use `--api_base http:\u002F\u002Fx.x.x.x:port\u002Fv1` to point to the ollama server address\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --ollama_model ${ollama_model_name}\n  ```\n\n* [groq](https:\u002F\u002Fconsole.groq.com\u002Fkeys)\n\n  GroqCloud currently supports models: you can find from [Supported Models](https:\u002F\u002Fconsole.groq.com\u002Fdocs\u002Fmodels)\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --groq_key [your_key] --model groq --model_list llama3-8b-8192\n  ```\n\n* Custom API Provider\n\n  If the built-in models don't cover your needs, you can define custom providers via a JSON config file. This lets you use any OpenAI-compatible API (DeepSeek, SiliconFlow, local proxies, etc.) without modifying source code.\n\n  Create `bbm_providers.json` in the current directory (or `~\u002F.bbm\u002Fproviders.json` for global config):\n\n  ```json\n  {\n    \"providers\": {\n      \"deepseek\": {\n        \"api_style\": \"openai\",\n        \"base_url\": \"https:\u002F\u002Fapi.deepseek.com\u002Fv1\",\n        \"default_models\": [\"deepseek-chat\", \"deepseek-reasoner\"],\n        \"env_key\": \"BBM_DEEPSEEK_API_KEY\"\n      },\n      \"siliconflow\": {\n        \"api_style\": \"openai\",\n        \"base_url\": \"https:\u002F\u002Fapi.siliconflow.cn\u002Fv1\",\n        \"default_models\": [\"Qwen\u002FQwen2.5-72B-Instruct\"],\n        \"env_key\": \"BBM_SILICONFLOW_API_KEY\"\n      }\n    }\n  }\n  ```\n\n  Config fields:\n\n  | Field | Required | Description |\n  |-------|----------|-------------|\n  | `api_style` | Yes | Translator interface style. Supported: `openai`, `claude`, `gemini`, `qwen` |\n  | `base_url` | No | API endpoint URL. Falls back to the api_style's default |\n  | `default_models` | No | Default model list. Required if `--model_list` is not provided |\n  | `env_key` | No | Environment variable name for API key. Required if `--api_key` is not provided |\n\n  Priority: project-level `.\u002Fbbm_providers.json` overrides global `~\u002F.bbm\u002Fproviders.json`.\n\n  `--provider` and `--model` are mutually exclusive.\n\n  ```shell\n  python3 make_book.py --provider deepseek --api_key sk-xxx --book_name test_books\u002Fanimal_farm.epub\n\n  export BBM_DEEPSEEK_API_KEY=sk-xxx\n  python3 make_book.py --provider deepseek --book_name test_books\u002Fanimal_farm.epub\n\n  python3 make_book.py --provider deepseek --api_key sk-xxx --model_list deepseek-reasoner --book_name test_books\u002Fanimal_farm.epub\n  ```\n\n## Use\n\n- Once the translation is complete, a bilingual book named `${book_name}_bilingual.epub` would be generated for EPUB inputs; for TXT\u002FMD\u002FSRT inputs a bilingual text (or subtitle) file named `${book_name}_bilingual.txt` (or `_bilingual.srt`) will be generated. For **PDF inputs** the tool will produce a bilingual `.txt` fallback and will also attempt to create `${book_name}_bilingual.epub` — if EPUB creation fails, the TXT fallback remains so you do not need to retranslate.\n- If there are any errors or you wish to interrupt the translation by pressing `CTRL+C`, a temporary bilingual file (for example `{book_name}_bilingual_temp.epub` or `{book_name}_bilingual_temp.txt`) would be generated. You can simply rename it to any desired name.\n\n## Params\n\n- `--model`:\n\n  Select the translation model. Default: `chatgptapi`. Available values and their behavior:\n\n  | Model | Key Source | Notes |\n  |-------|-----------|-------|\n  | `chatgptapi` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | GPT-3.5-turbo. Auto-detects available models from API |\n  | `gpt4` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | GPT-4 family. Auto-balances across available GPT-4 variants |\n  | `gpt4omini` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | GPT-4o-mini |\n  | `gpt4o` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | GPT-4o |\n  | `gpt5mini` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | GPT-5-mini |\n  | `o1preview` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | o1-preview |\n  | `o1` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | o1 |\n  | `o1mini` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | o1-mini |\n  | `o3mini` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | o3-mini |\n  | `openai` | `--openai_key` \u002F `BBM_OPENAI_API_KEY` | **Requires `--model_list`**. Use any OpenAI-compatible model |\n  | `claude-*` | `--claude_key` \u002F `BBM_CLAUDE_API_KEY` | Prefix match. e.g. `--model claude-sonnet-4-20250514` |\n  | `gemini` | `--gemini_key` \u002F `BBM_GOOGLE_GEMINI_KEY` | Gemini Flash. Supports `--model_list` |\n  | `geminipro` | `--gemini_key` \u002F `BBM_GOOGLE_GEMINI_KEY` | Gemini Pro |\n  | `groq` | `--groq_key` \u002F `BBM_GROQ_API_KEY` | **Requires `--model_list`** |\n  | `xai` | `--xai_key` \u002F `BBM_XAI_API_KEY` | Grok |\n  | `qwen-mt-turbo` | `--qwen_key` \u002F `BBM_QWEN_API_KEY` | Qwen fast translation model |\n  | `qwen-mt-plus` | `--qwen_key` \u002F `BBM_QWEN_API_KEY` | Qwen high-quality translation model |\n  | `google` | N\u002FA | Free. No API key needed |\n  | `caiyun` | `--caiyun_key` \u002F `BBM_CAIYUN_API_KEY` | Caiyun |\n  | `deepl` | `--deepl_key` \u002F `BBM_DEEPL_API_KEY` | DeepL (paid) |\n  | `deeplfree` | N\u002FA | DeepL Free |\n  | `tencentransmart` | N\u002FA | Tencent TranSmart. Free |\n  | `customapi` | `--custom_api` \u002F `BBM_CUSTOM_API` | Custom translation API |\n\n  For any OpenAI-compatible API not listed above, use `--provider` instead (see Custom API Provider section).\n\n- `--test`:\n\n  Use `--test` option to preview the result if you haven't paid for the service. Note that there is a limit and it may take some time.\n\n- `--language`:\n\n  Set the target language like `--language \"Simplified Chinese\"`. Default target language is `\"Simplified Chinese\"`.\n  Read available languages by helper message: `python make_book.py --help`\n\n- `--proxy`:\n\n  Use `--proxy` option to specify proxy server for internet access. Enter a string such as `http:\u002F\u002F127.0.0.1:7890`.\n\n- `--resume`:\n\n  Use `--resume` option to manually resume the process after an interruption.\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model google --resume\n  ```\n\n- `--translate-tags`:\n\n  epub is made of html files. By default, we only translate contents in `\u003Cp>`.\n  Use `--translate-tags` to specify tags need for translation. Use comma to separate multiple tags.\n  For example: `--translate-tags h1,h2,h3,p,div`\n\n- `--exclude-translate-tags`:\n\n  Use `--exclude-translate-tags` to exclude content within specified HTML tags from translation. This is useful for preserving code blocks, preformatted text, or other special content. Use comma to separate multiple tags.\n  Default: `sup,code`.\n  For example: `--exclude-translate-tags code,pre`\n\n  **Tip**: Use `--exclude-translate-tags \"\"` to translate all content including code blocks (overrides the default exclusion).\n\n- `--book_from`:\n\n  Use `--book_from` option to specify e-reader type (Now only `kobo` is available), and use `--device_path` to specify the mounting point.\n\n- `--api_base`:\n\n  If you want to change api_base like using Cloudflare Workers, use `--api_base \u003CURL>` to support it.\n  **Note: the api url should be '`https:\u002F\u002Fxxxx\u002Fv1`'. Quotation marks are required.**\n\n- `--allow_navigable_strings`:\n\n  If you want to translate strings in an e-book that aren't labeled with any tags, you can use the `--allow_navigable_strings` parameter. This will add the strings to the translation queue. **Note that it's best to look for e-books that are more standardized if possible.**\n\n- `--prompt`:\n\n  To tweak the prompt, use the `--prompt` parameter. Valid placeholders for the `user` role template include `{text}` and `{language}`. It supports a few ways to configure the prompt:\n\n  - If you don't need to set the `system` role content, you can simply set it up like this: `--prompt \"Translate {text} to {language}.\"` or `--prompt prompt_template_sample.txt` (example of a text file can be found at [.\u002Fprompt_template_sample.txt](.\u002Fprompt_template_sample.txt)).\n\n  - If you need to set the `system` role content, you can use the following format: `--prompt '{\"user\":\"Translate {text} to {language}\", \"system\": \"You are a professional translator.\"}'` or `--prompt prompt_template_sample.json` (example of a JSON file can be found at [.\u002Fprompt_template_sample.json](.\u002Fprompt_template_sample.json)).\n  \n  - You can now use [PromptDown](https:\u002F\u002Fgithub.com\u002Fbtfranklin\u002Fpromptdown) format (`.md` files) for more structured prompts: `--prompt prompt_md.prompt.md`. PromptDown supports both traditional system messages and developer messages (used by newer AI models). Example:\n  \n      ```markdown\n      # Translation Prompt\n      \n      ## Developer Message\n      You are a professional translator who specializes in accurate translations.\n      \n      ## Conversation\n      \n      | Role | Content                                                        |\n      | ---- | -------------------------------------------------------------- |\n      | User | Please translate the following text into {language}:\\n\\n{text} |\n      ```\n\n  - You can also set the `user` and `system` role prompt by setting environment variables: `BBM_CHATGPTAPI_USER_MSG_TEMPLATE` and `BBM_CHATGPTAPI_SYS_MSG`.\n\n- `--batch_size`:\n\n  Use the `--batch_size` parameter to specify the number of lines for batch translation (default is 10, currently only effective for txt files).\n\n- `--accumulated_num`:\n\n  Wait for how many tokens have been accumulated before starting the translation. gpt3.5 limits the total_token to 4090. For example, if you use `--accumulated_num 1600`, maybe openai will output 2200 tokens and maybe 200 tokens for other messages in the system messages user messages, 1600+2200+200=4000, So you are close to reaching the limit. You have to choose your own\n  value, there is no way to know if the limit is reached before sending\n\n- `--use_context`:\n\n  prompts the model to create a three-paragraph summary. If it's the beginning of the translation, it will summarize the entire passage sent (the size depending on `--accumulated_num`).\n  For subsequent passages, it will amend the summary to include details from the most recent passage, creating a running one-paragraph context payload of the important details of the entire translated work. This improves consistency of flow and tone throughout the translation. This option is available for all ChatGPT-compatible models and Gemini models.\n\n- `--context_paragraph_limit`:\n\n  Use `--context_paragraph_limit` to set a limit on the number of context paragraphs when using the `--use_context` option.\n\n- `--parallel-workers`:\n\n  Use `--parallel-workers` to enable parallel EPUB chapter processing. Values greater than `1` spin up multiple workers (recommended: `2-4`) and automatically fall back to sequential mode for single-chapter books.\n\n- `--temperature`:\n\n  Use `--temperature` to set the temperature parameter for `chatgptapi`\u002F`gpt4`\u002F`claude` models.\n  For example: `--temperature 0.7`.\n\n- `--block_size`:\n\n  Use `--block_size` to merge multiple paragraphs into one block. This may increase accuracy and speed up the process.\n  For example: `--block_size 5`.\n\n- `--single_translate`:\n\n  Use `--single_translate` to output only the translated book without creating a bilingual version.\n\n- `--translation_style`:\n\n  example: `--translation_style \"color: #808080; font-style: italic;\"`\n\n- `--retranslate \"$translated_filepath\" \"file_name_in_epub\" \"start_str\" \"end_str\"(optional)`:\n\n  Retranslate from start_str to end_str's tag:\n\n  ```shell\n  python3 \"make_book.py\" --book_name \"test_books\u002Fanimal_farm.epub\" --retranslate 'test_books\u002Fanimal_farm_bilingual.epub' 'index_split_002.html' 'in spite of the present book shortage which' 'This kind of thing is not a good symptom. Obviously'\n  ```\n\n  Retranslate start_str's tag:\n\n  ```shell\n  python3 \"make_book.py\" --book_name \"test_books\u002Fanimal_farm.epub\" --retranslate 'test_books\u002Fanimal_farm_bilingual.epub' 'index_split_002.html' 'in spite of the present book shortage which'\n  ```\n\n- `--extra_body`:\n\n  Pass additional JSON parameters to the API. This is useful for models that support extra configuration options. Provide a JSON string with the desired parameters.\n\n  ```shell\n  python3 make_book.py --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key} --extra_body '{\"chat_template_kwargs\": {\"enable_thinking\": false}}'\n  ```\n\n- `--provider`:\n\n  Use a custom provider defined in `bbm_providers.json`. Mutually exclusive with `--model`. See the \"Custom API Provider\" section above.\n\n- `--api_key`:\n\n  API key for custom providers (used with `--provider`). Can also be set via the `env_key` field in the provider config.\n\n### Examples\n\n**Note if use `pip install bbook_maker` all commands can change to `bbook_maker args`**\n\n```shell\n# Test quickly\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key}  --test --language zh-hans\n\n# Test quickly for src\npython3 make_book.py --book_name test_books\u002FLex_Fridman_episode_322.srt --openai_key ${openai_key}  --test\n\n# Or translate the whole book\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key} --language zh-hans\n\n# Or translate the whole book using Gemini flash\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --gemini_key ${gemini_key} --model gemini\n\n# Translate an EPUB with parallel chapter processing\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --openai_key ${openai_key} --parallel-workers 4\n\n# Use a specific list of Gemini model aliases\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --gemini_key ${gemini_key} --model gemini --model_list gemini-1.5-flash-002,gemini-1.5-flash-8b-exp-0924\n\n# Set env OPENAI_API_KEY to ignore option --openai_key\nexport OPENAI_API_KEY=${your_api_key}\n\n# Use the GPT-4 model with context to Japanese\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model gpt4 --use_context --language ja\n\n# Use a specific OpenAI model alias\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model openai --model_list gpt-4-1106-preview --openai_key ${openai_key}\n\n**Note** you can use other `openai like` model in this way\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model openai --model_list yi-34b-chat-0205 --openai_key ${openai_key} --api_base \"https:\u002F\u002Fapi.lingyiwanwu.com\u002Fv1\"\n\n# Use a specific list of OpenAI model aliases\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model openai --model_list gpt-4-1106-preview,gpt-4-0125-preview,gpt-3.5-turbo-0125 --openai_key ${openai_key}\n\n# Use the DeepL model with Japanese\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model deepl --deepl_key ${deepl_key} --language ja\n\n# Use the Claude model with Japanese\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model claude --claude_key ${claude_key} --language ja\n\n# Use the CustomAPI model with Japanese\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --model customapi --custom_api ${custom_api} --language ja\n\n# Use a custom provider (e.g. DeepSeek)\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --provider deepseek --api_key sk-xxx --language ja\n\n# Translate contents in \u003Cdiv> and \u003Cp>\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --translate-tags div,p\n\n# Tweaking the prompt\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --prompt prompt_template_sample.txt\n# or\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --prompt prompt_template_sample.json\n# or\npython3 make_book.py --book_name test_books\u002Fanimal_farm.epub --prompt \"Please translate \\`{text}\\` to {language}\"\n\n# Translate books download from Rakuten Kobo on kobo e-reader\npython3 make_book.py --book_from kobo --device_path \u002Ftmp\u002Fkobo\n\n# translate txt file\npython3 make_book.py --book_name test_books\u002Fthe_little_prince.txt --test --language zh-hans\n# aggregated translation txt file\npython3 make_book.py --book_name test_books\u002Fthe_little_prince.txt --test --batch_size 20\n\n# Using Caiyun model to translate\n# (the api currently only support: simplified chinese \u003C-> english, simplified chinese \u003C-> japanese)\n# the official Caiyun has provided a test token (3975l6lr5pcbvidl6jl2)\n# you can apply your own token by following this tutorial(https:\u002F\u002Fbobtranslate.com\u002Fservice\u002Ftranslate\u002Fcaiyun.html)\npython3 make_book.py --model caiyun --caiyun_key 3975l6lr5pcbvidl6jl2 --book_name test_books\u002Fanimal_farm.epub\n\n\n# Set env BBM_CAIYUN_API_KEY to ignore option --openai_key\nexport BBM_CAIYUN_API_KEY=${your_api_key}\n\n```\n\nMore understandable example\n\n```shell\npython3 make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https:\u002F\u002Fxxxxx\u002Fv1'\n\n# Or python3 is not in your PATH\npython make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https:\u002F\u002Fxxxxx\u002Fv1'\n```\n\nMicrosoft Azure Endpoints\n\n```shell\npython3 make_book.py --book_name 'animal_farm.epub' --openai_key XXXXX --api_base 'https:\u002F\u002Fexample-endpoint.openai.azure.com' --deployment_id 'deployment-name'\n\n# Or python3 is not in your PATH\npython make_book.py --book_name 'animal_farm.epub' --openai_key XXXXX --api_base 'https:\u002F\u002Fexample-endpoint.openai.azure.com' --deployment_id 'deployment-name'\n```\n\n## Docker\n\nYou can use [Docker](https:\u002F\u002Fwww.docker.com\u002F) if you don't want to deal with setting up the environment.\n\n```shell\n# Build image\ndocker build --tag bilingual_book_maker .\n\n# Run container\n# \"$folder_path\" represents the folder where your book file locates. Also, it is where the processed file will be stored.\n\n# Windows PowerShell\n$folder_path=your_folder_path # $folder_path=\"C:\\Users\\user\\mybook\\\"\n$book_name=your_book_name # $book_name=\"animal_farm.epub\"\n$openai_key=your_api_key # $openai_key=\"sk-xxx\"\n$language=your_language # see utils.py\n\ndocker run --rm --name bilingual_book_maker --mount type=bind,source=$folder_path,target='\u002Fapp\u002Ftest_books' bilingual_book_maker --book_name \"\u002Fapp\u002Ftest_books\u002F$book_name\" --openai_key $openai_key --language $language\n\n# Linux\nexport folder_path=${your_folder_path}\nexport book_name=${your_book_name}\nexport openai_key=${your_api_key}\nexport language=${your_language}\n\ndocker run --rm --name bilingual_book_maker --mount type=bind,source=${folder_path},target='\u002Fapp\u002Ftest_books' bilingual_book_maker --book_name \"\u002Fapp\u002Ftest_books\u002F${book_name}\" --openai_key ${openai_key} --language \"${language}\"\n```\n\nFor example:\n\n```shell\n# Linux\ndocker run --rm --name bilingual_book_maker --mount type=bind,source=\u002Fhome\u002Fuser\u002Fmy_books,target='\u002Fapp\u002Ftest_books' bilingual_book_maker --book_name \u002Fapp\u002Ftest_books\u002Fanimal_farm.epub --openai_key sk-XXX --test --test_num 1 --language zh-hant\n```\n\n## Notes\n\n1. API token from free trial has limit. If you want to speed up the process, consider paying for the service or use multiple OpenAI tokens\n2. PR is welcome\n\n# Thanks\n\n- @[yetone](https:\u002F\u002Fgithub.com\u002Fyetone)\n\n# Contribution\n\n- Any issues or PRs are welcome.\n- TODOs in the issue can also be selected.\n- Please run `black make_book.py`[^black] before submitting the code.\n\n# Others better\n\n- 书译 BookTranslator -> [Book Translator](https:\u002F\u002Fwww.booktranslator.app)\n\n## Appreciation\n\nThank you, that's enough.\n\n![image](https:\u002F\u002Fuser-images.githubusercontent.com\u002F15976103\u002F222407199-1ed8930c-13a8-402b-9993-aaac8ee84744.png)\n\n[^token]: https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fapi-keys\n[^black]: https:\u002F\u002Fgithub.com\u002Fpsf\u002Fblack\n","bilingual_book_maker 是一个利用AI翻译技术帮助用户创建epub\u002Ftxt\u002Fsrt\u002Fpdf文件和书籍多语言版本的工具。其核心功能包括支持多种AI模型（如gpt-4, gpt-3.5-turbo等）进行高质量翻译，并且能够处理不同格式的电子书。该项目采用Python编写，兼容OpenAI、Azure OpenAI等多种API接口。适用于需要将公开领域作品转换为双语或多语言版本的场景，比如教育、个人学习或文化交流等领域。注意，此工具不应用于受版权保护的作品。",2,"2026-06-11 03:35:27","high_star"]