openai-java
openai-java copied to clipboard
java.net.UnknownHostException: Unable to resolve host "api.openai.com": No address associated with hostname
I was able to run the example code by supplying my own api key, but today, when I tried again. I got this error in android emulator java.net.UnknownHostException: Unable to resolve host "api.openai.com": No address associated with hostname at io.reactivex.Single.blockingGet(Single.java:2002) at com.theokanning.openai.service.OpenAiService.execute(OpenAiService.java:260) at com.theokanning.openai.service.OpenAiService.createCompletion(OpenAiService.java:119)
Assuming you've checked the standard things? https://status.openai.com/
Try a simple CURL get on the model listing w/o to make sure your machine has connectivity.
curl https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"
DNS server provider? What exact model are you using (just the example, correct?)
; <<>> DiG 9.18.4-2ubuntu2.1-Ubuntu <<>> api.openai.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35003
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;api.openai.com. IN A
;; ANSWER SECTION:
api.openai.com. 60 IN A 104.18.6.192
api.openai.com. 60 IN A 104.18.7.192
;; Query time: 370 msec
;; SERVER: 192.168.1.1#53(192.168.1.1) (UDP)
;; WHEN: Sun Jun 18 08:03:29 PDT 2023
;; MSG SIZE rcvd: 75
@rmrobotech were you able to understand the issue? I am getting the same error but curl works as expected...