Why Claude Code isn't a drop-in swap for OpenCode

Every other local-model setup guide on this blog — OpenCode, Continue — points the agent at an OpenAI-compatible endpoint by setting OPENAI_API_BASE. Claude Code doesn't work that way. It's Anthropic's own CLI, and it speaks the Anthropic Messages API specifically: the request body, the streaming format, and the tool-call shape are all Anthropic's, not OpenAI's. Pointing it at a local server means setting ANTHROPIC_BASE_URL instead — and whatever is listening on the other end has to accept requests in that exact shape, not just be "an OpenAI-compatible server" the way mlx_lm.server or a generic Ollama endpoint normally is.

That one constraint decides the rest of this guide: which host provider you can actually use, and what you have to set differently from every other agent covered here.

The host provider that actually works: Ollama, not raw MLX

As of version 0.14, Ollama added native Anthropic Messages API compatibility — it accepts requests at /v1/messages in Anthropic's own format, translates them internally to whatever the underlying model expects, and returns a response in the same Anthropic shape. That's the one host provider on this blog's list that Claude Code can talk to directly. Ollama's own documentation is upfront that this is a subset of the full API: messages, streaming, and function calling are supported, but tool-choice controls, deferred tools, and hosted web search are not — worth knowing before you hit one of those and assume something's broken on the Velo side.

MLX's own server (mlx_lm.server) doesn't speak the Anthropic Messages API — it's OpenAI-compatible, the same as it is for OpenCode and Continue. That's fine for those two agents; it's not enough for Claude Code without a translation layer sitting in front of it, which is outside what this guide covers. If you specifically want Claude Code, set AI Bridge's Host Provider to Ollama, not MLX.

Note: as of Ollama 0.19 (March 2026), Ollama itself runs on Apple's MLX framework under the hood on Macs with 32GB+ unified memory — that's a separate, internal detail about which inference engine Ollama uses, unrelated to whether it exposes the Anthropic API surface this guide depends on. Both are true at once: Ollama can speak Anthropic's protocol on the outside while running on MLX on the inside.

Setup

1. Install and run Ollama on the host

Install Ollama on macOS if you haven't already, confirm it's at least version 0.14, and pull a model that handles agentic coding tool calls reasonably well:

ollama pull qwen2.5-coder:7b

Ollama listens on 127.0.0.1:11434 by default and serves the Anthropic-compatible surface from the same port as everything else — no separate flag to enable it.

2. Create the workspace with AI Bridge enabled

In Velo Workspaces, create a new Linux workspace, pick the AI Sandbox profile (or enable AI Bridge manually on any profile), and set Host Provider to Ollama. This is the same vsock-based bridge covered in the AI Bridge architecture post — the model stays on the host's GPU the whole time; only Claude Code's own command execution happens inside the disposable VM.

3. Install Claude Code inside the VM

Inside the guest, install the Claude Code CLI the normal way for that distro (via npm install -g @anthropic-ai/claude-code, or the platform-specific installer). Nothing about the installation itself is different running inside a VM.

4. Point it at AI Bridge instead of Anthropic's API

Set three environment variables before launching, instead of the OPENAI_API_BASE this blog's other guides use:

export ANTHROPIC_BASE_URL=http://127.0.0.1:<port>
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
claude --model qwen2.5-coder:7b

Two details that are easy to get wrong because they're both different from the OpenCode setup:

  • No /v1 suffix on the base URL. OpenCode's OPENAI_API_BASE needs /v1 appended; Claude Code's ANTHROPIC_BASE_URL doesn't — it appends /v1/messages itself. Adding /v1 yourself here just breaks the path.
  • The variable is read once, at process start. Changing ANTHROPIC_BASE_URL in one terminal doesn't affect a claude process already running in another — restart it after any change, or you'll be debugging a "wrong" endpoint that's actually just stale.

ANTHROPIC_AUTH_TOKEN=ollama is a placeholder value here, not a real credential — Ollama doesn't check it, but Claude Code requires something non-empty in the Authorization header before it will send a request at all.

Why isolate it in the first place

The reason to run any coding agent inside a disposable VM rather than directly on your Mac doesn't change based on which agent it is: Claude Code executes shell commands and edits files with whatever permissions the process running it has, and real 2026 incidents — including one against Claude Code's own project-load flow — show that "the agent behaves correctly" isn't a boundary you can rely on by itself. Running it inside a Disposable Workspace means a compromised or simply mistaken session doesn't outlive closing the VM, and AI Bridge means you don't give up the host GPU to get that isolation.

Related reading: the architecture behind AI Bridge, the same setup for OpenCode and for Continue in VS Code, what running an agent this way actually costs in inference speed, and what actually goes wrong when a coding agent runs unsandboxed. Or download Velo Workspaces and try it yourself.