ChatGPT inside VSCode with the official OpenAI API

Daniel Avila
LatinXinAI
Published in
5 min readDec 29, 2022

This extension lets you connect AI providers inside Visual Studio Code.

CodeGPT is an extension for Visual Studio Code, a popular code editor for software developers. It uses three official AI (Artificial Intelligence) APIs to enhance its functionality. These are the OpenAI API, Cohere API, and AI21 API, which are provided by their respective companies. By leveraging these APIs, CodeGPT is able to provide a more intelligent and interactive programming experience to its users.

This can include features such as autocomplete suggestions, code generation, translation, and more. Additionally, the use of official APIs ensures the reliability and accuracy of the AI-generated responses.

Go to https://codegpt.co for the full documentation

Installation

Download the extension here 👇

Or go to VSCode Extensions Marketplace and search for Code GPT. Make sure the extension has the blue check mark 👇

And that it is the one with more than 900,000 downloads.

Configure your OpenAI Account

Go to Settings > Extensions > Code GPT

Code GPT Api Key:

Select the AI ​​provider you will connect to enter its API Key:

To obtain the API Key of each provider check this link: https://docs.codegpt.co/docs/tutorial-basics/configuration

Models

The service provides access to many different models, grouped by family and ability. A model family typically associates models by their intended task.

Select the model that you will send to the API to get the generated text. For more information about the models, visit this link:

https://docs.codegpt.co/docs/category/ai-providers

Max Tokens

Tokens can be thought of as pieces of words. Before the API processes the prompts, the input is broken down into tokens.

Each model has a maximum number of tokens. Select the number of tokens depending on the length of the response you want to get and the selected model.

Language

Select the language you want to use for interactions with the API.

For functionalities such as Explain or Document, each query will be made in the selected language.

Code GPT has 16 languages to choose from.

Temperature

This is a parameter that can be adjusted. It determines the level of randomness or “creativity” in the generated text. A higher temperature will result in more varied and creative output, while a lower temperature will produce output that is more similar to the training data and less likely to contain unexpected or surprising content.

It is a value between 0 and 1, with 0 being the most deterministic and 1 being the most random and creative. The default temperature is 0.3

How to use it?

Code GPT Chat

Open a chat interface with the icon in the extensions bar and start preparing your code through a conversation 💬

Get Code from comments:

  • Write a comment asking for a specific code
  • Press cmd-shift-i (ctrl+shift+i for Windows)
  • Use the code 😎

Other Features

To review all the features, visit the following link:
https://www.codegpt.co/docs/category/features

  • Ask CodeGPT: CodeGPT will open a new editor responding to your request
  • Ask StackOverflow: You could search for a question in StackOverflow and Code GPT will show you the best human answer and the AI answer
  • Explain CodeGPT: CodeGPT will open a new tab and explain the code.
  • Refactor CodeGPT: CodeGPT will open a new Editor and refactor the code.
  • Document CodeGPT: CodeGPT will open a new Editor and Document the code.
  • Unit Testing: CodeGPT will create a Unit Testing for the selected code

Conclusion

CodeGPT is a promising tool that utilizes the most advanced AI APIs to empower developers in their programming tasks, and it has a bright future.

With ongoing developments in AI technology, CodeGPT is set to offer even more innovative features in the near future, such as more accurate code predictions, smarter debugging suggestions, sophisticated grammar and syntax analysis, and advanced natural language processing capabilities.

The possibilities are endless, and CodeGPT is sure to become an invaluable asset for developers seeking to streamline their workflow and increase productivity.

Tutorial in English 👇

Tutorial in Spanish 👇

LatinX in AI (LXAI) logo

Do you identify as Latinx and are working in artificial intelligence or know someone who is Latinx and is working in artificial intelligence?

Don’t forget to hit the 👏 below to help support our community — it means a lot!

Thank you :)

--

--