ChatGPT conversations in Visual Studio Code
- Zero-Config Autologin lets the extension grab the required tokens automatically using
puppeteer
. - 2 options to run ChatGPT assistant in your vs-code:
- Enable Autologin setting from vs-code settings page and let the extension log you in and grab required tokens. Described in Autologin Setup
- Manually login on a browser and grab required tokens for logging in. Described in Manual Setup
- 🤖 Zero-Config. Automatically logs you in and grabs the required tokens on your behalf.
- ➡️ Export all your conversation history at once in Markdown format.
- 🔃 Option to clear and restart the conversation with ChatGPT.
- 🍻 Optimized for dialogue! Have a conversation with ChatGPT with follow-ups.
- 💯 Get help from ChatGPT within vs-code for implementing test cases, explaining it or finding bugs.
- 📝 Create projects/files with one click using built-in actions in the conversation view.
- ⚡ Built-in syntax highlighting for ChatGPT suggested code using the default code-font of your Visual Studio Code!
- 🖼️ Icon is generated by dall-e-2.
The extension comes with context menu commands, copy/move suggested code into editor with one-click, conversation window and customization options for OpenAI's ChatGPT prompts.
Ask free-form text questions that will be listed in the conversation window. The conversation is kept in cache until vs-code instance is closed.
ChatGPT: Add Tests
: Write tests for you. Right click on a selected block of code, run command.- "default": "Implement tests for the following code",
- "description": "The prompt prefix used for adding tests for the selected code"
ChatGPT: Find bugs
: Analyze and find bugs in your code. Right click on a selected block of code, run command.- "default": "Find problems with the following code",
- "description": "The prompt prefix used for finding problems for the selected code"
ChatGPT: Optimize
: Add suggestions to your code to improve. Right click on a selected block of code, run command.- "default": "Optimize the following code",
- "description": "The prompt prefix used for optimizing the selected code"
ChatGPT: Explain
: Explain the selected code. Right click on a selected block of code, run command.- "default": "Explain the following code",
- "description": "The prompt prefix used for explaining the selected code"
ChatGPT: Ask anything
: Free-form text questions within conversation window.ChatGPT: Clear session
: Clears the current session. Useful in case of API errors.ChatGPT: Clear conversation
: Clears the conversation window and resets the thread to start a new conversation with ChatGPTChatGPT: Export conversation
: Exports the whole conversation in Markdown for you to easily store and find the Q&A list.
- Opt-in to use automation to authenticate OpenAI.
- You can configure the commands to use any prompts for the selected code!
- Opt-in to receive notification when ChatGPT sends you a message!
This option helps you grab the required tokens automatically, without needing to copy/paste tokens around 🚀.
-
Make sure autologin setting is set to
true
(Default istrue
) -
Once you ask ChatGPT something, unless you already configured authentication, it'll open a
Chrome
window. -
Login to OpenAI as usual and solve captchas when prompted.
-
The
Chrome
page will be closed automatically once we grab the required tokens.
NOTE: The default path will be used for Chrome on your operating system. You have the option to override it in the settings (If you override, make sure to escape \\
instead of \
)
-
For reference here are the defaults:
- Windows:
C:\Program Files\Google\Chrome\Application\chrome.exe
- MAC:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
- Linux:
/usr/bin/google-chrome
- Windows:
- Go to https://chat.openai.com and log in.
- Open your browser's developer tools
- Hit F12 to open the developer tools in most browsers
- Alternatively, right click on the browser window and select
Inspect
- Go to
Application
->Cookies
->https://chat.openai.com
. You will need the following cookies:__Secure-next-auth.session-token
: The extension will use this to send prompts to ChatGPTcf_clearance
: CloudFlare clearance token. A security measure OpenAI put in place to block automated access.
- Go to
Console
and type in the following code to get youruser-agent
navigator.userAgent
: This is your browser's user-agent, needed for CloudFlare clearance. Enter the value ofuserAgent
when prompted by the extension. Copy its value without single or double quotes.
- Now that you have all required session variables, run any command using the extension and you'll be asked to enter these values:
__Secure-next-auth.session-token
: An encoded token starting withey***
cf_clearance
: An alpha-numeric tokenuserAgent
- If the bot isn't responding, try clearing your cache by running the
ChatGPT: Clear session
command. - It's possible that openai systems may experience issues responding to your queries due to high-traffic from time to time.
- If you get
ChatGPTAPI error 429
, it means that you are making Too Many Requests. Please wait and try again in a few moments. If it persists, restart your vs-code. - If you see
ChatGPTAPI error terminated
, your requests are being throttled. Please try again later.
- 💻 Open AI ChatGPT: https://chat.openai.com/
- 🖼️ Open AI Dall-E-2: https://openai.com/dall-e-2/
- 🧪 This extension uses unofficial OpenAI APIs. https://github.com/transitive-bullshit/chatgpt-api