How to set the api url?
guoliangzeng opened this issue · 6 comments
Excuse me, if using a third-party intermediary service, how should I set up the API URL for chatgpt?
Hi @guoliangzeng , I don't get the question.
Instead of using https://api.openai.com/v1/chat/completions
you need to use another URL?
If so, every endpoint works exactly the same?
Ok, sounds like we can workaround it.
This is the current URL we are using in this package https://api.openai.com/v1/chat/completions
. May I know which will be the similar URL that we should point to?
Or at least, let me know which part of https://api.openai.com/v1/chat/completions
should be replaceable.
best,
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.