Using Ollama with GitHub Copilot in VS Code

Tiempo de lectura: 2 minutos

Today we will explain how to use Ollama from a custom provider for GitHub Copilot.

Alpaca - Pexels

The first thing we need to have is GitHub Copilot installed in our VS Code

And also Ollama installed (recommended in a remote environment).

Once all the necessary services are ready, we proceed with action.

We open VS Code and open the Github Copilot extension.

Click on select model (Set Auto or the currently selected model), appears below the chat.

Select Model Github Copilot

Inside Other Models click on settings:

Settings Other Models Copilot Vs Code

Now in Add Models > Custom Endpoint

Custom Endpoint Models Github Copilot

And now we fill in what is asked for and this JSON:

"models": [ { "id": "", "name": "", "url": "", "toolCalling": true, "vision": true, "maxInputTokens": 128000, "maxOutputTokens": 16000 } ] }

It will ask for name and then an API key, the OLLAMA API key is:

ollama

For the URL we put baseURL + /chat/completions:

https://ourdomain_ollama.com/v1/chat/completions

Or if it’s on local:

http://localhost:11434/v1/chat/completions

To view the models that are installed:

https://ourdomain_ollama.com/api/tags 

Leave a Comment