jcrodriguez1989 / chatgpt

Interface to ChatGPT from R
GNU General Public License v3.0
312 stars 37 forks source link

Hi @guoliangzeng ,I am trying to use this code but I get this error Downloading GitHub repo jcrodriguez1989/chatgpt@feature.jcr.switch_api_url Error in utils::download.file(url, path, method = method, quiet = quiet, : cannot open URL 'https://api.github.com/repos/jcrodriguez1989/chatgpt/tarball/feature.jcr.switch_api_url' any Idea what i can do? #55

Closed IvanKrSt closed 1 month ago

IvanKrSt commented 6 months ago
          Hi @guoliangzeng ,

I created a branch that allows changing the OPENAI's API URL. Could you try doing this? Fully restart your R session, and then:

remotes::install_github("jcrodriguez1989/chatgpt@feature.jcr.switch_api_url")
Sys.setenv(OPENAI_API_URL = "https://api.chatanywhere.com.cn/v1")
# If this doesn't work, do `Sys.setenv(OPENAI_API_URL = "https://api.chatanywhere.com.cn")`
library("chatgpt")
cat(ask_chatgpt("What do you think about R language?"))

Please, let me know if you get any errors.

Originally posted by @jcrodriguez1989 in https://github.com/jcrodriguez1989/chatgpt/issues/48#issuecomment-1803387938

jcrodriguez1989 commented 1 month ago

This can be done with the current develop version (remotes::install_github("jcrodriguez1989/chatgpt")).