This is an extension to quickly query OpenAI's Codex, an AI code assistant similar to ChatGPT, from VS Code.
Note
Temporarily, the extension is using Codex, a similar model by OpenAI, instead of ChatGPT, since ChatGPT is near impossible to automate at this time.
Use the "ChatGPT: Ask why code isn't working" command in the Command Palette:
- Select the code you want to ask about. If you want to ask about the whole file, do not select any text.
- Press
Ctrl+Shift+Pto open the Command Palette. - Begin typing
ChatGPT: Ask why code isn't working, and select it when it appears. - Wait for the response. It will appear in a new tab.
Use the "ChatGPT: Ask to explain code" command in the Command Palette:
- Select the code you want to ask about. If you want to ask about the whole file, do not select any text.
- Press
Ctrl+Shift+Pto open the Command Palette. - Begin typing
ChatGPT: Ask to explain code, and select it when it appears. - Wait for the response. It will appear in a new tab.
Use the "ChatGPT: Ask a question" command in the Command Palette:
- Press
Ctrl+Shift+Pto open the Command Palette. - Begin typing
ChatGPT: Ask a question, and select it when it appears. - Enter the question you'd like to ask.
- Wait for the response. It will appear in a new tab.
When you first query Codex, you will be prompted to enter an OpenAI API key. This is used by the extension to access the API and is only sent to OpenAI. Codex is currently free, so does not use up any credits on your account.
To find your OpenAI API key:
- Go to https://beta.openai.com/account/api-keys. You will need to log in (or sign up) to your OpenAI account.
- Click "Create new secret key", and copy it.
- You should then paste it into VS Code when prompted.
In order to change the message sent to the AI that comes before your code, when running the Ask ChatGPT about your code, follow these instructions:
Ctrl+,to open Preferences.- Search for
chatgpt. - Change the
chatgpt.queryTextsetting to whatever you want.
None