openai-java
openai-java copied to clipboard
connect exception
How can i fix this issue?
''' Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Failed to connect to api.openai.com/2001:0:0:0:0:0:480e:cf5f:443 at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:45) at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:90) at io.reactivex.Single.blockingGet(Single.java:2002) at com.theokanning.openai.service.OpenAiService.execute(OpenAiService.java:217) at com.theokanning.openai.service.OpenAiService.createCompletion(OpenAiService.java:88) at example.OpenAiApiExample.main(OpenAiApiExample.java:20)
'''
computer:Apple M1 system: Mac OS IDE:IntelliJ IDEA 2022.2.1 (Community Edition)
Thanks!
This is the IP I get:
PS F:\workspace\openai-java> nslookup api.openai.com
Server: dns-cac-lb-01.rr.com
Address: 2001:1998:f00:1::1
Non-authoritative answer:
Name: api.openai.com
Address: 52.152.96.252
@cryptoapebot 😄 Thanks for your reply. The sample project is work now. Due to the API not being open to China, my solution was to set the proxy to global mode.
my solution was to set the proxy to global mode.
@amszsthl ,Should you please tell me the detail of set the proxy to global mode? I faced up the same problems.Thanks in advance.