Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set the api url? #48

Closed
guoliangzeng opened this issue Nov 2, 2023 · 6 comments
Closed

How to set the api url? #48

guoliangzeng opened this issue Nov 2, 2023 · 6 comments

Comments

@guoliangzeng
Copy link

Excuse me, if using a third-party intermediary service, how should I set up the API URL for chatgpt?

@jcrodriguez1989
Copy link
Owner

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?

@guoliangzeng
Copy link
Author

guoliangzeng commented Nov 3, 2023 via email

@jcrodriguez1989
Copy link
Owner

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,

@guoliangzeng
Copy link
Author

guoliangzeng commented Nov 8, 2023 via email

@jcrodriguez1989
Copy link
Owner

jcrodriguez1989 commented Nov 9, 2023

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.

@guoliangzeng
Copy link
Author

guoliangzeng commented Nov 9, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants