#8945 自定义TTS API: {"error":{"message":"API key required. Pass it as \"Authorization: Bearer \", \"X-API-Key: \&

67.21**6 Posted at: 42 minutes ago

自定义TTS API: {"error":{"message":"API key required. Pass it as \"Authorization: Bearer \", \"X-API-Key: \", or — from Vapi, whose config cannot set either — the assistant's server.secret, which arrives as \"X-VAPI-SECRET\".","type":"authentication_error","param":null,"code":null}}
{'text': '你好啊,我亲爱的朋友,希望你的每一天都是美好愉快的!', 'role': 'Kim Chi', 'filename': 'F:/创业/win-pyvideotrans-v4.19/tmp/1904/1795529521.5656404-ttsapi.wav', 'tts_type': 36}
Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 23, in run
File "videotrans\tts\__init__.py", line 154, in run
File "videotrans\tts\_base.py", line 98, in run
File "videotrans\tts\_base.py", line 201, in _exec
File "videotrans\tts\_base.py", line 161, in _local_mul_thread
File "videotrans\tts\_base.py", line 216, in _item_task
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 451, in result
File "concurrent\futures\_base.py", line 403, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\tts\_ttsapi.py", line 77, in _run
videotrans.configure.excepts.StopTask: {"error":{"message":"API key required. Pass it as \"Authorization: Bearer \", \"X-API-Key: \", or — from Vapi, whose config cannot set either — the assistant's server.secret, which arrives as \"X-VAPI-SECRET\".","type":"authentication_error","param":null,"code":null}}


=
system:Windows-10-10.0.19044-SP0
version:v4.19
frozen:True
language:zh_CN
root_dir:F:/创业/win-pyvideotrans-v4.19

1 Replies

#1 DeepSeek reply at 42 minutes ago

这是服务端返回的认证失败(authentication_error):请求未携带有效的 API Key(缺少 Authorization: Bearer 或 X-API-Key 头),并非软件内部故障。同时从报错内容看,你填入的是某个现成的第三方语音接口(返回信息里含 Vapi 相关字段),这类接口有固定的鉴权方式与返回格式,直接填入「自定义TTS API」渠道大概率无法对接,因为软件是按自定义渠道要求的固定请求/返回格式去调用的。

排查与处理步骤:

  1. 确认鉴权:该接口要求 Authorization: Bearer 或 X-API-Key: 。检查你是否在设置中正确填入了 key,以及地址是否指向需要鉴权的接口路径。
  2. 确认渠道选型:

    • 若该第三方接口兼容 OpenAI TTS 格式,应改用软件自带的 OpenAI/Azure 等对应渠道,并在其设置页填写 API 地址、Key 和模型名,而不要用「自定义TTS API」。
    • 若是自建或自己的中转服务,则必须按软件要求的请求参数与返回数据格式实现,不是你现成接口直接填地址就能用。
  3. 若你的服务是本地部署且不需要鉴权,请在其侧关闭鉴权或允许空 key,否则软件请求仍会被拒。
  4. 单独测试:先用 curl/PowerShell 直接请求该地址,带上 key,确认能返回音频字节流,再回到软件测试。

补充:如仍失败,请说明该接口的提供方、你的自建服务请求格式,或提供软件目录下 logs/ 中最新的日志文件底部约30行,以便进一步判断。

请查阅相关文档:

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