Top Self-Hosted AI Coding Tools for Developers
Not every team can send its code to a cloud model. Banks, hospitals, defence contractors and many startups with strict customers need their code to stay on their own machines. Others simply want to avoid per-token bills, or work on a plane with no Wi-Fi.
Good news: open coding models like Qwen Coder, DeepSeek-Coder and Codestral are now strong enough for daily work, and the tools to run them locally are easy to set up.
This post picks the top 5 self-hosted tools from the Awesome AI Coding Agents list (plus Docker Model Runner) and shows how to get each one running.
Quick comparison
| Tool | What it is | Runs as | Best for |
|---|---|---|---|
| Ollama | Local model runner | Native app or Docker | The easiest way to run open coding models |
| Docker Model Runner | Model runner built into Docker | Docker Desktop / Engine | Teams already using Docker |
| Tabby | Self-hosted coding assistant | Docker container | A private Copilot for the whole team |
| Refact.ai | Self-hosted agent and completion engine | Docker container | Enterprise self-hosting with fine-tuning |
| Twinny | VS Code extension | Editor plugin | Free, fully local completion and chat |
A quick note on hardware
Small coding models (1.5B to 7B parameters) run fine on a modern laptop, especially Apple Silicon with 16 GB of memory or more. For 14B to 32B models, you want 32 GB or more, or a GPU with plenty of VRAM. Start small, then move up.
1. Ollama
Ollama is the most popular way to run open models on your own machine. One command downloads a model and serves it on a local API that many coding agents can use.
Install
curl -fsSL https://ollama.com/install.sh | sh
On macOS and Windows you can also download the desktop app from ollama.com.
Pull and chat with a coding model
ollama pull qwen2.5-coder:7b
ollama run qwen2.5-coder:7b "Write a Python function that checks if a string is a valid IPv4 address"
Use it as the brain of a coding agent. Ollama serves an API on localhost:11434, so terminal agents like Aider can point at it:
aider --model ollama_chat/qwen2.5-coder:7b
Call the OpenAI-compatible API from any tool or script:
curl http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "qwen2.5-coder:7b", "messages": [{"role": "user", "content": "Explain what a Dockerfile HEALTHCHECK does"}]}'
Pick it when: you want the simplest way to run open coding models locally.
2. Docker Model Runner
Docker Model Runner (DMR) lets you pull and run models the same way you pull and run containers. Models are packaged as OCI artifacts on Docker Hub, and DMR serves them on an OpenAI-compatible API.
Pull and run a model
docker model pull ai/qwen2.5-coder
docker model run ai/qwen2.5-coder "Write a bash script that backs up a Postgres database"
docker model ls
Open the API on a local port (Docker Desktop):
docker desktop enable model-runner --tcp 12434
Call it from any OpenAI-compatible client:
curl http://localhost:12434/engines/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "ai/qwen2.5-coder", "messages": [{"role": "user", "content": "Review this SQL for injection risks: SELECT * FROM users WHERE id = $id"}]}'
Add a model to your Compose app so every developer gets the same setup:
services:
app:
build: .
models:
- coder
models:
coder:
model: ai/qwen2.5-coder
Pick it when: your team already uses Docker and wants models managed like any other dependency.
3. Tabby
Tabby is an open-source, self-hosted coding assistant. Think of it as a private Copilot: code completion, chat and an answer engine that knows your repos, all running on your own server with no outside calls.
Run it with Docker (GPU example):
docker run -it --gpus all -p 8080:8080 -v $HOME/.tabby:/data tabbyml/tabby serve --model StarCoder-1B --chat-model Qwen2-1.5B-Instruct --device cuda
On a Mac, install with Homebrew and use --device metal instead.
Connect your editor: install the Tabby extension for VS Code, JetBrains or Vim, and point it at http://localhost:8080.
Let Tabby learn your code by adding repos in ~/.tabby/config.toml:
[[repositories]]
name = "payments-service"
git_url = "https://github.com/acme/payments-service.git"
[[repositories]]
name = "web-frontend"
git_url = "file:///home/dev/code/web-frontend"
Tabby indexes these repos so its completions and answers use your real functions and patterns.
Pick it when: you want one private assistant for the whole team, with user management and an admin dashboard.
4. Refact.ai
Refact.ai is a self-hostable AI agent and code completion engine aimed at companies. You run the server, choose open models, and can even fine-tune a model on your own codebase.
Run the server with Docker:
docker run -d --rm --gpus all --shm-size=256m -p 8008:8008 -v refact-perm-storage:/perm_storage smallcloud/refact_self_hosting:latest
Open http://localhost:8008 to pick which models to serve for completion and chat.
Connect your editor: install the Refact.ai extension for VS Code or JetBrains and set the server address to http://localhost:8008.
Example agent prompt in the editor:
Find every place we read environment variables directly and move them into config/settings.py with defaults.
Pick it when: you need a self-hosted agent with fine-tuning and enterprise controls.
5. Twinny
Twinny is a free and fully private VS Code extension for code completion and chat. It talks to a local model server such as Ollama or llama.cpp. Nothing leaves your machine.
Install
code --install-extension rjmacarthy.twinny
ollama pull qwen2.5-coder:1.5b
ollama pull qwen2.5-coder:7b
Set it up: open the Twinny panel in VS Code and add two providers:
Completion (FIM): Ollama, localhost:11434, model qwen2.5-coder:1.5b
Chat: Ollama, localhost:11434, model qwen2.5-coder:7b
A small model for completion keeps suggestions fast. A larger one for chat gives better answers.
Pick it when: you are a solo developer who wants free, private help in VS Code with almost no setup.
Which open model should I use?
- qwen2.5-coder (1.5B to 32B): a strong all-rounder for completion and chat.
- deepseek-coder: good at code generation and explaining code.
- codestral: strong at fill-in-the-middle completion.
Try two or three on your own code. The best model is the one that does well on your language and your style.
How to choose
- Easiest local model runner: Ollama
- Models managed like containers: Docker Model Runner
- A private Copilot for a team: Tabby
- Enterprise self-hosting with fine-tuning: Refact.ai
- Free and private in VS Code: Twinny
Bonus: local model plus a sandboxed agent
You can combine local models with the agents from the other posts in this series. Run the model with Docker Model Runner on your host, run the agent inside a Docker Sandbox, and allow the sandbox to reach only the model port. Your code never leaves the machine, you need no API keys, and the agent still cannot touch your host.
Wrapping up
Self-hosted AI coding is no longer a compromise. With a decent laptop or one GPU server, your team can have completion, chat and agents that keep every line of code in-house.
See the full list at github.com/collabnix/awesome-ai-coding-agents, and open a PR to add your favourite self-hosted tool.