Local LLM setup
Brokspace answers questions (brok ask) and runs skills (brok skill run)
with any OpenAI-compatible model. Running it locally keeps everything
free, private and offline. Search and indexing never need an LLM.
The short version
brok setup llm # also part of `brok init`It:
- reads your RAM (and NVIDIA GPU memory) and picks a model size from the table below;
- looks for a running Ollama (
localhost:11434) or LM Studio (localhost:1234) server; - uses a model you already have, or offers to download the recommended one
(
ollama pull); - writes the choice to
.brokspace/brok.yml(llm.default).
Nothing installed yet? It prints the one-line install for your OS. Run it,
then brok setup llm again. brok doctor tells you at any time whether the
model is reachable.
What your machine can run
Sizes are for 4-bit quantized models (Q4_K_M), the best balance between
speed and quality.
| Model size | Memory and GPU | Typical hardware | Recommended (Ollama) |
|---|---|---|---|
| 1B to 3B | 8 GB | Office laptops, entry-level Macs | qwen2.5-coder:1.5b, llama3.2:3b |
| 3B | 16 GB, no GPU | Business laptops with integrated graphics | qwen2.5-coder:3b, llama3.2:3b |
| 7B to 9B (sweet spot) | 16 GB with a GPU (6 GB+) or Apple Silicon; 32 GB without a GPU | Gaming laptops, M1/M2/M3 Macs, desktops | qwen2.5-coder:7b, llama3:8b, deepseek-r1:8b |
| 14B to 32B | A GPU with 12 GB+, or 32 GB with a GPU or Apple Silicon | Workstations, Mac Pro/Max with 32 GB+ | qwen2.5-coder:14b, deepseek-r1:32b |
Without a GPU the model runs on the processor: memory decides what fits, but speed decides what is pleasant. A laptop CPU reads a long prompt into a 7B model at about 15 tokens per second, so a review takes 3 to 5 minutes; a 3B model is about twice as fast. That is why machines without a GPU get one size smaller. Only NVIDIA GPUs and Apple Silicon are detected; with another GPU that Ollama supports, pick the row for your GPU memory.
What to expect: 1B to 3B models answer questions about your code well
enough (brok ask, brok chat), but they lose track of longer skills, so
brok review, brok commit and most brok skill run workflows are much
better with 7B or larger. Even at 7B, a review is a first pass that can be
wrong; 14B and hosted models (brok review -p anthropic) review much
better, and commit messages are already good at 7B.
brok setup llm applies exactly this table. Override it any time:
brok setup llm --provider ollama --model llama3:8bOption 1: Ollama (recommended, terminal friendly)
| OS | Install |
|---|---|
| Windows | winget install Ollama.Ollama or the installer from ollama.com |
| macOS | brew install ollama or the app from ollama.com |
| Linux | curl -fsSL https://ollama.com/install.sh | sh |
ollama pull qwen2.5-coder:7b # or let `brok setup llm` do it
brok setup llmOption 2: LM Studio (graphical)
- Download it from lmstudio.ai (Windows
.exe, macOS.dmgfor Apple Silicon or Intel, Linux.AppImage:chmod +x LM_Studio-*.AppImage && ./LM_Studio-*.AppImage). - Search for
Qwen2.5-Coder-7B(or the size from the table), pick aQ4_K_MorQ5_K_Mfile and download it. - Open the Developer / Local Server tab, load the model and press
Start Server (it listens on
http://localhost:1234). - Run
brok setup llm: it finds the server and lets you pick the model.
Hosted models
Prefer a hosted model for some questions? Export its key and choose it per
request; the providers are preconfigured in brok.yml:
export ANTHROPIC_API_KEY=... # PowerShell: $env:ANTHROPIC_API_KEY = "..."
brok ask -p anthropic "explain the retry policy"Keys are read from the environment, never stored in brok.yml, and secrets
found in retrieved code are redacted before any prompt leaves your machine.
Using the same model elsewhere
- Aider:
aider --model ollama/qwen2.5-coder:7binside your git repository (pip install aider-chat, Python 3.10 to 3.12). - Coding agents (Claude Code, Cursor, VS Code, Codex):
brok setup agentsgives them the Brokspace search tool and skills; see Integrations.
Performance tips
- Apple Silicon: memory is unified, so a 16 GB Mac runs 7B/8B models fast.
- NVIDIA / AMD GPUs: enable full GPU offload in LM Studio or Ollama.
- Storage: keep models on an SSD; loading from a spinning disk is painfully slow.
- Smaller is often better for interactive use: a fast 7B beats a slow
14B for everyday questions; switch per request with
-p.