Model listings checked on October 14, 2026. The picks below are a test order for different workloads, not results from a new controlled coding benchmark. Leave memory for context and runtime buffers as well as model weights.

The best Ollama model for a coding agent is not always the biggest model you can download. Agents loop. They read files, call tools, revise plans, and generate patches. A model that looks good in a single prompt can feel unusable when every tool call takes another slow local inference pass.

Use this ranking as a practical starting point: which model to pull, what hardware it wants, and when to stop forcing local inference and use a cloud fallback.

Quick ranking

Test orderModelPull commandWorkload to testMemory note
1Qwen3.8 27Bollama pull qwen3.8:27bCoding, reasoning, and toolsAbout 18GB download; leave context headroom
2Muse Glimmer 30Bollama pull muse-glimmer:30bAgent loops and recoveryAbout 18GB download; leave context headroom
3Qwen3 Coder 30Bollama pull qwen3-coder:30bCoding-focused local workCheck the selected quantization and context
4Nemotron 3.5 Lightningollama pull nemotron-3.5-lightning:30bAlways-on agent workAbout 25GB default download; larger memory budget
5gpt-oss 20Bollama pull gpt-oss:20bSmaller reasoning workloadsAbout 14GB download; 16GB can be tight
6Gemma 4 E4Bollama pull gemma4:e4bLightweight code helpCheck the exact build and remaining memory
7Qwen3 8Bollama pull qwen3:8bSmall edits and explanationsSmaller model; start with short context

Qwen3.8 and Muse Glimmer are newer candidates with tools support. Qwen3 Coder remains useful as a coding-focused baseline. Compare the same repository task on each; these positions do not mean we measured one universal winner.

What to pick by machine

8-16GB memory

Start with Gemma 4 E4B or Qwen3 8B. Consider gpt-oss 20B only if its weights, context state, and runtime overhead fit. Close other applications and inspect the actual allocation; the download size alone is not the working-memory requirement.

This tier is good for:

  • Explaining unfamiliar code
  • Writing small functions
  • Drafting tests
  • Generating config files
  • Summarizing logs

Do not expect reliable multi-file refactors here. Smaller models can write useful code, but they lose the thread quickly once the agent starts opening files, revising patches, and juggling tool output.

24-32GB memory

Compare Qwen3.8 27B, Muse Glimmer 30B, and Qwen3 Coder 30B. A 24GB GPU or 32GB+ unified-memory machine is a starting point for the approximately 18GB downloads, with a bounded context. Confirm fit and latency on your actual machine before increasing context.

64GB+ memory

Qwen3 Coder Next is a coding-focused option for larger memory budgets. Its default Q4 build is about 52GB before runtime overhead. Nemotron 3.5 Lightning is another agent candidate, with a roughly 25GB default download.

A large model can fit and still make the tool loop too slow. Measure prompt processing, token generation, and recovery from a failed tool call before choosing a default.

Want the local-first, cloud-fallback setup without managing keys for every provider? configure your agent with a local Ollama provider and a haimaker cloud provider, then switch when the local model gets stuck.

ROUTE LOCAL AND CLOUD MODELS WITH HAIMAKER

First workstation candidate: Qwen3.8

Test Qwen3.8 27B on a routine edit and a longer tool sequence. Its Ollama listing supports tools, thinking, and vision; those capabilities still need to work with your agent’s specific prompts and schemas.

ollama pull qwen3.8:27b
ollama run qwen3.8:27b "Explain this repo structure and suggest where tests should live."

Qwen3 Coder 30B remains a coding-focused alternative. Keep the task and context fixed when comparing them; do not copy an older model’s benchmark or tokens-per-second figure onto the newer model.

Best lightweight pick: Gemma 4

Gemma 4 is the model family to try when the workstation candidates are too heavy. The smaller Gemma 4 variants are designed for local and on-device use, while the 26B MoE variant gives you a stronger workstation option without activating every parameter on every token.

Pull the laptop-friendly version:

ollama pull gemma4:e4b

Pull the stronger workstation version:

ollama pull gemma4:26b

Gemma 4 is a good fit for coding agents when you want fast local help with explanations, small edits, and private code. It is less attractive for long autonomous sessions where the agent needs to keep a full migration plan straight.

Newer agent candidates: Muse Glimmer and Nemotron 3.5 Lightning

Muse Glimmer 30B is a newer local agent model. Test it on a workflow that needs several tool calls and recovery after an error.

ollama pull muse-glimmer:30b

Nemotron 3.5 Lightning targets always-on agents. Ollama’s listing shows a 25GB default build, so it needs more headroom than the 18GB candidates. Its MLX build has a different listed size and context limit; choose the actual build you will run.

ollama pull nemotron-3.5-lightning:30b

A model listed with a cloud tag uses hosted inference. Do not describe it as private local inference merely because Ollama can launch it.

Where to use these models

  • haimaker.ai - add a cloud provider alongside your local Ollama provider in the coding agent, then switch endpoints for tasks local inference cannot finish.
  • OpenClaw - use Ollama as a local provider for coding-agent sessions. See the OpenClaw local model guide.
  • OpenCode - add Ollama through the OpenAI-compatible provider path. See Ollama with OpenCode.
  • Codex and Claude Code - Ollama’s model pages include ollama launch examples for agent runtimes, including Codex and Claude Code.

Setup for OpenAI-compatible agents

Most coding agents can use Ollama through its local OpenAI-compatible endpoint:

http://localhost:11434/v1

Use a placeholder API key if your tool requires one. Ollama does not validate it locally.

{
  "baseURL": "http://localhost:11434/v1",
  "apiKey": "ollama",
  "model": "qwen3.8:27b"
}

For OpenCode, the provider block looks like this:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "qwen3.8:27b": {
          "name": "Qwen3.8 27B"
        }
      }
    }
  }
}

If tool calls are unreliable, reduce the model size first, then increase context only as far as your hardware can handle. A giant context window that swaps memory is worse than a smaller window that stays responsive.

When not to use Ollama

Local models are best when privacy, cost, or offline work matters. They are not automatically better for every coding task.

Use a cloud model when:

  • The task spans many files
  • The bug is subtle
  • You need reliable tool calling
  • The patch will touch production systems
  • You do not have time to review every generated line

The practical setup is local-first, not local-only. Use Qwen3.8, Qwen3 Coder, or Gemma 4 for private work, then escalate to a stronger cloud model when the task gets expensive in attention instead of tokens.

ROUTE LOCAL AND CLOUD MODELS WITH HAIMAKER


For OpenClaw-specific local setup, see best local models for OpenClaw. For OpenCode setup, see use Ollama with OpenCode.