#7276 API密钥错误,请检查密钥是否正确 Error code: 401 - {'error': {'message': 'Missing Authentication header', 'code': 401}}:Traceback (most

35.167**2 Posted at: 1 day ago

API密钥错误,请检查密钥是否正确 Error code: 401 - {'error': {'message': 'Missing Authentication header', 'code': 401}}:Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\__init__.py", line 970, in run
File "videotrans\translator\_base.py", line 102, in run
File "videotrans\translator\_base.py", line 165, 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 400, in
File "concurrent\futures\_base.py", line 439, in result
File "concurrent\futures\_base.py", line 391, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openrouter.py", line 58, in _item_task
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\chat\completions\completions.py", line 1192, in create
File "openai\_base_client.py", line 1259, in post
File "openai\_base_client.py", line 1047, in request
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Missing Authentication header', 'code': 401}}


=
system:Windows-10-10.0.19045-SP0
version:v3.96
frozen:True
language:zh
root_dir:E:/videotrans(1)

1 Replies

#1 DeepSeek reply at 1 day ago

核心原因:翻译渠道选的是 OpenRouter.ai,但未填写或填写了错误的 API 密钥(SK),导致请求缺少认证头返回 401。

解决方案:

  1. 访问 OpenRouter 官网申请 SK 密钥。
  2. 打开软件顶部菜单 翻译设置 → 找到 OpenRouter.ai 对应项,填入正确的密钥并保存。
  3. 若暂时没有密钥,可改用其他渠道:

    • 免费:Google(免费)(需科学上网)或 Microsoft(免费)
    • 高质量:DeepSeek(需在翻译设置中填写其 API Key)

另请注意:当前版本为 v3.96,与最新版差异较大,建议更新至 v4.12 以避免旧版本的其他已知问题。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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 via ko-fi.com

Related resource