Setting Up Continue.dev with Ollama for Local LLMs in VSCode

Prerequisites

  1. VSCode + Continue.dev: Ensure you have Visual Studio Code installed and the Continue.dev extension installed.
  2. Ollama: Install Ollama, a local LLM runner that can host various models. Make sure Ollama is running and that you know the port it’s listening on (default: 11434).

Step-by-Step Instructions

1. Start Ollama

2. List Available Models in Ollama

To know which models Ollama currently manages, run:

ollama ls

This will output something like:

qwen2.5-coder:3b
llama-2-7b
mistral-7b
...

Each line shows a model identifier you can use in the Continue.dev configuration. Models managed by Ollama often follow the format: modelName:variantOrSize, for example qwen2.5-coder:3b.

3. Configuring Continue.dev’s config.json

Continue.dev reads its model configuration from a JSON file which you can typically find in your VSCode settings directory for Continue. The configuration might look like this (adjust the path as necessary):

Inside the config.json, you’ll have a models array. To integrate an Ollama model, you need to add an entry for it. A minimal example looks like this:

{
  "models": [
    {
      "title": "Qwen 2.5 Coder 3b",
      "model": "qwen2.5-coder:3b",
      "provider": "ollama",
      "apiBase/v1": "http://localhost:11434/api/generate"
    }
  ]
}

Key Points:

You can add as many models as you like by including multiple objects in the models array, for example:

{
  "models": [
    {
      "title": "Qwen 2.5 Coder 3b",
      "model": "qwen2.5-coder:3b",
      "provider": "ollama",
      "apiBase/v1": "http://localhost:11434/api/generate"
    },
    {
      "title": "Llama 2 7B",
      "model": "llama-2-7b",
      "provider": "ollama",
      "apiBase/v1": "http://localhost:11434/api/generate"
    }
  ]
}

4. Loading Models into Ollama

Option A: Pulling Models from a Remote Source

If a model is hosted in a repository or by Ollama itself, you can pull it directly:

ollama pull qwen2.5-coder:3b

This downloads the model files into Ollama’s directory. Once pulled, you can list it with ollama ls and add it to config.json.

Option B: Loading a Local GGUF Model

If you have a GGUF model file on your local machine (for example, my-model.gguf), you can integrate it with Ollama by creating a custom model YAML file that tells Ollama how to load it. Ollama’s documentation details this process, but it typically looks like:

  1. Create a model YAML file (e.g. my-model.yaml) in your Ollama models directory (commonly ~/.ollama/models/):

     name: my-local-model
     model: /path/to/my-model.gguf
    
  2. Once you have the YAML file in place, run:

     ollama import my-local-model.yaml
    

    This makes Ollama aware of the model.

  3. After importing, you can verify it’s recognized:

     ollama ls
    

    You should see my-local-model listed.

  4. Add the model to Continue’s config.json:

     {
       "models": [
         {
           "title": "My Local Model",
           "model": "my-local-model",
           "provider": "ollama",
           "apiBase/v1": "http://localhost:11434/api/generate"
         }
       ]
     }
    

5. Using the Models in VSCode with Continue.dev

6. Troubleshooting


Summary:
To integrate Ollama with Continue.dev in VSCode, you need to edit your config.json to include a model entry pointing to Ollama’s apiBase/v1 endpoint and referencing the model’s name exactly as Ollama recognizes it. You can load models by pulling them with ollama pull or importing a local GGUF file via a model YAML. After configuration, you can switch between any models you’ve added directly from Continue.dev’s interface in VSCode.