bernardo-bruning/ollama-copilot

Proxy that allows you to use ollama as a copilot like Github copilot

Ollama Copilot – a local‑LLM proxy for GitHub Copilot

What it is – A small Go program that sits between the GitHub Copilot client (the VS Code, Neovim, Zed, etc. extensions) and any locally‑run LLM server. It translates Copilot’s HTTP requests into calls to an Ollama‑compatible API (or to other providers such as llmman, DeepSeek, Mistral, OpenRouter, OpenAI). In practice you can run a code‑focused model on your own machine and have the Copilot UI suggest completions just like the official service.


Quick start (one‑liner)

# Install Ollama first (see https://ollama.com/download/linux)
curl -fsSL https://ollama.com/install.sh | sh

# Pull a default code model
ollama pull codellama:code

# Install the proxy binary
go install github.com/bernardo-bruning/ollama-copilot@latest

# Run it (defaults to Ollama on localhost:11434)
ollama-copilot

Now point your Copilot extension to http://localhost:11435 (or the HTTPS ports shown below) and you’ll get completions from the local model.


How it works

Component Role
Ollama / llmman / other providers Hosts the actual language model and exposes an Ollama‑compatible REST API.
ollama‑copilot Listens on a set of HTTP/HTTPS ports, receives the Copilot JSON payload, forwards it to the chosen provider, and returns the completion in the format Copilot expects.
Copilot client (VS Code, Neovim, Zed, …) Sends its normal requests to the proxy instead of GitHub’s cloud service.

The proxy is configurable via command‑line flags, allowing you to:

  • Choose the provider (-provider ollama|llmman|deepseek|mistral|openrouter|openai).
  • Supply an API token (-token).
  • Pick the model (-model).
  • Adjust generation parameters such as -num-predict (how many tokens to generate) and -num-ctx (context window).
  • Run over plain HTTP or TLS (provide -cert/-key).

Installation options

1. Automated script (recommended)

./install.sh

The script:

  • Builds the Go binary and installs it to ~/.local/bin/ollama-copilot.
  • Optionally creates a Systemd service so the proxy starts on boot and lets you set num-predict persistently.
  • Detects the editors you have and offers to add the required proxy configuration for Neovim, VS Code, and Zed.

2. Manual Go install

go install github.com/bernardo-bruning/ollama-copilot@latest

Make sure $HOME/go/bin (or $GOPATH/bin) is on your $PATH.

3. Running the proxy

# Default – talks to a local Ollama instance on port 11434
ollama-copilot

# If Ollama runs elsewhere (container, remote host)
OLLAMA_HOST="http://192.168.133.7:11434" ollama-copilot

You can also change the listening ports with -port, -proxy-port, -port-ssl, and -proxy-port-ssl.


Provider‑specific notes

Provider How to set up Example command
Ollama (default) Install Ollama, pull a model (e.g., codellama:code). ollama-copilot
llmman Install llmman, run llmman serve, pull a model, then start the proxy with -provider llmman. ollama-copilot -provider llmman -model hf.co/unsloth/Qwen3.5-0.8B-GGUF
DeepSeek Obtain an API key from DeepSeek. ollama-copilot -provider deepseek -token $YOUR_KEY -model deepseek-coder
Mistral Obtain an API key from Mistral. ollama-copilot -provider mistral -token $YOUR_KEY -model codestral-latest
OpenRouter / OpenAI Supply the appropriate token and model name. ollama-copilot -provider openrouter -token $KEY -model openrouter/anthropic/claude-3.5-sonnet

IDE integration (manual configuration)

Neovim (using copilot.vim)

let g:copilot_proxy = 'http://localhost:11435'
let g:copilot_proxy_strict_ssl = v:false

Make sure you have signed in to Copilot first (:Copilot signin).

VS Code (official Copilot extension)

Add to settings.json:

{
  "github.copilot.advanced": {
    "debug.overrideProxyUrl": "http://localhost:11437"
  },
  "http.proxy": "http://localhost:11435",
  "http.proxyStrictSSL": false
}

Zed

{
  "features": {"edit_prediction_provider": "copilot"},
  "show_completions_on_input": true,
  "edit_predictions": {
    "copilot": {"proxy": "http://localhost:11435", "proxy_no_verify": true}
  }
}

PyCharm / other JetBrains IDEs

Set HTTP Proxy → Host localhost, Port 11435, and enable Accept non‑trusted certificates automatically under Tools → Server Certificates.

Emacs (experimental)

(setq copilot-network-proxy '(:host "127.0.0.1" :port 11434 :rejectUnauthorized :json-false))

(Requires the copilot-emacs package.)


Configuration flags (summary)

Flag Default Meaning
-port :11437 HTTP port the proxy itself listens on (used by the Copilot client).
-proxy-port :11438 HTTP port for the proxy endpoint (some editors use a separate port).
-port-ssl :11436 HTTPS counterpart of -port.
-proxy-port-ssl :11435 HTTPS counterpart of -proxy-port.
-cert / -key – Paths to TLS certificate and key for HTTPS mode.
-provider ollama Which backend to forward requests to.
-token TOKEN API token for cloud providers.
-model codellama:code Model identifier understood by the chosen provider.
-num-predict 250 (recommended 25 for Copilot) How many tokens the model may generate per request.
-template <PRE> {{.Prefix}} <SUF> {{.Suffix}} <MID> Prompt template used for “fill‑in‑the‑middle” completions.
-system You are a helpful... System‑level instruction sent to the model.

Roadmap (current status)

  • ✅ Enable completions APIs usage; fill‑in‑the‑middle.
  • ✅ Flexible configuration model (beyond llamacode:code).
  • ✅ Self‑installing script.
  • ✅ Auto‑configure Neovim, VS Code, Zed.
  • ✅ Documentation.
  • ⬜ Windows setup (still pending).

Who might use this?

  • Developers who want code completions without sending their source to a cloud service.
  • Teams with privacy or security constraints that require an on‑premise LLM.
  • Anyone experimenting with different open‑source code models (CodeLlama, Qwen, etc.) and wants the familiar Copilot UI.

Bottom line – ollama-copilot bridges the gap between the polished Copilot editor experience and the freedom of running your own code‑focused LLM locally.

Related

  • Project
  • Project
  • Project
  • Project