#1358 Subject: 401 Unauthorized Error with edge-tts (free) - API Key Expired?

2806:2f0* Posted at: 1 month ago 👁164

Hello pyvideotrans team,

I am writing to report a critical issue I'm experiencing with the edge-tts (free) service.

When I try to synthesize audio for a translation, the process fails with an HTTP 401 Unauthorized error. It seems to be an authentication failure when connecting to the Microsoft TTS websocket.

Error Log
Here is the exact error message I am receiving in the console:

401, message='Invalid response status', url='wss://api.msedgeservices.com/tts/cognitiveservices/websocket/v1?Ocp-Apim-Subscription-Key=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=f6aa2002a2434fcb9713e68a89a2785a&Sec-MS-GEC=F2BB6D02D5E3A707B75A24545690278ED18B68384311F571725E87787E175B2B&Sec-MS-GEC-Version=1-140.0.3485.14'

version of pyvideotrans v3.83

Thank you for your excellent work on this project!

1 Replies

根据错误信息,这是 Edge-TTS 服务端的问题,与 API Key 无关(Edge-TTS 是免费服务,不需要 API Key)。401 错误通常表示微软服务器暂时拒绝了连接请求。

解决方案:

  1. 降低请求频率(最有效的方法):

    • 在软件菜单栏选择 工具/选项 -> 高级选项
    • 在“配音调整”区域,将“同时配音字幕数”改为 1
    • 将“配音后暂停时间/秒”改为 3-5
  2. 更换配音渠道:

    • 暂时切换到其他可用的 TTS 渠道,如 OpenAI-TTS 或 Azure TTS(这些需要配置 API Key)。
    • 等待几小时或第二天再尝试使用 Edge-TTS,服务可能已恢复正常。
  3. 检查网络连接:

    • 确保你的网络连接稳定,没有防火墙或代理阻止与 api.msedgeservices.com 的连接。

这个错误是间歇性的,通过降低请求频率通常可以解决。

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions