0

I would like to open the editor and be able to use the ChatGPT extension without needing to log in via browser or store the OpenAI api key in a workspace file. Ideally, I would be able to use the environment variable stored in .zshenv.

I know that Visual Studio Code allows for some environment variables to be set but not all via ${ENV_EXAMPLE} but this has not worked for me in the settings.json file:

{
  "chatgpt.response.showNotification": true,
  "chatgpt.gpt3.maxTokens": 2048,
  "chatgpt.gpt3.apiKey": "${OPEN_AI_API_KEY}",
}

Azul
  • 581
  • 4
  • 12

1 Answers1

0

Yes you can store API keys for the ChatGPT extension.

Per the ChatGPT extension documentation here are the steps:

  1. Click Login in your extension.
  2. Once asked provide your API key to the extension.

Ref: marketplace.visualstudio.com/items?itemName=gencay.vscode-chatgpt

Kane Hooper
  • 1,531
  • 1
  • 9
  • 21
  • Hi @Kane Hooper thanks for the comment. Your suggestion adds the api key to the settings file which I check into version control. What I'm trying to do is have the extension read my environment variables which is not being checked into version control. – Azul Feb 19 '23 at 13:59