jcrodriguez1989 / chatgpt

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

Error: "`OPENAI_API_KEY` not provided." #41

Closed Beliavsky closed 1 year ago

Beliavsky commented 1 year ago

In Rgui on Windows, I get

ask_chatgpt("How many hours are there in a day?") Error in gpt_get_completions(question, messages = chat_session_messages) : OPENAI_API_KEY not provided.

How do I provide OPENAI_API_KEY?

jcrodriguez1989 commented 1 year ago

Hi @Beliavsky , it is explained in the README, you can check it out here https://github.com/jcrodriguez1989/chatgpt#requirements TL;DR, once you have your OpenAI API key, you do Sys.setenv(OPENAI_API_KEY = "sk-...") before running any chatgpt function.