Quick setup with Ollama
From Ollama's OpenCode page: ollama launch opencode configures and starts OpenCode; ollama launch opencode --config only writes the configuration.
Both tools need a large context: Ollama's docs ask for 64K tokens or more, while its default on most Macs is 4K (under 24 GiB) or 32K (24–48 GiB). Raise it in the Ollama app's settings or with OLLAMA_CONTEXT_LENGTH=65536 ollama serve, and check ollama ps (context length docs).
Manual configuration
OpenCode's provider docs say it detects a local Ollama at http://127.0.0.1:11434 and LM Studio at http://127.0.0.1:1234/v1 and lists their models in /models. For anything else, add an OpenAI-compatible provider. Ollama's page shows this opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama",
"options": { "baseURL": "http://localhost:11434/v1" },
"models": { "qwen3-coder-next": { "name": "qwen3-coder-next" } }
}
}
}OpenCode's latest docs use a newer schema (providers with settings.baseURL), so check the current docs for your version.
Which Mac and model
| Model | Memory at 64K | Mac mini M6 16GB | Mac mini M6 32GB | Mac mini M5 Pro 48GB | Mac mini M5 Pro 64GB | Mac Studio M5 Max 128GB |
|---|---|---|---|---|---|---|
| Qwen3-Coder-Next 80B-A3B (Q4_K_M) | ~75 GB | too tight | too tight | too tight | too tight | ~142 tok/s |
| Devstral Small 2 24B (Q4_K_M) | ~29 GB | too tight | too tight | ~15.3 tok/s | ~15.3 tok/s | ~30.7 tok/s |
| GLM-4.7-Flash 30B-A3B (Q4_K_M) | ~34 GB | too tight | too tight | ~72.7 tok/s | ~72.7 tok/s | ~145 tok/s |
| Qwen3 Coder 30B-A3B (Q4_K_M) | ~34 GB | too tight | too tight | ~67.2 tok/s | ~67.2 tok/s | ~134 tok/s |
| gpt-oss 20B (MXFP4) | ~27 GB | too tight | ~31.9 tok/s | ~57.6 tok/s | 61.0 tok/s | ~115 tok/s |
More on the models in the best local LLM for coding.
FAQ
How do I use OpenCode with Ollama?
Does OpenCode work with LM Studio?
What context length does OpenCode need?
See any model on the exact Mac you're considering.
Speeds come from published measurements (with source links) or labeled estimates. How we measure