如果你愿意,可以尝试,但是普通用户请在此处下载:Fully Automatic Installation
-
前段时间存储库消失是因为GitHub给我封号了
-
【PotPlayer AI翻译插件安装教程-哔哩哔哩】 https://b23.tv/ntF2dxu
A PotPlayer plugin that leverages the ChatGPT API to provide real-time, context-aware subtitle translation. ✨
Works on my machine.
- Download the Installer: Installer (The installer is open source, so you can review the source code)
- Run the Installer (
installer.exe):- Double-click
installer.exeto start. - Approve the administrator prompt if Windows asks for permission.
- Double-click
- Confirm the PotPlayer Plugin Folder:
- The wizard auto-detects your PotPlayer install path.
- Verify the target folder is:
...\PotPlayer\Extension\Subtitle\Translate - If you installed PotPlayer to a custom location, browse to the correct
Translatefolder.
- Choose the Plugin Variant:
- With context (better translation quality, slightly higher latency).
- Without context (faster, less contextual awareness).
- Configure Model & API Endpoint:
- Model Name: enter the model ID (example:
gpt-4.1-nano). - Custom API base URL (optional): use
ModelName|API Base URL. - No-key endpoints: leave the key blank and verify; the installer will inject
nullkeyafter a successful empty-key test.
- Model Name: enter the model ID (example:
- Enter API Key (if required):
- Paste your API key into the installer field.
- If your endpoint does not require a key, leave it blank and use Verify to test an empty key; on success, the installer will inject
nullkey.
- Finalize Installation:
- Click Install to copy the files.
- Optionally register the uninstaller entry to cleanly remove the plugin later.
- Note: installer defaults are written once; any later changes in PotPlayer’s panel will override the installer values.
After installation, verify settings in PotPlayer:
- Open PotPlayer Preferences: press F5.
- Navigate to Extensions: Extensions > Subtitle translation.
- Select the plugin: choose ChatGPT Translate.
- Set source/target languages as needed.
- Download the ZIP File: Download the latest ZIP file from this repository.
- Extract the ZIP File: Extract the contents to a temporary folder.
- Copy Files:
Copy
ChatGPTSubtitleTranslate.asandChatGPTSubtitleTranslate.icoto the following directory:ReplaceC:\Program Files\DAUM\PotPlayer\Extension\Subtitle\TranslateC:\Program Files\DAUM\PotPlayerwith your custom PotPlayer installation path if necessary. - Configure PotPlayer After Copying:
- Open PotPlayer Preferences (press F5).
- Go to Extensions > Subtitle translation.
- Select ChatGPT Translate.
- Configure Model Name, API URL, and API Key as needed.
- Set source and target languages.
ℹ️ If you switch between the context-aware and no-context scripts, replace both
.asfiles together. Older copies that used the sharedFormatFailureTranslationname can cause PotPlayer to report a conflict on whichever script loads first (often the standard context version). The current files use uniquely prefixed helpers to avoid this.
-
Model Name: You can simply enter the model name, which will use the default API URL. Example:
gpt-4.1-nanoAlternatively, specify a custom API URL using the following format:
ModelName|API Base URLExample:
gpt-4.1-nano|https://api.openai.com/v1/chat/completionsNote: In version v1.5 and later, if you're using a self-hosted or third-party API that does not require an API key, you can add
nullkeyat the end:gpt-4.1-nano|nullkeyor:
qwen2.5:7b|http://127.0.0.1:11434/v1/chat/completions|nullkeyOptional tuning parameters (v1.7+): Append extra tokens separated by
|:delay_ms(digits only): add a delay before each requestretryN(N = 0–3): retry moderetry0: no retryretry1: one extra attempt on empty responseretry2: keep retrying until a response (no delay)retry3: keep retrying, with delay before every attempt
cache=auto/cache=off: context cache mode (context version only; auto falls back to chat if unsupported)smallmodel=0/smallmodel=1: enable small model mode (optimized prompt for smaller models)checkhallucination=0/checkhallucination=1: enable hallucination check (retries if translation length > 5x source)
Example with all options:
gpt-4.1-nano|https://api.openai.com/v1/chat/completions|nullkey|500|retry1|cache=auto|smallmodel=1|checkhallucination=1 -
API Key: Enter your API key if needed. If your endpoint does not require a key, verify with a blank field; the installer will inject
nullkeyonly after a successful empty-key test.You can test your API key using keytest.obanarchy.org to ensure it is valid.
-
Set the Source and Target Languages: Configure the source and target languages as required.
Use the format:
ModelName|API Base URL|nullkey (optional)|delay_ms (optional)|retryN (optional)|cache=auto/off (optional)|smallmodel=0/1 (optional)|checkhallucination=0/1 (optional)
Here is a list of supported models:
OpenAI GPT-5: gpt-5|https://api.openai.com/v1/chat/completions
OpenAI GPT-5 Mini: gpt-5-mini|https://api.openai.com/v1/chat/completions
OpenAI GPT-5 Nano: gpt-5-nano|https://api.openai.com/v1/chat/completions
OpenAI GPT-4.1: gpt-4.1|https://api.openai.com/v1/chat/completions
OpenAI GPT-4.1 Mini: gpt-4.1-mini|https://api.openai.com/v1/chat/completions
Gemini Flash: gemini-3-flash-preview|https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
OpenAI GPT-5: gpt-5|https://api.openai.com/v1/chat/completions
OpenAI GPT-5 Mini: gpt-5-mini|https://api.openai.com/v1/chat/completions
OpenAI GPT-5 Nano: gpt-5-nano|https://api.openai.com/v1/chat/completions
OpenAI GPT-4.1: gpt-4.1|https://api.openai.com/v1/chat/completions
OpenAI GPT-4.1 Mini: gpt-4.1-mini|https://api.openai.com/v1/chat/completions
Gemini Flash: gemini-3-flash-preview|https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
Deepseek: deepseek-chat|https://api.deepseek.com/v1/chat/completions
Tongyi Qianwen: qwen-plus|https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
SiliconFlow: siliconflow-chat|https://api.siliconflow.cn/v1/chat/completions
ERNIE Bot (Wenxin Yiyan): ernie-4.0-turbo-8k|https://qianfan.baidubce.com/v2/chat/completions
Gemini: gemini-2.0-flash|https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
ChatGLM: chatglm-6b|https://api.chatglm.cn/v1/chat/completions
LLaMA: llama-13b|https://api.llama.ai/v1/chat/completions
Code LLaMA: code-llama-34b|https://api.llama.ai/v1/code/completions
OpenAI GPT-4o: gpt-4o|https://api.openai.com/v1/chat/completions
OpenAI GPT-4 Turbo: gpt-4-turbo|https://api.openai.com/v1/chat/completions
OpenAI GPT-3.5 Turbo: gpt-3.5-turbo|https://api.openai.com/v1/chat/completions
Claude 3 Sonnet: claude-3-sonnet-20240229|https://api.anthropic.com/v1/messages
Mistral Large: mistral-large|https://api.mistral.ai/v1/chat/completions
Groq Llama 3: llama3-70b-8192|https://api.groq.com/openai/v1/chat/completions
Perplexity Sonar Large: pplx-70b-online|https://api.perplexity.ai/chat/completions
Fireworks Mixtral: accounts/fireworks/models/mixtral-8x7b-instruct|https://api.fireworks.ai/inference/v1/chat/completions
Moonshot v1: moonshot-v1-128k|https://api.moonshot.cn/v1/chat/completions
Yi 34B Chat: yi-34b-chat|https://api.lingyi.ai/v1/chat/completions
Local Deployment (no API key): model-name|http://127.0.0.1:PORT/v1/chat/completions|nullkey
Model names in the installer are shown in your chosen language whenever possible.
You can expand or replace these with any OpenAI-compatible model that supports the chat/completions endpoint.
PotPlayer_ChatGPT_Translate is a PotPlayer plugin that integrates the ChatGPT API to deliver real-time, context-aware subtitle translation. Unlike traditional translation tools, this plugin considers context, idioms, and cultural nuances to produce more accurate translations. The core of the project is implemented using AngleScript, leveraging both the ChatGPT API and PotPlayer API for deep integration.
One key advantage of using ChatGPT for subtitle translation is its ability to understand context and cultural references. Compare the following results:
-
Original subtitle:
"You're gonna old yeller my f**king universe."
-
Google Translate Result:
-
ChatGPT Translation Result:
"你要像《老黄犬》一样对待我的宇宙?"
(Correctly captures the reference and intended meaning)
-
Original Subtitle:
"But being one in real life is even better."
-
ChatGPT Translation (Without Context):
"但是,在现实生活中成为一个人甚至更好。"
(Literal translation, failing to capture the implied meaning) -
ChatGPT Translation (With Context):
"但在现实生活中成为一个反派更好。"
(Accurately capturing the intended context)
Click below to watch the tutorial on Bilibili:
🛠️ Logic Flowchart / 逻辑流程图
graph TD
%% --- Initialization Phase ---
Start([Start: Translate]) --> InitConfig[Load Config & Token Rules]
InitConfig --> CheckAuth{API Key Configured?}
CheckAuth -- No --> RetError([Return Error Message])
CheckAuth -- Yes --> UpdateHist[Update Subtitle History]
%% --- Context Management ---
UpdateHist --> ContextMode{Plugin Variant?}
subgraph ContextLogic [Context Processing]
direction TB
ContextMode -- "Without Context" --> NoContextPrompt[No Context]
ContextMode -- "With Context" --> CalcBudget[Calculate Token Budget]
CalcBudget --> TrimHist[Trim History\n(Drop Oldest / Smart Trim)]
TrimHist --> BuildBlock[Build Context Block]
end
%% --- Prompt Engineering ---
subgraph PromptEng [Prompt Construction]
direction TB
BuildBlock --> SmallModel{Small Model Mode?}
NoContextPrompt --> SmallModel
SmallModel -- Yes --> StrictPrompt[System: Identity + Context + Instruction\nUser: Subtitle Text Only]
SmallModel -- No --> StdPrompt[System: Identity + Context\nUser: Instruction + Subtitle Text]
StrictPrompt --> EscapeJSON[JSON Escape Strings]
StdPrompt --> EscapeJSON
EscapeJSON --> BuildPayload[Build JSON Payload]
end
BuildPayload --> InitLoop[Init Retry Counter = 0]
%% --- Unified Execution Loop ---
subgraph RetrySystem [Unified Execution & Retry Loop]
direction TB
LoopCond{Attempts <= Max?}
LoopCond -- No --> FailFinal([Return Failure Message])
LoopCond -- Yes --> DelayCheck{Is Retry?}
DelayCheck -- Yes --> Wait[Sleep Configured Delay]
DelayCheck -- No --> CacheBranch
Wait --> CacheBranch
%% Cache Branch
CacheBranch{Cache Mode Enabled?}
CacheBranch -- Yes --> ReqCache[POST /responses]
CacheBranch -- No --> ReqChat
ReqCache --> RespCache{Response OK?}
RespCache -- Yes --> ParseCache[Extract 'output_text']
RespCache -- No --> LogCacheFail[Log Failure] --> ReqChat[POST /chat/completions]
ParseCache --> HallucinationCheck
%% Standard Chat Branch
ReqChat --> NetCheck{Network OK?}
NetCheck -- No --> IncRetry[Attempts++] --> LoopCond
NetCheck -- Yes --> ParseJSON{Valid JSON?}
ParseJSON -- No --> IncRetry
ParseJSON -- Error --> LogAPIError[Log API Error] --> IncRetry
ParseJSON -- Success --> ExtractContent[Extract Content]
ExtractContent --> HallucinationCheck{Hallucination Check?}
HallucinationCheck -- "Length > 5x Source" --> LogHallu[Log Warning: Hallucination] --> IncRetry
HallucinationCheck -- OK --> SuccessBreak[Break Loop]
end
%% --- Post Processing ---
SuccessBreak --> PostProc[Post-Processing]
PostProc --> FixNewlines[Trim Trailing Newlines\n(Gemini Fix)]
FixNewlines --> FixRTL[Insert Unicode RLE\n(Arabic/Hebrew Fix)]
FixRTL --> ReturnSuccess([Return Translation])
- AngleScript – The scripting language used to develop the plugin
- ChatGPT API – Provides context-aware translation capabilities
- PotPlayer API – Enables seamless integration with PotPlayer
When playing a video with subtitles in PotPlayer, the plugin automatically calls the ChatGPT API to translate the subtitles in real time. By handling context, idioms, and cultural nuances, the plugin provides more accurate translations.
For example:
- Input: "You're gonna old yeller my f**king universe."
- Traditional Translation Tools might output a literal or awkward translation.
- ChatGPT Translation captures the movie reference and context to deliver a more appropriate translation.
- Integrate ChatGPT API with PotPlayer API for real-time subtitle translation.
- Support additional AI models (planned for the future, not imminent).
- Optimize context handling to further improve translation accuracy.
Contributions are welcome! When submitting a pull request, please clearly describe the purpose of your changes. If you have suggestions for improvements or bug fixes, feel free to open an issue before making modifications.
Distributed under the GPLv3 License. See LICENSE for more information.
Personal website: obanarchy.org
- Thanks to OpenAI for providing the powerful ChatGPT API.
- Thanks to the PotPlayer team for creating an excellent media player.
- Thanks to everyone who has contributed suggestions or code to improve this project (contributor details will be updated here).

