#3983 RuntimeError: Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key format is incorrect. R

154.85* Posted at: 7 hours ago 👁10

Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key format is incorrect. Request id: 021775655628859d54a2e8b6146550b9b78e5e06cf50b22aea9eb', 'param': '', 'type': 'Unauthorized'}}:Traceback (most recent call last):
File "videotrans\translator\_huoshan.py", line 46, in _item_task
File "openai\resources\responses\responses.py", line 898, in create
File "openai\_base_client.py", line 1297, in post
File "openai\_base_client.py", line 1070, in request
openai.AuthenticationError: Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key format is incorrect. Request id: 021775655628859d54a2e8b6146550b9b78e5e06cf50b22aea9eb', 'param': '', 'type': 'Unauthorized'}}

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 963, in run
File "videotrans\translator\_base.py", line 97, in run
File "videotrans\translator\_base.py", line 161, in _run_srt
File "videotrans\translator\_huoshan.py", line 56, in _item_task
RuntimeError: Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key format is incorrect. Request id: 021775655628859d54a2e8b6146550b9b78e5e06cf50b22aea9eb', 'param': '', 'type': 'Unauthorized'}}


=
system:Windows-10-10.0.26200-SP0
version:v3.98
frozen:True
language:zh
root_dir:C:/Users/DELL/Desktop/win-pyvideotrans-v3.98-329

1 Replies

这是由于配置的字节火山方舟API密钥格式不正确导致的认证失败。

  1. 检查并确保在 菜单 -> 翻译设置 -> 字节火山方舟 面板中填写的 API Key 完全正确,没有多余的空格或字符。
  2. 确认您使用的API密钥来自字节火山方舟平台,并且该密钥具有调用相应模型(如 doubao-1.5-pro-128k)的权限。
  3. 如果确认密钥无误,请尝试在火山引擎控制台重新生成一个新的API密钥并替换。

请查阅相关文档:

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.

Related resource