Become a Code Ninja with CodeGPT VSCode Extension

Madhu Kumar - Jan 26 '23 - - Dev Community

Image description

Code GPT is a powerful and versatile extension for Visual Studio Code (VSCode) that allows developers to generate code snippets and complete blocks of code using the GPT-3 natural language processing model. This extension is incredibly helpful for developers who are working on complex projects, as it allows them to quickly generate code snippets that are tailored to their specific needs.

Important!​
The CodeGPT extension is FREE but the APIs of artificial intelligence provider OpenAI API that it consumes is a paid service. You get $18 free credit as part of free trial usage.

About OpenAI API​

To use this extension, you must have credits loaded into your OpenAI account. This extension uses the Official OpenAI API, which is a paid API.

Prices can be found at this link: https://openai.com/api/pricing/

If you do not have credits, the extension will show the following OpenAI API error: You exceeded your current quota, please check your plan and billing details

To review your account and the credits you have available, you must log in with your account at https://openai.com/api

In the menu select Manage Account, then in the Usage section, you will be able to see the amount of credits available and used.

Image description

In this image you can see that $0.05 USD has been used out of $18 as part of free trial usage.

Image description

Installation

Install Visual Studio Code: Visual Studio Code: https://code.visualstudio.com/download

Download and install the Code GPT Extension from the below link, or search in the Extensions tab in VSCode: https://marketplace.visualstudio.com/items?itemName=DanielSanMedium.dscodegpt

Open VSCode and go to the Extensions tab
The first step in adding Code GPT to VSCode is to open the code editor and go to the Extensions tab. This tab can be accessed by clicking on the Extensions icon on the left sidebar or by pressing the keyboard shortcut Ctrl+Shift+X.

Search for Code GPT
Once you are in the Extensions tab, use the search bar to search for Code GPT. You should see the extension listed in the search results.

Image description

Install Code GPT
Once you have located the Code GPT extension, click on the Install button to begin the installation process. The installation process may take a few seconds, depending on your internet connection.

Image description

Get your API key​ from OpenAI​:

  1. Create an account in openai.com
  2. Go to View API Keys
  3. Create a new Secret Key​

Image description

Use your API KEY​
Press cmd + shift + p and search for CodeGPT: Set API KEY

Copy the secret key and press enter

Image description

To Remove your API KEY (not required now)​
If you want to remove your API Key to add a new one, press cmd + shift + p and search for CodeGPT: Remove API KEY

Start using Code GPT

Once you have configured the extension, you can start using Code GPT to generate code snippets and complete blocks of code. To do this, simply type in a natural language description of the code you want to generate and press the Code GPT icon in the status bar. The extension will then generate the code snippet or block of code that matches your description.

Get code from comments
Write a comment asking for a specific code
Press cmd + shift + i
Use the code 😎

Image description

Create a README.md with Ask CodeGPT

Image description

Conclusion

In conclusion, adding Code GPT as an extension to VSCode is a simple and straightforward process that can greatly enhance your coding experience. With the ability to generate code snippets and complete blocks of code using natural language, this extension can save you time and effort while working on complex projects. Give it a try and see how it can help you in your coding journey!

To start with ChatGPT directly from the browser, register and start here (currently free with limitations): https://chat.openai.com/chat

Read more about ChatGPT in this blog: https://dev.to/aws-heroes/chatgpt-the-power-and-pitfalls-of-a-leading-language-model-3n39

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player