How to Install and Use CodeGPT in VS Code (Guide)

One of the many ways AI is changing the world is through intelligent code completion and natural language-to-code translation. In this area, OpenAI has been at the forefront with its Codex GPT-3 series model and the latest GPT-4 model. So if you want to use ChatGPT in Visual Studio Code yourself, follow this tutorial to learn more about CodeGPT. It’s an AI assistant that lives in VS Code, and you can chat with it, use it to find errors in code, debug code, and more. Not only that, but with a simple comment you can ask CodeGPT to generate code in any language you want. Aside from that, you can ask it to explain a code snippet, refactor it, write documentation, and more. With all of that out of the way, let’s learn how to install and use CodeGPT in VS Code.

Install the CodeGPT extension in VS Code (2023)

In this article, we’ve included steps to install and use CodeGPT in VS Code. Apart from that, we also explained how to use the latest ChatGPT alternative for coding – GitHub Copilot X – in your IDE like VS Code. You can expand the table below and go to the section you want.

How to set up CodeGPT in VS Code

Several extensions in VS Code aim to deliver the best integration with ChatGPT, but CodeGPT by Daniel San (Visit) is possibly the best out there. It is deeply integrated with VS Code and supports a variety of features. You can chat with CodeGPT, generate code with a comment, explain and ask questions about selected code, search for queries on StackOverflow, refactor the code, and more.

Read  You Should Know Your Blood Type. Here's Here's How to Figure It Out

The best part is that you don’t have to pay anything extra to renew. However, you must have enough credits to use the OpenAI API. You can also use the latest GPT-4 model, but you must have access to the GPT-4 API. With that said, let’s get started.

1. Open Visual Studio Code and go to the Extensions menu in the left pane. Here search for “codegpt” and select “Code GPT‘ from the search results. You can also Click here to open the CodeGPT extension directly in VS Code.

2. Then click on “To install”, and Code GPT will be added to VS Code in a few seconds.

3. After installation, just use the “Ctrl + Shift + P” shortcut, and it opens the command bar. Here, type “codegpt” and then open “Set API KEY”.

4. It will now ask for yours OpenAI API key.

5. To get OpenAI API key, go to and click “Create a new secret key“. Now copy the API key.

note: You can only see the API key when you generate it and you can’t view or copy it later. So we strongly recommend you to copy and paste the API key immediately.

6. Well, Paste the API key in Visual Studio Code and press Enter. You’re almost done.

How to use CodeGPT in VS Code

Once you have successfully passed the API key to the CodeGPT extension in VS Code, you can use it. Here are the different use cases where this ChatGPT encoding extension will come in handy:

Read  How to build a feature story

1. To easily generate code Add a comment for the task you want to do and press “Ctrl + Shift + I” keys at the same time.

2. This will generate the code on the right. Then you can Copy and paste the code to your main block.

3. Also, you can select a code, right click on it and Ask CodeGPT to explain the coderefactor, find problems, debug and more.

4. When opening the code for the custom ChatGPT-based AI bot that we taught you in a recent guide, we highlighted part of the text. Here is a Explanation of our code by CodeGPT.

5. You can also open the extension directly from the left sidebar and Chat with CodeGPT if you have further questions.

6. Finally too Customize CodeGPT, click the icon in the left side panel and open Settings. Then you can choose your OpenAI model, maximum tokens for each request, temperature, language and more.

How to install GitHub Copilot in VS Code

GitHub recently announced its Copilot X initiative, which brings the tremendous power of OpenAI models, including Codex and GPT-4. If you’re looking for something more streamlined, GitHub Copilot has you covered 10 dollars a month or $100 per year. You also get a 2-month free trial if you go for the annual plan.

With GitHub Copilot X you can Chat with the AI, ask it to write code, debug the code, explain snippets, get answers from the documentation, and more. Also, the best part is that GitHub Copilot is not only limited to Visual Studio Code but also supports other IDEs like JetBrains, Neovim and Visual Studio. Not to mention, it supports over a dozen programming languages ​​including Python, JavaScript, Go, TypeScript, Ruby, and more. Follow the instructions below to use GitHub Copilot in VS Code, which uses the GPT-4 model for code completion and suggestions.

Read  Diwali 101: how to celebrate the festival of lights

1. Open VS Code and go to the “Extensions” menu on the left sidebar. Here search for “copilot” and install “GitHub copilot“.

2. Then click on “Sign in to GitHub” in the right bottom corner.

3. Now login to your GitHub account and Choose your plan. As shown in the screenshot, you can try this extension for 60 days before you decide to pay for the service.

4. After that you can Access GitHub Copilot in your IDE with contextual suggestions, pull request support, PR description, CLI support and more.

ChatGPT powered AI assistant in Visual Studio Code

So, here’s how you can install and use the CodeGPT extension in VS Code and boost your productivity by leaps and bounds. According to a recent study, AI assisting in programming can help developers maximize their productivity by asking AI to perform repetitive tasks. It also allows the developer to focus on more meaningful work. However, if you are intrigued by the new OpenAI model and want to use ChatGPT-4 for free, follow our article for some amazing resources. And if you want to run a ChatGPT-like LLM completely offline on your PC, check out our in-depth tutorial. If you have any questions, let us know in the comment section below.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button