contenox

Best Ollama harness for coding: Claude Code, OpenCode, Codex

Updated

MODELS AND COST Best Ollama harness

The best Ollama harness depends on the model you can run. For a small local model on 8 to 16 GB, Aider works best, because it doesn’t need tool calls and sizes Ollama’s context for every request. For a 24 GB or larger model, OpenCode or Codex CLI. For Ollama Cloud models, Claude Code works well: ollama launch claude sets it up in one command.

The harness is the agent program around the model: its instructions, its tools, and how it manages the conversation. With a frontier model, a heavy harness costs little. With a 9B model on your own GPU, the same harness can be what fails.

The harnesses compared

HarnessConnect to OllamaAPI it usesNeeds tool callsSetupBest with
Claude Codeollama launch claudeAnthropic MessagesYesOne commandCloud models, 24 GB+ local models
Codex CLIollama launch codex, or codex --ossResponsesYesOne command24 GB+ local models, cloud models
OpenCodeollama launch opencode, or a provider blockChat CompletionsYesOne command; JSON for full controlAny size, with the context set right
Aideraider --model ollama_chat/<model>Ollama’s own APINopip install, one variable8 to 16 GB local models
GooseBuilt-in Ollama provider, OLLAMA_HOSTOllama providerYesPick the provider, raise the contextLarger models
ClineOllama provider in VS CodeOllama providerYesSettings in VS CodeEditor users; turn on Use Compact Prompt
Continueprovider: ollama in config.yamlOllama providerFor agent modeEdit YAMLEditor users
DeepSeek Harnessollama launch dshSet up by OllamaYesOne command (Node.js)DeepSeek cloud models; developer preview
ContenoxBackends → Providers → Ollama / Ollama CloudOllamaYesClick ConnectMixing local and hosted models per session

ollama launch also starts Hermes Agent and OpenClaw, which Ollama lists as personal assistants rather than coding agents.

What makes a harness good with local models?

Three things, and the big agents differ on all of them.

1. How it gets edits and commands out of the model. Claude Code, Codex, OpenCode, Goose and Cline use tool calls: the model writes a structured call, Ollama parses it with the model’s template, and the harness runs it. When a small model formats a call wrong, you see JSON printed as text, or nothing happens. Goose’s docs say it plainly: without tool calls, a model “can only do chat completion”. Aider takes the other route. It asks the model to write edits as search/replace blocks or whole files in plain text, so it works even with models that have no tool support.

2. How it handles the context limit. Ollama gives a model only 4k tokens on GPUs under 24 GB, and when a prompt doesn’t fit, it drops part of it without an error. Aider’s docs describe this, and Aider works around it: it sets the context size for each request, with room for the reply. The others rely on you. OpenCode needs limit.context in its config to know when to compact. Codex has model_context_window. Continue has contextLength. And for all of them, the context on the Ollama side has to be raised first, to the 64k that Ollama’s docs recommend for coding agents.

3. How big its prompt is. Every turn, the harness sends its system prompt and the definition of every tool again. Claude Code and Codex are built for their makers’ frontier models, with long instructions and many tools. A small local model has to read all of that on every turn, on a consumer GPU, and still keep your request in view. Cline ships a Use Compact Prompt setting and recommends it for all local models; that tells you how much the prompt size matters.

Ollama with Claude Code vs OpenCode

The two most searched setups, side by side:

Claude CodeOpenCode
Setupollama launch claudeollama launch opencode, or a provider block
APIOllama’s Anthropic-compatible APIOllama’s OpenAI-compatible API
Who supports itOllama documents it; Anthropic doesn’t support Claude Code with non-Claude modelsBoth OpenCode and Ollama document it
What’s missingOllama’s Anthropic API has no prompt caching, token counting or tool_choice; hosted web search is limitedNothing on the API side; tool-call parsing has failed for some models
Context controlSet it in OllamaSet it in Ollama, and limit.context per model in opencode.json
The trapBase URLs in Claude Code’s settings files override your shell variables; check with /statusModels defined only in opencode.json don’t show in ollama launch’s picker

Pick Claude Code if you already know it and use a cloud model or a large local one. Ollama’s own Claude Code page says subagents, file edits and its permission flow work. Pick OpenCode if you run a smaller model and want to control its limits per model, or if you switch between local, cloud and hosted providers in one tool.

Setup for each harness

Claude Code

ollama launch claude --model qwen3.8:27b

By hand: ANTHROPIC_BASE_URL=http://localhost:11434, ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_API_KEY="", then claude --model <tag>. Steps per OS: Ollama.

Codex CLI

ollama launch codex

Or codex --oss -m qwen3.8:27b. Inside Codex, /model switches between your tool-capable Ollama models. ollama launch codex --restore removes what the launcher set up.

OpenCode

ollama launch opencode

For full control, a provider block in opencode.json: OpenCode with local models.

Aider

python -m pip install aider-install
aider-install

Then in PowerShell, setx OLLAMA_API_BASE http://127.0.0.1:11434 and open a new terminal; on macOS or Linux, export OLLAMA_API_BASE=http://127.0.0.1:11434. In your project:

aider --model ollama_chat/qwen3.5:9b

Use the ollama_chat/ prefix, not ollama/; Aider’s docs recommend it.

Goose: choose Ollama as the provider. It uses localhost:11434 unless you set OLLAMA_HOST. Goose’s docs say Ollama’s 4096-token default is too low for it; set OLLAMA_CONTEXT_LENGTH higher. Goose is now under the Agentic AI Foundation.

Cline: in Cline’s settings in VS Code, pick Ollama, keep http://localhost:11434, choose a model, then enable Use Compact Prompt under Features.

Continue: add a model with provider: ollama to config.yaml. Continue detects tool support for most Ollama models; for a custom name, add capabilities: [tool_use]. If you see “Model requires more system memory”, lower contextLength: Continue may ask for more context than other tools do.

DeepSeek Harness

ollama launch dsh --model deepseek-v4.1-flash:cloud

Ollama installs it if needed (it requires Node.js). Its web search needs Ollama cloud access, so run ollama signin first. DeepSeek marks the harness as a developer preview, with breaking changes ahead.

Which harness for my hardware?

You haveHarnessModel
8 to 12 GBAider; or Cline with Compact Promptqwen3.5:9b
16 GBAider or OpenCodeqwen3.5:9b-q8_0, or qwen3-coder:30b partly on the CPU
24 GBOpenCode or Codex CLIqwen3.8:27b at 64k
48 GB and upAny, Claude Code includedqwen3.8:27b-q8_0 with a long context, qwen3-coder-next
No GPU, Ollama CloudClaude Code, OpenCode or DeepSeek Harnessglm-5.3:cloud, kimi-k2.7-code:cloud, deepseek-v4.1-flash:cloud

Why these models: best Ollama models for coding. Whatever you choose, raise Ollama’s context to 64k first and check ollama ps shows 100% GPU. A 4k context breaks every harness here except Aider, which sets the size itself.

Contenox

Contenox is a desktop app that connects to Ollama, local or Ollama Cloud, under Backends → Providers, next to hosted providers. You switch the model per session, so a local model can do routine work and a hosted one the hard parts. Its permission rules are the same for every model: reads and builds run, edits and risky commands ask, secrets are blocked. It can also host Claude Code as an agent. Download Contenox.

Related

Esc to close