Adding ChatGPT to RStudio


Burak Demirtas


March 28, 2023

If you are a RStudio user and if you are using Chat GPT, why not merge them in the same place? You can do it by an addin published on github. But first, you need to get a Chat GPT account and token.

Step 1 - Getting Chat GPT Account and Token

  1. Follow this link and create an account.

  1. Go to this link and login to your account.
  2. After you login, click on view API Keys as shown below.

  1. Click on create secret key.

  1. Save the key to a text file or somewhere you think is safe. Then you are done with this step.

Step 2 - Installing the Add-in

  1. Go to Rstudio console and copy and run the code below.

  2. Replace the text below with your new API key and run this code in your console.

    Sys.setenv(OPENAI_API_KEY = "Copy your API KEY here!")
  1. Done! Now you can use Chat GPT inside your RStudio! Just go to add-ins and try it out! (And please to put at least a thumbs up on the comments. 😋👍)