#1118 openai.APIConnectionError: Connection error...

95.164* Posted at: 23 hours ago 👁15

连接API地址失败,请检查网络或代理: 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\http_proxy.py", line 289, in handle_request
File "httpcore\_sync\connection.py", line 99, in handle_request
File "httpcore\_sync\connection.py", line 76, in handle_request
File "httpcore\_sync\connection.py", line 154, in _connect
File "httpcore\_backends\sync.py", line 152, in start_tls
File "contextlib.py", line 153, in exit
File "httpcore\_exceptions.py", line 14, in map_exceptions
httpcore.ConnectError: EOF occurred in violation of protocol (_ssl.c:997)

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

Traceback (most recent call last):
File "openai\_base_client.py", line 982, 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.ConnectError: EOF occurred in violation of protocol (_ssl.c:997)

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

Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 17, in run
File "videotrans\translator\__init__.py", line 865, in run
File "videotrans\translator\_base.py", line 81, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 60, in _item_task
File "openai\_utils\_utils.py", line 287, in wrapper
File "openai\resources\chat\completions\completions.py", line 1150, in create
File "openai\_base_client.py", line 1259, in post
File "openai\_base_client.py", line 1014, in request
openai.APIConnectionError: Connection error.


=
Windows-10-10.0.26200-SP0
version:v3.80
frozen:True
language:zh

1 Replies

这是网络连接问题,无法连接到 OpenAI API 服务器。请按以下步骤排查:

  1. 检查网络连接:确保您的网络可以正常访问 OpenAI 服务。
  2. 设置代理:如果您在中国大陆地区使用,需要在软件的"翻译设置"中配置网络代理。
  3. 验证API配置:确认您的 OpenAI API 密钥和基础URL(如果使用第三方代理)配置正确。
  4. 测试连接:在翻译设置界面点击"测试"按钮,验证API连接是否正常。

如果问题持续存在,请尝试:

  • 更换网络环境
  • 检查防火墙或安全软件设置
  • 确认API服务是否可用

完整的错误日志显示 SSL 连接异常,这通常是网络代理配置问题或网络不稳定导致的。

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