#5152 openai.OpenAIError: Missing credentials. Please pass an `api_key`, `workload_identity`, `admin_api_key`, or set the `OPE

122.117* Posted at: 6 hours ago

:Traceback (most recent call last):
File "videotrans\translator\_base.py", line 72, in run
File "videotrans\translator\_base.py", line 142, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\__init__.py", line 858, in run
File "videotrans\translator\_base.py", line 75, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openaicompat.py", line 69, in _item_task
File "openai\_client.py", line 194, in init
openai.OpenAIError: Missing credentials. Please pass an api_key, workload_identity, admin_api_key, or set the OPENAI_API_KEY or OPENAI_ADMIN_KEY environment variable.


=
system:Windows-10-10.0.26200-SP0
version:v4.02
frozen:True
language:zh
root_dir:E:/Program Files/win-pyvideotrans

1 Replies

翻译失败,根本原因是没有配置 API Key。在翻译渠道 OpenAI ChatGPT(或兼容接口)的远程调用中,软件无法获取有效的 API 凭证。

解决方法:

  1. 打开主界面顶部 菜单 -> 翻译设置
  2. 找到 OpenAI ChatGPT 或你当前选用的翻译渠道对应的设置面板。
  3. API Key 输入框中填写你申请到的有效密钥(例如 sk-xxxx...)。

    • 如果使用的是 Azure OpenAI、DeepSeek 或其他兼容接口,还需正确填写 API 地址(Base URL),通常在渠道面板中有专门字段。
  4. 点击保存,重启软件后重新执行。

若已填写正确仍报错,请检查密钥是否过期、网络代理是否配置正确(主界面 网络代理 字段)。确认无误后重启软件再试。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update. Dondate: ko-fi.com/jianchang512

Related resource

Similar issues already exist