Comparison beginner · 3 min read

How to use GitHub Copilot in VS Code

Quick answer
To use GitHub Copilot in VS Code, install the official GitHub Copilot extension from the VS Code Marketplace, then sign in with your GitHub account and enable it in your editor. Once activated, Copilot provides AI-powered code completions and suggestions as you type.

VERDICT

Use GitHub Copilot in VS Code for seamless AI-assisted coding integrated directly into your IDE with minimal setup.
ToolKey strengthPricingAPI accessBest for
GitHub CopilotIn-editor AI code completionSubscription-based after trialNo public APIReal-time coding assistance in VS Code
ChatGPT (OpenAI)Versatile conversational AIFree tier + paid APIYes, via OpenAI APIGeneral coding help, explanations, and snippets
TabnineMulti-language code completionFreemiumYesAI code completions across editors
Amazon CodeWhispererAWS ecosystem integrationFree tier + paidNo public APICloud-native development assistance

Key differences

GitHub Copilot integrates directly into VS Code as an extension, providing inline AI code completions based on your current file and context. It requires a GitHub account and a subscription after the trial period. Unlike general chatbots like ChatGPT, Copilot is optimized for real-time coding assistance rather than conversational interaction.

Copilot does not expose a public API, so usage is limited to supported IDEs. It excels at suggesting code snippets, completing lines, and generating boilerplate code seamlessly within the editor.

Side-by-side example

Using GitHub Copilot in VS Code to generate a Python function:

python
def fibonacci(n):
    # Copilot suggests the function body automatically
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    fib_seq = [0, 1]
    while len(fib_seq) < n:
        fib_seq.append(fib_seq[-1] + fib_seq[-2])
    return fib_seq

ChatGPT equivalent

Using ChatGPT via OpenAI API to generate the same Python function:

python
from openai import OpenAI
import os

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Write a Python function to generate the first n Fibonacci numbers."}]
)

print(response.choices[0].message.content)
output
def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    fib_seq = [0, 1]
    while len(fib_seq) < n:
        fib_seq.append(fib_seq[-1] + fib_seq[-2])
    return fib_seq

When to use each

Use GitHub Copilot when you want AI-powered code completions directly inside VS Code with minimal context switching. It is ideal for live coding, boilerplate generation, and inline suggestions.

Use ChatGPT when you need detailed explanations, multi-turn conversations, or code generation outside the editor environment, such as in documentation or complex problem solving.

ScenarioUse GitHub CopilotUse ChatGPT
Real-time code completionYesNo
Detailed code explanationsNoYes
Multi-turn coding helpNoYes
IDE integrationYesNo
API access for automationNoYes

Pricing and access

OptionFreePaidAPI access
GitHub Copilot14-day free trialSubscription $10/month or $100/yearNo
ChatGPT (OpenAI)Free tier with limitsPay-as-you-go API pricingYes
TabnineLimited free tierSubscription plansYes
Amazon CodeWhispererFree tier availablePaid tiers for enterpriseNo

Key Takeaways

  • Install the official GitHub Copilot extension in VS Code and sign in with your GitHub account to start using AI code completions.
  • GitHub Copilot excels at inline, real-time code suggestions within VS Code, unlike ChatGPT which is better for conversational coding help.
  • ChatGPT offers API access for automation and multi-turn interactions, while Copilot is IDE-focused with no public API.
  • Choose Copilot for seamless coding productivity in VS Code; choose ChatGPT for broader coding assistance and explanations.
Verified 2026-04 · gpt-4o
Verify ↗