#5294 openai.APIConnectionError: Connection error.

120.244* Posted at: 2 days ago

Connection error.:
Traceback (most recent call last):
File "httpx\_transports\default.py", line 101, in map_httpcore_exceptions
File "httpx\_transports\default.py", line 250, in handle_request
File "httpcore\_sync\connection_pool.py", line 216, in handle_request
File "httpcore\_sync\connection_pool.py", line 196, in handle_request
File "httpcore\_sync\connection.py", line 101, in handle_request
File "httpcore\_sync\http11.py", line 143, in handle_request
File "httpcore\_sync\http11.py", line 113, in handle_request
File "httpcore\_sync\http11.py", line 186, in _receive_response_headers
File "httpcore\_sync\http11.py", line 238, in _receive_event
httpcore.RemoteProtocolError: Server disconnected without sending a response.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "openai\_base_client.py", line 1005, in request
File "httpx\_client.py", line 914, in send
File "httpx\_client.py", line 942, in _send_handling_auth
File "httpx\_client.py", line 979, in _send_handling_redirects
File "httpx\_client.py", line 1014, in _send_single_request
File "httpx\_transports\default.py", line 249, in handle_request
File "contextlib.py", line 153, in exit
File "httpx\_transports\default.py", line 118, in map_httpcore_exceptions
httpx.RemoteProtocolError: Server disconnected without sending a response.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "videotrans\util\TestSTT.py", line 17, in run
File "videotrans\recognition\__init__.py", line 250, in run
File "videotrans\recognition\_base.py", line 143, in run
File "videotrans\recognition\_openairecognapi.py", line 33, in _exec
File "videotrans\recognition\_openairecognapi.py", line 114, in _diarize
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\audio\transcriptions.py", line 483, in create
File "openai\_base_client.py", line 1297, in post
File "openai\_base_client.py", line 1037, in request
openai.APIConnectionError: Connection error.


=
system:Windows-10-10.0.26200-SP0
version:v3.99
frozen:True
language:zh
root_dir:E:/A

1 Replies

该错误是由于网络连接中断导致的,核心原因是在中国大陆直接访问 OpenAI 的 API 时被阻断或连接不稳定。

解决方法

  1. 配置网络代理:在软件主界面“翻译视频或音频”第 5 行“网络代理”框中,填写您可用的 HTTP/HTTPS 代理地址,格式如 http://127.0.0.1:7890(根据您的 VPN/代理端口填写)。
  2. 更换 API 地址:如果您使用的是第三方中转 API,请确保在“菜单 → 翻译设置 → OpenAI”中填写了正确的 API Base URL
  3. 检查 API Key 与网络:确认 API Key 有效且账户内有额度,同时检查代理能否正常访问 https://api.openai.com

如果仍无法解决,可切换至其他语音识别渠道(如 faster-whisper(本地)),本地模型无需网络。

请查阅相关文档:

Post Your Reply