#9102 阿里百炼API: Incorrect API key provided. For details, see: https://help.aliyun.com/zh/model-studio/error-code#apikey-error,T

118.74**5 Posted at: 7 hours ago

阿里百炼API: Incorrect API key provided. For details, see: https://help.aliyun.com/zh/model-studio/error-code#apikey-error,
Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\_runner.py", line 71, in run
File "videotrans\translator\_base.py", line 79, in run
File "videotrans\translator\_base.py", line 117, in _run_text
File "videotrans\translator\_bailian.py", line 42, in _item_task
File "videotrans\translator\_bailian.py", line 114, in _openai
File "openai\_utils\_utils.py", line 298, in wrapper
File "openai\resources\chat\completions\completions.py", line 1215, in create
File "openai\_base_client.py", line 1332, in post
File "openai\_base_client.py", line 1105, in request
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided. For details, see: https://help.aliyun.com/zh/model-studio/error-code#apikey-error', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}, 'request_id': '3d542c2f-e09c-960f-a9e7-305dfd085219'}


=
system:Windows-10-10.0.26200-SP0
version:v4.20
frozen:True
language:zh_CN
root_dir:D:/AI/win-pyvideotrans-v4.20

1 Replies

#1 DeepSeek reply at 7 hours ago

这是 API Key 本身无效或未正确填入「阿里百炼」设置项导致的鉴权失败(HTTP 401 invalid_api_key),并非软件 bug。

排查与解决步骤:

  1. 删掉重新粘贴 Key:进入 菜单 → 翻译设置 → 阿里百炼,把现有密钥清空,重新从阿里云百炼控制台「API-KEY 管理」复制后粘贴。常见问题是复制时带入了首尾空格、换行、引号,或复制了不完整的片段。
  2. 确认 Key 来源正确:必须是阿里云百炼(模型工作室)控制台生成的 API Key。若你申请的是 DashScope 国际站、或其他阿里云产品的 AccessKey(AK/SK),二者不通用,会直接返回 401。
  3. 确认账号状态:登录百炼控制台,确认已开通「模型服务」且账户未欠费、未超额度、Key 未被停用或删除(重建过一次 Key 后旧 Key 会立即失效)。
  4. 确认只填在一处:阿里百炼的 Key 只能填在 菜单 → 翻译设置 → 阿里百炼 面板中,不要填到 OpenAI / OpenAI兼容 / 硅基流动等其他渠道的面板里,也不要填写到 API 地址栏。
  5. 检查代理:国内 API 默认不走代理,但若你能确定代理已开启且配置异常,可尝试清空主界面右侧「网络代理」文本框后再试(本地代理改写请求可能导致鉴权头丢失)。
  6. 模型选择匹配:Key 验证通过后若仍报 url error, please check url!,说明所选模型与任务不匹配——字幕翻译必须选纯文本模型(qwen-plus/qwen-max 等),不能选 qwen-asr 开头的语音识别模型或多模态模型。

若以上均确认无误仍报 401,请提供该 Key 在阿里云百炼控制台中的状态截图,或改用 DeepSeek 翻译渠道(效果更好、成本极低)作为替代。

请查阅相关文档:

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