contenox

Local AI coding agent: Claude Code, Codex, OpenCode setup

Updated · Facts checked

MODEL PROVIDERSLocal models

A local AI coding agent runs the model on hardware you control, so your code never goes to a model provider and there is no per-token bill. Serve an open-weight model with Ollama on your own computer or vLLM on a GPU server, then point Claude Code, Codex CLI or OpenCode at it. The cost is quality and speed: a model that fits on one consumer GPU is usually weaker at long, multi-file work than the strongest hosted models.

Use a local model with your agent

Agent Supported? With Ollama With vLLM Note
Claude Code Works, not supported by Anthropic ollama launch claude ANTHROPIC_BASE_URL=http://gpu-host:8000 Ollama and vLLM document it; Anthropic doesn’t support Claude Code with non-Claude models
Codex CLI Yes ollama launch codex, or codex --oss A custom provider in ~/.codex/config.toml --oss covers Ollama and LM Studio
OpenCode Yes ollama launch opencode, or a provider block A provider block with the server’s /v1 URL Uses @ai-sdk/openai-compatible
Contenox Yes Ollama / Ollama Cloud under Local vLLM under Cloud Also includes built-in Local AI on Windows x64 from 1.0.22. Mix local and cloud models per session.

Ollama or vLLM?

Ollama vLLM
Best for One person on one computer A team sharing a GPU server
Setup Install, ollama pull, done Python, a GPU, and the right flags for tool calls
Models Ready-made, quantized downloads Models from Hugging Face
Default address http://127.0.0.1:11434 http://localhost:8000

Start with Ollama unless you already run GPU servers.

ollama pull qwen3

On a shared GPU server, with a Qwen3-Coder model:

vllm serve Qwen/Qwen3-Coder-30B-A3B-Instruct --served-model-name qwen3-coder --enable-auto-tool-choice --tool-call-parser qwen3_xml

The vLLM flags matter: without them, automatic tool calls are off and the agent can’t act. Full steps: vLLM.

Claude Code

With Ollama, run ollama launch claude. Or set the variables yourself, in PowerShell on Windows:

$env:ANTHROPIC_AUTH_TOKEN = "ollama"
$env:ANTHROPIC_API_KEY = ""
$env:ANTHROPIC_BASE_URL = "http://localhost:11434"
claude --model qwen3

On macOS or Linux:

export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model qwen3

For vLLM, set ANTHROPIC_BASE_URL to the server and map ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL to your served model name; see vLLM.

Claude Code is built for Claude models, and Anthropic doesn’t support routing it to others. It works through these servers, but some features, such as built-in web search, don’t.

Codex CLI

With Ollama, run ollama launch codex, or:

codex --oss -m qwen3

For vLLM, add a custom provider to ~/.codex/config.toml with base_url = "http://gpu-host:8000/v1"; see vLLM. Codex only speaks the Responses API, which both Ollama and vLLM serve.

OpenCode

With Ollama, run ollama launch opencode, or add a provider to opencode.json:

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

For vLLM, use the same shape with baseURL set to http://gpu-host:8000/v1. LM Studio (http://127.0.0.1:1234/v1) and llama.cpp’s llama-server (http://127.0.0.1:9931/v1) work this way too.

The port gotcha: current llama-server listens on port 9931 by default. OpenCode’s docs and older guides still show 8080, the old default. Start it with --port 8080 or use 9931 in baseURL. More in OpenCode with local models.

Contenox

Windows x64 builds from Contenox 1.0.22 include Local AI. The app downloads and runs models on your computer.

Modeld architecture explains the native workers, shared sessions and transport, with a desktop walkthrough.

  1. On first launch, choose Use local AI. In an app you have already set up, open Backends → Providers → Local AI → Manage models.
  2. Select Detect my hardware. From the model inventory, select Check hardware first to open the setup page.
  3. Choose the recommended chat model, or browse the available models, then select Download and use. For an installed model, select Use for chat.
  4. Wait for the download and chat check to finish. The model becomes your chat default and appears in the Model chip.
Contenox detects an NVIDIA GeForce RTX 3060 Laptop GPU with 5.6 GB available and recommends the installed MiniCPM5 2B model.
Hardware detection recommends a model for the available memory. MiniCPM5 2B is installed and ready to use here.

If a download needs repository access, the app shows Open model repository and asks for a Hugging Face read token. Use Manage models to download more models or remove their files. To free memory while keeping the download, open Backends → Local AI status, expand the model’s row and select Unload from memory.

Contenox local model inventory showing MiniCPM5 2B installed as the chat default, followed by models available to download.
Installed models, the chat default and available downloads in the local model inventory.

To connect an existing server on Windows, macOS or Linux, open Backends → Providers and choose Ollama / Ollama Cloud under Local, or vLLM under Cloud. Keep the default address for Ollama, or enter the vLLM server’s host and port only, without /v1, then select Connect. Connected models appear in the same Model chip, so you can switch per session. Download Contenox.

What hardware do I need?

Token speed comes from memory bandwidth, not core count. Generating a token reads the model’s weights out of memory once, so the ceiling is blunt: bandwidth divided by the bytes read per token. A model that fits in VRAM runs far faster than one on the CPU because a GPU’s memory carries ten to twenty times the bandwidth of system RAM, not because its cores work harder. For agentic coding the bar is higher than for chat: aim for 45 tokens a second or more, since 30 drags across an agent’s many turns, and give a mid-difficulty task at least 68k tokens of context to hold the instructions, tool definitions, files and command output it resends each turn.

Two numbers decide a setup:

  • Capacity (GB) sets what loads at all. The weights plus the KV cache for your context must fit, or the model won’t start, or it spills to slower memory.
  • Bandwidth (GB/s) sets how fast it runs once it fits.
Hardware Memory Bandwidth For local coding
RTX 5090 32 GB GDDR7 ~1,792 GB/s Fastest consumer card. MSRP $1,999; street prices ran higher in 2026.
RTX 4090 24 GB ~1,008 GB/s Strong for models under 24 GB.
Apple M3 Ultra up to 512 GB unified ~819 GB/s Unified memory fits very large models; bandwidth sits below a 5090.
Apple M4 Max up to 128 GB unified ~546 GB/s The same trade, smaller.
Intel Arc Pro B60 24 GB ~456 GB/s Cheap VRAM per gigabyte; wants IPEX-LLM and Linux to run well.
Intel Arc B580 12 GB ~456 GB/s About $249. Fits 8–12B models.
No GPU (dual-channel DDR5) system RAM ~90 GB/s 5–12 tokens a second on an 8B model. Fine to try, too slow for agent work.

Prices move; bandwidth and capacity don’t. Check current retail before buying.

A mixture-of-experts (MoE) model reads only the few experts its router picks per token, so it runs at the speed of its active size while taking memory for its full size. Qwen3-30B-A3B holds 30.5B parameters but activates 3.3B a token: it generates about as fast as a dense 3B model and needs memory for the 30B. That unlocks a trick — keep the shared layers on the GPU and push the expert weights into system RAM, with llama.cpp’s --n-cpu-moe, and a model too big for your VRAM runs anyway, slower. Because only some experts fire per token, they can even sit on different GPUs or hosts; a dense model resists that, since every token needs every weight.

After the weights load, the memory left over is your cache budget: it sets how much context stays in fast memory. Run past it and older tokens move to slower memory and get read back — a penalty of bytes divided by bandwidth, which shrinks as bandwidth grows. So a long context punishes a CPU and barely touches a 5090, and the exact cache budget matters most on slow hardware. Ollama adds a catch of its own: it can halve the KV cache by quantizing it, but only with flash attention on, which older cards don’t support, so the context costs the most memory exactly where there is the least. Ollama recommends at least 64000 tokens for coding tools; see the context fix.

Contenox’s own research on local inference put numbers on that gap: a stable prompt of about 9,000 tokens prefilled in 7.61 s on a CPU, against 1.77 s on a 6 GB laptop GPU and 0.03 s once the prefix was already cached. Keeping the start of the prompt unchanged is what makes the warm number possible (see prompt caching).

With Ollama, run ollama ps while a model is loaded. PROCESSOR shows whether it runs fully on the GPU, and CONTEXT shows the context length it got. A CPU share means the model plus its context didn’t fit and is running at system-RAM speed — use a smaller model or a shorter context.

For agentic coding, Contenox’s own research advises against a laptop unless it is really a workstation: a desktop with a full-size GPU, a dedicated GPU node on your network, or a cloud GPU rented by the hour keeps up where a laptop’s memory and bandwidth can’t. Reach for one when a hosted model is off the table for privacy, compliance, offline work or volume, and skip local otherwise. The reasoning is in How to run local LLMs for coding.

Which local models work for a coding agent?

The model must support tool calls; without them, the agent can’t read files or run commands.

New open-weight models appear every few weeks. Try a candidate on a small, real task, such as fixing one failing test, before giving it larger work. See How to choose a model for coding.

Related

Esc to close