How to Set Up Local AI-Powered Code Completion or autocompletion in VSCode

autocompletion code

Tired of subscription fees for AI code or autocompletion? Here’s how to run AI models locally in VSCode for free, unlimited autocomplete—no GitHub Copilot Pro subscription required.

Why Look for AI Alternatives?

I started with GitHub Copilot, which was the go-to solution for AI-powered coding assistance. While Microsoft generously offers free unlimited access to students, teachers, and maintainers of popular open-source projects, most developers face a monthly subscription cost of $10 for unlimited completions after exhausting the free tier of approximately 2,000 completions per month.

If you’re a heavy coder, those 2,000 completions disappear quickly. Since I don’t qualify for the free tier, I searched for a cost-effective alternative—and discovered Continue.dev.

Introducing Continue: Your Local AI Code Assistant

Continue is a powerful VSCode extension that lets you run open-source AI models directly on your machine. Here’s how to set it up:

Step 1: Install the Continue Extension

Open VSCode and navigate to the Extensions marketplace. Search for “Continue” and install Continue – open-source AI code agent.

The installation process is straightforward and takes just a few clicks, as shown in the screenshot above.

Step 2: Access Continue Settings

Once installed, you’ll notice a new Continue icon in your VSCode sidebar on the left-hand side. Click on it to open the Continue panel, then locate the settings icon in the top-right corner of the panel—you’ll see three icons: add, history, and settings which is shown in the screenshot below.

Step 3: Navigate to User Settings

After clicking the settings icon, you’ll be taken to the User Settings page. On the left sidebar, you’ll find various options including Models, Rules, Tools, Agents, Organizations, and Indexing.

Click on Agents to proceed, as shown in the screenshot above.

Step 4: Configure Your Local Agent

In the Agents section, you’ll see an option labeled Local Agent with a “Configure Agent” icon next to it which is shown in the screenshot below.

Click the Configure Agent icon as shown in the screenshot to open the config.yaml file in your editor.

Step 5: Set Up Autocomplete Configuration

Add the following configuration to your config.yaml file:

#yaml
models:
  - name: Autodetect
    provider: ollama
    model: AUTODETECT
    roles:
      - autocomplete

This configuration tells Continue to automatically detect AI models you’ve downloaded through Ollama.

Step 6: Install Ollama and Download a Model

If you haven’t already set up Ollama, check out our previous guide on running AI models locally: How to Run AI Models Locally on Your Computer with Ollama

Download a model that suits your hardware specifications—models like Qwen or CodeLlama work excellently for code completion tasks.

Step 7: Verify Model Detection

Once Continue detects your Ollama model, it will appear under the Autocomplete model section in the extension.

The screenshot above shows how your downloaded model will be reflected in the Continue interface once it’s successfully detected.

Step 8: Test Your Setup

Create a new Python file (.py) and start typing a simple code snippet:

#python
current_number = 1
while current_number <= 5:
    print(current_number)
    current_number += 1

As you type the first line, the autocomplete model should suggest the remaining code. The suggestions appear in gray text—simply press Tab to accept them.

You’re All Set! No monthly fees, no usage limits with complete privacy

You now have a completely local, free AI code completion system running in VSCode. No monthly fees, no usage limits, and complete privacy since your code never leaves your machine.

Have questions or did you encounter any issues during setup? Drop a comment below and let us know if the autocomplete worked for you. I’d love to hear about your experience!

Leave a Comment

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

Scroll to Top