Skip to content

Documentation of Translation Services

Advanced > Documentation of Translation Services (current)


Viewing Available Translate Services via Command Line

You can confirm the available translate services and their usage by printing the help message in the command line.

pdf2zh_next -h

At the end of the help message, you can view detailed information about the different translation services.


Caution

The following content was prepared for version 1.x of pdf2zh and has not yet been updated for version 2.x. Therefore, the information may be outdated.

This warning message will be removed once the article's content aligns with the new version.

Translate with different services

We've provided a detailed table on the required environment variables for each translation service. Make sure to set them before using the respective service.

Translator Service Environment Variables Default Values Notes
Google (Default) google None N/A None
Bing bing None N/A None
DeepL deepl DEEPL_AUTH_KEY [Your Key] See DeepL
DeepLX deeplx DEEPLX_ENDPOINT https://api.deepl.com/translate See DeepLX
Ollama ollama OLLAMA_HOST, OLLAMA_MODEL http://127.0.0.1:11434, gemma2 See Ollama
Xinference xinference XINFERENCE_HOST, XINFERENCE_MODEL http://127.0.0.1:9997, gemma-2-it See Xinference
OpenAI openai OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_MODEL https://api.openai.com/v1, [Your Key], gpt-4o-mini See OpenAI
AzureOpenAI azure-openai AZURE_OPENAI_BASE_URL, AZURE_OPENAI_API_KEY, AZURE_OPENAI_MODEL [Your Endpoint], [Your Key], gpt-4o-mini See Azure OpenAI
Zhipu zhipu ZHIPU_API_KEY, ZHIPU_MODEL [Your Key], glm-4-flash See Zhipu
ModelScope ModelScope MODELSCOPE_API_KEY, MODELSCOPE_MODEL [Your Key], Qwen/Qwen2.5-Coder-32B-Instruct See ModelScope
Silicon silicon SILICON_API_KEY, SILICON_MODEL [Your Key], Qwen/Qwen2.5-7B-Instruct See SiliconCloud
Gemini gemini GEMINI_API_KEY, GEMINI_MODEL [Your Key], gemini-1.5-flash See Gemini
Azure azure AZURE_ENDPOINT, AZURE_API_KEY https://api.translator.azure.cn, [Your Key] See Azure
Tencent tencent TENCENTCLOUD_SECRET_ID, TENCENTCLOUD_SECRET_KEY [Your ID], [Your Key] See Tencent
Dify dify DIFY_API_URL, DIFY_API_KEY [Your DIFY URL], [Your Key] See Dify,Three variables, lang_out, lang_in, and text, need to be defined in Dify's workflow input.
AnythingLLM anythingllm AnythingLLM_URL, AnythingLLM_APIKEY [Your AnythingLLM URL], [Your Key] See anything-llm
Argos Translate argos See argos-translate
Grok grok GORK_API_KEY, GORK_MODEL [Your GORK_API_KEY], grok-2-1212 See Grok
Groq groq GROQ_API_KEY, GROQ_MODEL [Your GROQ_API_KEY], llama-3-3-70b-versatile See Groq
DeepSeek deepseek DEEPSEEK_API_KEY, DEEPSEEK_MODEL [Your DEEPSEEK_API_KEY], deepseek-chat See DeepSeek
OpenAI-Liked openailiked OPENAILIKED_BASE_URL, OPENAILIKED_API_KEY, OPENAILIKED_MODEL url, [Your Key], model name None
Ali Qwen Translation qwen-mt ALI_MODEL, ALI_API_KEY, ALI_DOMAINS qwen-mt-turbo, [Your Key], scientific paper Tranditional Chinese are not yet supported, it will be translated into Simplified Chinese. More see Qwen MT

For large language models that are compatible with the OpenAI API but not listed in the table above, you can set environment variables using the same method outlined for OpenAI in the table.

Use -s service or -s service:model to specify service:

pdf2zh_next example.pdf -s openai:gpt-4o-mini

Or specify model with environment variables:

set OPENAI_MODEL=gpt-4o-mini
pdf2zh_next example.pdf -s openai

For PowerShell user:

$env:OPENAI_MODEL = gpt-4o-mini
pdf2zh_next example.pdf -s openai