{}const=>[]async()letfn</>var
DevelopmentAI

How to use GPT directly in VS Code: a guide to integration

Step-by-step instructions for connecting GPT in VS Code: what extensions to use, how to get an API key and how to configure everything.

К

Kodik

Author

2 min read

Here are step-by-step instructions on how to connect GPT to your favorite VS Code to write code even faster and smarter.

🔧 What will the integration of GPT into VS Code give?

  • ✨ Auto-complete code based on meaning

  • 📚 Generate comments and documentation

  • 🧪 Explain what the code snippet does

  • 🔄 Rewrite the code with improved readability

  • 🤯 Help with debugging and bug hunting

🔥 100,000+ students already with us

Tired of reading theory?
Time to code!

Kodik — an app where you learn to code through practice. AI mentor, interactive lessons, real projects.

🤖 AI 24/7
🎓 Certificates
💰 Free
🚀 Start learning
Joined today

🧩 What are the extensions?

Expansion

Features

Free

CodeGPT

Generation, explanation, code translation

Partially

Continue

LLM agent with auto-completion, supports OpenAI and others.

Ghostwriter

From Replit, code and sentence generation

Cody (Sourcegraph)

GPT prompts based on project context

⚙️ Installing CodeGPT

  1. Open VS Code

  2. Go to Extensions (Ctrl + Shift + X)

  3. Find CodeGPT and click Install

📝 After installation, you will need to configure the API key from OpenAI.

🔑 Where can I get the OpenAI API Key?

  1. Go to https://platform.openai.com/account/api-keys

  2. Click Create new secret key

  3. Copy the key (it will be shown once)

📌 Do not publish the key in plain text and do not upload it to public repositories.

🔧 Setting up CodeGPT

Open the command palette (Ctrl+Shift+P) and select:

> CodeGPT: Set API KEY

Insert the key from OpenAI. After that, you can run the commands:

  • CodeGPT: Explain Code

  • CodeGPT: Generate Code

  • CodeGPT: Refactor Code

  • CodeGPT: Ask Anything

📐 Example of use

Highlight a code snippet and call Explain Code. GPT will explain what the code does, in Russian or English. It's convenient if you're working with someone else's project.

Want to make the code more beautiful and cleaner? Call Refactor Code.

⚡️ Alternative: Continue

If you want more flexibility and don't want to pay, try Continue:

  • Supports OpenAI, LocalAI, Ollama, and others

  • Works as an assistant alongside the editor

  • You can connect local models

📁 An excellent option if you want to use GPT on your server or even without the Internet.

📣 Join the Kodika community

In our Kodik app you can:

  • Learn to write code from scratch in Python, JavaScript, HTML, etc.

  • Ask AI questions directly inside the exercises

  • Pump skills through real mini-projects

And in Telegram channel we discuss interesting topics, share life hacks and support each other. Join us! 💬

💬 Write in the comments

Do you use GPT in the editor? Which plugin did you like the most? Or would you like us to create a guide on how to connect a local model?

🎯Stop procrastinating

Liked the article?
Time to practice!

In Kodik, you don't just read — you write code immediately. Theory + practice = real skills.

Instant practice
🧠AI explains code
🏆Certificate

No registration • No card