Search
AI Tutorial

Claude Code Router: Run Local AI Agents in 14 Steps [2026]

Daniel Okafor
Daniel OkaforSenior AI Reporter
27 min read
Claude Code Router: Run Local AI Agents in 14 Steps [2026]

Claude Code Router reached version 3.1.3 on October 9, 2026, and the update quietly solved the biggest complaint developers had about running Anthropic’s coding agent against anything other than the official API: the old setup meant hand editing JSON files and hoping the syntax was right. The newest release ships a desktop application and a browser based management UI on top of the local gateway, which means you can wire Claude Code to a model running on your own machine through Ollama or LM Studio without touching a config file by hand, though the file is still there if you want it.

The sections below cover through the full setup from a clean machine to a working local coding agent: picking hardware that can actually run a coding capable model, installing a local inference backend, wiring Claude Code Router to it, and adding a cloud fallback so you are not stuck when a task is too big for your laptop. By the end you will have a complete, working configuration you can copy, plus the pitfalls and troubleshooting steps that trip up most first attempts.

Google · Preferred Sources

Don't miss new tech stories on Google

Add TrendinTech once in the Google app and our stories appear in your news suggestions.

Add Now

What Claude Code Router Does and Why It Matters Right Now

Claude Code is Anthropic’s terminal and IDE based coding agent, built into the Claude product lineup alongside Claude.ai and the Claude Platform. By default it talks to Anthropic’s own models over the API: Claude Opus 5.5, which Anthropic shipped on September 22, 2026, for long running agentic coding work, Claude Sonnet 5.5, announced September 28, 2026, as a faster and cheaper upgrade over Sonnet 5, and Claude Haiku 5.5, released October 7, 2026, for lighter, latency sensitive tasks such as classification and routing. That is a good default. It is also not the only option, and for a lot of developers it is not even the preferred one.

Claude Code Router is a third party project, built and maintained independently of Anthropic under the name musistudio/claude-code-router, that sits between Claude Code and whatever model actually answers the request. Instead of Claude Code talking directly to Anthropic’s servers, it talks to the router, and the router decides where the request actually goes. Current documentation describes that scope broadly: the router can point Claude Code at DeepSeek, Qwen, GLM, MiniMax, Gemini, or a model running locally on your own hardware through an OpenAI compatible server such as Ollama or LM Studio.

The pitch for doing this is not just saving money, though that is part of it. A local setup means your code never leaves your machine for the tasks you route locally, which matters if you work on anything under an NDA or simply do not want a proprietary codebase touching a third party API by default. It also means you keep working on a plane, in a client’s secure facility, or any other place without a reliable connection. And according to the 2025 Stack Overflow Developer Survey, “84% of respondents use or plan to use AI tools in their development process,” with 51% of professional developers using AI tools daily, so the audience for a setup like this is not a small one.

There is a real tradeoff, and it is worth naming up front before you spend an evening on this. Local models are smaller than Opus 5.5 or Sonnet 5.5, slower unless you have serious hardware, and weaker at the kind of long, multi file reasoning that frontier cloud models handle well. The same Stack Overflow research found that only 29% of technologists trust the accuracy of the AI tools they use, and that skepticism applies at least as much to a 30 billion parameter local model as to a cloud one. The router is not magic; it is a dispatcher. What you get out of it depends entirely on what you route where, which is most of what the sections below cover.

Prerequisites: Hardware, Software, and Account Requirements

Before installing anything, confirm you actually have what this setup needs. None of these are exotic, but skipping the check is the single most common reason a Claude Code Router install stalls halfway through.

  • Node.js, a current LTS release, since Claude Code Router installs as a global npm package and the npm CLI needs to be on your path.
  • Claude Code itself, installed and already authenticated against your Anthropic account at least once, so you know the baseline works before you add a router in front of it.
  • A local inference backend: either Ollama, currently on stable release v0.40.6 as of October 16, 2026, or LM Studio’s desktop application, which serves local models through an OpenAI compatible endpoint on your machine.
  • Claude Code Router v3.1.3 or newer, released October 9, 2026 with a refreshed CDN model catalog and a 3.x desktop and browser based management interface.
  • Hardware headroom: at minimum 16GB of system RAM for a small coding model, 24GB or more if you want to run something in the 70 billion parameter class at a workable quantization, and significantly more, in the range of 150GB plus, if you intend to run a large mixture of experts model like DeepSeek V4 Flash locally on a workstation.
  • A terminal you are comfortable in, on macOS, Linux, or Windows (Windows users should expect to run the router and backend either natively or inside WSL2, since most of the underlying tooling targets a POSIX style shell first).
  • Optional but recommended: a cloud API key for a fallback provider, whether that is your existing Anthropic key for Claude Haiku 5.5 or an account with one of the providers the router supports, so hard tasks do not stall on an undersized local model.

If you are missing the hardware for a serious local model, that is fine. Step 1 covers how to pick a model that actually fits what you have rather than what the leaderboards are running.

Step 1: Audit Your Hardware and Pick a Quantization Target

Start by being honest about your machine. Open Activity Monitor, Task Manager, or free -h on Linux and note your total RAM, and if you have a dedicated GPU, note its VRAM separately since that changes what you can offload. This number is the single biggest constraint on this entire project, more than the router configuration, more than which model benchmarks best this week.

As a rough guide based on current model listings: a 24GB machine comfortably runs a quantized model in the class of NVIDIA’s Nemotron 3.5 Bolt, a smaller 74 billion parameter sibling intended for everyday agentic tasks. Smaller agent-oriented mixture of experts models that total 24 to 30 billion parameters but only activate 2 to 3 billion per token, the architecture pattern used across most current coding focused open weight releases, run acceptably on a modern laptop with 16 to 24GB of unified memory or dedicated VRAM. If you are below 16GB, stick to the smallest available coding model and expect the cloud fallback you configure in Step 12 to carry most of the real work.

Do not skip this step to “just try the biggest one.” A model that does not fit in memory will either refuse to load, or load and swap to disk, which on a coding agent task means minutes per response instead of seconds, which defeats the entire point of running locally.

Step 2: Install Node.js and Verify Your Environment

Claude Code Router ships as an npm package, so Node.js has to be installed and resolvable before you go any further. If you already have Node installed for other projects, confirm the version and npm’s global bin directory is on your shell path.

node --version
npm --version
npm config get prefix

If any of those three commands fail, install Node.js through your platform’s package manager (Homebrew on macOS, your distribution’s package manager on Linux, or the official Windows installer) before continuing. The last command, npm config get prefix, tells you where global packages land; if that directory is not on your PATH, the ccr command you install in Step 6 will not be found afterward, which is one of the most common early failure points in this whole setup.

Step 3: Install a Local Inference Backend: Ollama or LM Studio

Claude Code Router does not run models itself. It needs a local server that speaks an OpenAI compatible API, and the two most common choices are Ollama and LM Studio. Pick one to start; you can add the other later since the router treats each as just another provider.

Option A: Ollama

Ollama’s current stable release is v0.40.6, published October 16, 2026, with a release candidate for v0.40.7 already out as a pre-release a couple of days later. Download the installer for your platform from Ollama’s own site, run it, and confirm the install from a terminal:

ollama --version
ollama list

Ollama has grown well beyond a pure local runner over the past few months. As of its August 31, 2026 update it added paid Pro, Max, and Team plans with per-token pricing and bundled usage, and as of October 2026 it also offers cloud hosted model execution for models you have not downloaded locally. None of that is required for this tutorial: the free local runtime, which serves its API on port 11434 by default, is all Claude Code Router needs to talk to.

Option B: LM Studio

LM Studio’s desktop application remains free for personal and work use, with local inference and a local server bundled in at no per-token cost, as of its current October 2026 product description. It is a separate product from LM Studio Bionic, which is the company’s paid agent and workspace layer for cloud hosted models; you do not need Bionic for this tutorial, only the core desktop app and its local server toggle. Download it, install it, load a model through the app’s model browser, and enable the local server from LM Studio’s developer tab, which serves an OpenAI compatible endpoint on port 1234 by default.

Either backend works with Claude Code Router the same way: as a named provider pointing at a local URL. The rest of this guide uses Ollama in its examples, but every step has a direct LM Studio equivalent, since both expose the same OpenAI style /v1/chat/completions surface.

Step 4: Pull a Current Coding-Capable Local Model

With a backend installed, the next decision is which model to actually run. The requirement for Claude Code Router is not just raw benchmark quality, it is reliable tool calling, since Claude Code depends on the model correctly invoking file edit, search, and shell tools rather than just describing what it would do in plain text. A model that scores well on general chat benchmarks but handles tool calling poorly will produce a frustrating agent experience no matter how the router is configured.

Several current open weight releases specifically target this agentic, tool calling use case rather than general chat. The table below lists what is currently available through Ollama as of mid to late October 2026, based on confirmed release notes rather than marketing copy.

ModelParametersContext WindowTypical HardwareBest Fit
Nemotron 3.5 Lightning30B total, 3B active (MoE)Not confirmedConsumer GPU/laptopAgents that stay running, gather context, and call tools continuously
Nemotron 3.5 Bolt74B total (2-bit quant target)Not confirmed24GB RAM/VRAM machinesEveryday agentic coding tasks
Nemotron 3.5 Super120B totalUp to 1,000,000 tokensWorkstation classCoding, reasoning, tool use, document understanding
Qwen3-Coder-30B30BNot confirmedConsumer GPU/laptopFaster, more reliable tool calling (updated in Ollama’s newer engine)
DeepSeek V4 Flash 0731284B total (MoE)Not confirmed~156GB system RAMLarge local runs on workstation hardware, MIT licensed

The Nemotron 3.5 Lightning listing is worth reading directly from Ollama’s own description: it is “a 30 billion parameter (3B active) open model built for agents that stay running, gathering context, calling tools, and working through multi-step tasks on your own hardware,” which is close to a textbook description of exactly what Claude Code Router needs on the local side. LocalClaw’s October tracker of new local releases also lists smaller coding focused options such as Mellum2.1 and LFM2.5-24B-A2B, though you should check each project’s own release notes for exact parameter counts and context limits before relying on the numbers quoted anywhere else, including here.

Once you have picked a model that fits your hardware from Step 1, pull it through Ollama:

# replace the model name with whatever tag appears in your
# backend's model browser or catalog for the model you picked
ollama pull qwen3-coder:30b

# confirm it downloaded and is runnable
ollama run qwen3-coder:30b "write a hello world function in python"

If the test prompt returns a sensible answer within a few seconds, the model is loaded correctly and you are ready to wire it into the router.

Step 5: Start Your Local OpenAI-Compatible Server

Ollama serves its API automatically once it is running, so if the pull and run commands in Step 4 worked, the server is already live on http://localhost:11434. Confirm it is reachable and responding in the OpenAI compatible format the router expects:

curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-coder:30b",
    "messages": [{"role": "user", "content": "say OK"}]
  }'

A successful response comes back as JSON with a choices array containing the model’s reply. If you get a connection refused error here, Ollama is not running as a background service, which is addressed in the troubleshooting section below. If you are using LM Studio instead, the equivalent check points at http://localhost:1234/v1/chat/completions once the local server toggle is switched on in the app’s developer tab.

This check matters more than it looks like it should. The router’s error messages when a backend is unreachable are often generic timeouts rather than a clear “connection refused,” so confirming the raw endpoint works with curl before adding the router in front of it saves real debugging time later.

Step 6: Install Claude Code Router v3.1.3

With a working local backend confirmed, install the router itself as a global npm package:

npm install -g @musistudio/claude-code-router
ccr --version

The project’s October 9, 2026 release, v3.1.3, added a refreshed CDN model catalog on top of the broader 3.x architecture shift, which replaced the older hand edited JSON only configuration workflow with the desktop application and browser based management UI you will use in the next step. If ccr --version does not print a version number, revisit Step 2 and confirm npm’s global bin directory is on your shell’s PATH, since that is by far the most common install failure at this stage.

Step 7: Launch the Router UI and Create a Provider Profile

Claude Code Router’s 3.x line includes a management interface you can open directly from the command line:

ccr ui

This opens a browser based dashboard where you define providers, which are named connections to a model source, whether that is a cloud API or a local server. Create a new provider for your local backend with a name you will recognize later, such as local-ollama, pointing at the base URL from Step 5. The UI also exposes the router’s refreshed model catalog from the CDN, which you can use to browse supported cloud providers including DeepSeek, Qwen, GLM, MiniMax, and Gemini if you want to add any of those alongside your local setup.

If you would rather configure everything by hand instead of through the browser UI, the router still reads a JSON configuration file directly, and Step 10 shows a complete working example you can copy and adapt instead of clicking through the interface.

Step 8: Point the Router at Your Local Backend

Inside the provider you created in Step 7, set the following fields to match your local server:

  • Base URL: http://localhost:11434/v1 for Ollama, or http://localhost:1234/v1 for LM Studio.
  • API key: local backends generally do not check this value, so a placeholder string such as local-key is enough to satisfy the field.
  • Model name: the exact tag you pulled in Step 4, for example qwen3-coder:30b, matched exactly, since a mismatch here is a common cause of silent 404 errors.
  • Protocol: OpenAI compatible chat completions, which both Ollama and LM Studio implement.

Save the provider, then use the UI’s built-in test or send a short prompt through the router’s dashboard to confirm the local model answers before moving on to routing rules. A working test here means every later step is just routing logic layered on top of a connection you have already proven works.

Step 9: Configure Routing Rules for Default, Background, and Long-Context Work

This is the step that actually makes Claude Code Router useful rather than just an inconvenient extra hop. The router lets you assign different providers to different categories of request, so you are not forced into an all-local or all-cloud choice.

A sensible starting split looks like this: route the default category, which covers most everyday edits and questions, to your local model, since that is where you get the cost and privacy benefit on the bulk of your traffic. Route background tasks, things like generating commit messages or simple formatting, to the smallest, fastest model you have available, local or cloud, since quality matters least there. Route longContext work, meaning anything touching a large number of files or a long conversation history, to whichever provider actually supports the context length you need; Nemotron 3.5 Super’s reported 1,000,000 token window is one option here if you have the hardware, otherwise a cloud model is usually the more reliable choice, which is exactly what Step 12 sets up.

You do not have to get this split perfect on day one. Start with everything on local, notice where it struggles over a few real sessions, and move just those categories to the cloud fallback. That iterative approach beats trying to predict your own usage pattern in advance.

Step 10: Build the Router Configuration File

Whether you configured providers through the UI in Steps 7 through 9 or prefer to edit the file directly, it is worth seeing the complete structure in one place. Claude Code Router reads a JSON file that defines providers and the routing rules that assign categories to them. Here is a working example covering a local Ollama provider, a local LM Studio provider as a second option, and routing rules matching the split described in Step 9:

{
  "providers": [
    {
      "name": "local-ollama",
      "baseUrl": "http://localhost:11434/v1",
      "apiKey": "local-key",
      "models": ["qwen3-coder:30b"]
    },
    {
      "name": "local-lmstudio",
      "baseUrl": "http://localhost:1234/v1",
      "apiKey": "local-key",
      "models": ["nemotron-3.5-lightning"]
    }
  ],
  "router": {
    "default": "local-ollama,qwen3-coder:30b",
    "background": "local-lmstudio,nemotron-3.5-lightning",
    "longContext": "local-ollama,qwen3-coder:30b"
  }
}

Save this as the router’s config file (the UI will tell you the exact path for your platform, typically inside a hidden configuration directory in your home folder), then restart the router so it picks up the change. Model names inside the models array and inside the router rules must match exactly what your backend reports; a mismatch here produces a provider that looks correctly configured in the UI but fails on every real request.

Step 11: Set ANTHROPIC_BASE_URL and Launch Claude Code

With the router running and configured, the last connection to make is telling Claude Code itself to talk to the router instead of Anthropic’s servers directly. Claude Code reads the ANTHROPIC_BASE_URL environment variable for this, pointing it at a server that implements Anthropic’s Messages API, which is exactly what the router provides once it is running.

# start the router if it is not already running in the background
ccr start

# point Claude Code at the router instead of Anthropic's API directly
export ANTHROPIC_BASE_URL="http://localhost:3456"

# launch Claude Code as usual
claude

The exact port the router listens on is shown in its UI or startup logs; adjust the value above to match what you actually see rather than assuming it is identical on every machine. This export only persists for your current shell session, which is useful while testing, but Step 14 covers making it stick permanently once you are happy with the setup.

Step 12: Test Tool Calling, File Edits, and Terminal Commands

Do not trust a plain chat response as proof the setup works. Claude Code’s actual value comes from tool calling: reading files, editing them, and running shell commands on your behalf, and that is exactly where weaker local models most often fail even when they handle conversation perfectly well. Run a deliberately practical test in a small, disposable project directory:

  • Ask Claude Code to read a specific file and summarize it, confirming the model can actually invoke the read tool rather than guessing at contents.
  • Ask it to make a small, verifiable edit, such as adding a single function with a docstring, then check the diff yourself rather than trusting the model’s description of what it did.
  • Ask it to run a simple shell command, like listing a directory or running an existing test file, to confirm tool execution round trips correctly through the router and back.

If any of these fail with the model producing a plain text description instead of an actual tool call, the model you picked in Step 4 likely does not have reliable enough tool calling support for this workflow, and you should either pick a model specifically documented as agent oriented or lean more heavily on the cloud fallback from Step 12 onward for anything involving file edits.

Step 13: Add a Cloud Fallback Provider for Hard Tasks

A purely local setup is appealing in theory but frustrating in practice the moment you hit a task your hardware genuinely cannot handle well. Add a second provider pointing at a cloud model, and route your hardest categories, typically longContext and anything requiring careful multi-file reasoning, to it instead of forcing a small local model to struggle through.

Claude Haiku 5.5 is a reasonable low cost fallback for lighter tasks that still benefit from a frontier model’s judgment: Anthropic’s published pricing for it is $0.10 per million input tokens and $0.50 per million output tokens for prompts up to 100,000 tokens, rising to $0.50 input and $2.50 output per million tokens above that length. For genuinely difficult, long running agentic work, Claude Opus 5.5 is the stronger but pricier option. The table below lines up what you are actually trading off between local and cloud for this kind of setup.

FactorLocal Model (via Router)Cloud Fallback (Claude Haiku 5.5 / Opus 5.5)
Per-token cost$0 beyond hardware and electricity$0.10 to $0.50/MTok in (Haiku 5.5, tiered by prompt length); higher for Opus 5.5
Data exposureStays on your machineSent to Anthropic’s API
Context windowVaries by model, up to 1M tokens for some open models like Nemotron 3.5 SuperUp to 1,000,000 tokens on current 5.5-series Claude models
Tool calling reliabilityModel dependent, uneven across open weight releasesConsistently strong, purpose built for Claude Code
Offline availabilityFully offline capableRequires network connection

Add the cloud provider the same way you added the local one in Step 7, using your existing Anthropic API key, then update your routing rules from Step 9 to send the categories you decided were too risky for a local model to this new provider instead.

Step 14: Lock Down and Persist Your Configuration

Once the setup works the way you want, two things remain: making it survive a reboot, and making sure you have not accidentally exposed a local gateway to your whole network.

To persist the connection between Claude Code and the router, add the export ANTHROPIC_BASE_URL line from Step 11 to your shell’s profile file (.zshrc, .bashrc, or the equivalent PowerShell profile on Windows) so it is set automatically in every new terminal session, rather than typing it manually each time. For the router itself, check whether your platform supports running ccr as a background service or startup item, which the desktop application generally offers through its own settings panel.

For security, confirm the router and your local backend are both bound to localhost or 127.0.0.1 rather than 0.0.0.0, unless you specifically intend other machines on your network to reach them. A router listening on every interface with a placeholder API key is a small but real exposure if you are on a shared or public network, since anyone who can reach that port can send requests through your configured providers, including any cloud fallback you added in Step 13.

Complete Working Project: A Local-First Claude Code Setup

Putting every step together, here is the full setup as a single reference, combining the router configuration from Step 10 with a startup script that brings up the backend, the router, and Claude Code in the right order.

#!/usr/bin/env bash
# start-local-agent.sh
# Brings up a local-first Claude Code Router session.

set -e

echo "Starting Ollama (if not already running)..."
ollama serve &
sleep 2

echo "Confirming local model is reachable..."
curl -s http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3-coder:30b","messages":[{"role":"user","content":"ping"}]}' \
  > /dev/null && echo "Local backend OK"

echo "Starting Claude Code Router..."
ccr start &
sleep 2

echo "Routing Claude Code through the local router..."
export ANTHROPIC_BASE_URL="http://localhost:3456"

echo "Launching Claude Code..."
claude

Pair that script with the router config from Step 10, and you have a reproducible project: one command brings up a coding agent that handles everyday edits on your own hardware at no per-token cost, while still falling back to Claude Haiku 5.5 or Opus 5.5 through the same router for anything that needs more context or more careful reasoning than your local model can reliably deliver.

Common Pitfalls When Running Claude Code Locally

Most failed setups trace back to one of a small set of recurring mistakes. Checking against this list before asking for help usually saves a round trip.

  • Mismatched context windows. If your router configuration assumes a larger context window than the local model actually supports, long sessions silently truncate earlier messages, and the model starts contradicting or forgetting earlier instructions without any error message.
  • Picking a model without reliable tool calling. A model that chats well but cannot invoke tools correctly will describe edits instead of making them, which looks like a router problem but is actually a model selection problem from Step 4.
  • Port conflicts between backends. Running Ollama and LM Studio at the same time on a machine where something else already uses port 11434 or 1234 produces confusing connection errors that have nothing to do with the router itself.
  • Undersized hardware causing swap thrashing. A model that technically loads but forces your system into disk swap will respond so slowly that it is effectively unusable, even though nothing is technically broken.
  • Forgetting to restart after a config change. Both the router and most local backends cache configuration at startup; editing the JSON file or changing a model in the UI often needs an explicit restart to take effect.
  • Assuming local and cloud timeouts are the same. Local inference on CPU-only hardware can take far longer per response than a cloud API call, and a timeout value tuned for cloud latency will cut off a local model mid-response.
  • Leaving the gateway open to the network. Binding the router or backend to 0.0.0.0 instead of localhost when you did not mean to, covered in Step 14, is an easy mistake with real exposure on a shared network.

Troubleshooting Claude Code Router: Fixes for Common Errors

When something does not work, start here before digging further.

  • “Connection refused” when testing the backend directly. The local server is not actually running. Restart Ollama or reopen LM Studio and re-enable its local server toggle, then retest with the curl command from Step 5 before touching the router again.
  • Claude Code still appears to hit Anthropic’s API instead of the router. The ANTHROPIC_BASE_URL variable was not exported in the same shell session Claude Code is running from. Variables set in one terminal do not carry over to a different terminal tab, a different IDE integrated terminal, or a background process launched before the export ran.
  • Model answers in plain text instead of calling a tool. This is usually the model, not the router. Try a more capable or more explicitly agent-oriented model from Step 4’s options, or route that task category to your cloud fallback from Step 13.
  • Context overflow or truncated responses on large repositories. Your local model’s actual context window is smaller than the task needs. Either switch the longContext routing rule to a bigger-context local model or your cloud fallback, as described in Step 9.
  • Extremely slow token generation. Check whether your backend is actually using GPU acceleration. On Ollama, confirm GPU offload is active for your platform; on Apple Silicon, recent Ollama releases use the MLX runtime automatically for supported models, which should be noticeably faster than a CPU-only fallback.
  • Model download fails or stalls partway through. Check available disk space first, since larger models can require tens of gigabytes; a partial download with no free space left will silently stall rather than erroring clearly.
  • ccr ui will not open, or reports the port is already in use. Another process, possibly a previous router instance that did not shut down cleanly, is holding the port. Stop any existing ccr process before relaunching.
  • Provider looks correctly configured but every request returns a 404. Double check the base URL includes the correct path suffix (typically ending in /v1) and that the model name in your provider configuration exactly matches the tag your backend reports, since even a trailing version difference will cause a silent mismatch.
  • npm install -g fails outright. Confirm Node.js is actually installed and current, per Step 2, and that you have permission to write to npm’s global directory; on some systems this requires adjusting npm’s prefix rather than resorting to elevated permissions.
  • Costs show up even though you configured a local model. A routing rule you did not update is still pointing at a cloud provider for that task category. Review every rule from Step 9, not just the ones you remember changing.

Advanced Tips: Multi-Model Routing and Cost Control

Once the basic setup is stable, a few refinements make the difference between a demo and a daily driver.

Split routing further than the three categories covered in Step 9. The router supports assigning providers per category rather than just a blanket default, so you can send quick background tasks to your smallest, fastest local model, everyday edits to a mid-sized local model with solid tool calling, and anything flagged as long context straight to a cloud provider, without manually switching anything mid-session. This is where the router’s value compounds: a well-tuned split can keep the large majority of day-to-day requests local and free, while reserving a cloud spend only for the requests that actually need it.

Keep an eye on what each provider actually costs per session, not just per token. Letsdatascience’s ongoing coverage of open source and local LLM releases is a useful way to track which new coding-focused models are worth testing against your current setup, since the open weight field is moving fast enough that a model that was the best fit for your hardware three months ago may already have a stronger, similarly sized successor. Similarly, LLMCheck’s October 2026 index of local Mac performance is a reminder that raw parameter count is not the only variable; actual measured throughput on your specific hardware class can differ meaningfully from a model’s headline specs.

Finally, treat your router configuration as something to revisit, not something to set once. As new coding-focused open weight models ship, swap the model name in your existing provider definition rather than rebuilding the whole setup, and re-run the tool calling tests from Step 12 after any model change, since a newer model is not automatically a better fit for agentic tool use just because it benchmarks higher on general tasks.

Claude Code Router vs Cloud-Only Claude Code: What Actually Changes

It is worth being clear about what switching to a router actually buys you compared to just running Claude Code against Anthropic’s API directly, since the two setups are not competing for the same use case so much as covering different parts of your workload.

AspectCloud-Only Claude CodeClaude Code Router (Local + Fallback)
Setup complexityMinimal, works out of the boxHigher: backend install, model pull, router config
Best-case model qualityClaude Opus 5.5 / Sonnet 5.5, consistently strongMatches cloud only when a task is routed there
Everyday task costBilled per token on every requestFree for requests routed to a local model
Network dependencyRequired for every requestOnly required for requests routed to the cloud fallback
Maintenance overheadNone beyond keeping Claude Code updatedOngoing: backend updates, model swaps, config upkeep

Neither column is simply better. A developer working mostly on small, well-scoped tasks on hardware that can run a decent coding model gets real, ongoing value out of the router setup. A developer who mostly needs the strongest possible reasoning on complex, multi-file problems may find the maintenance overhead is not worth it compared to simply paying for Claude Opus 5.5 or Sonnet 5.5 directly. The router’s actual advantage is that it does not force that choice: a well-configured setup lets you keep both options live and let the task decide, through the routing rules from Step 9, rather than committing to one approach for every request.

According to one developer’s own writeup of a Claude Code local LLM setup, the core recipe is deliberately narrow: point ANTHROPIC_BASE_URL at a server speaking Anthropic’s Messages API, whether that is Ollama, LM Studio, or llama.cpp’s own server, and make sure whatever model answers has reliable tool calling and at least 64,000 tokens of context. Claude Code Router builds a management layer on top of exactly that same core idea, which is why the underlying mental model stays simple even once your routing rules get more elaborate.

Frequently Asked Questions

Is Claude Code Router an official Anthropic product?

No. Claude Code Router is an independently maintained third party project, published under the name musistudio/claude-code-router, not something built or officially supported by Anthropic. Claude Code itself is Anthropic’s product; the router is a separate tool that sits in front of it.

Does running Claude Code locally through the router actually cost nothing?

Requests routed to a local model carry no per-token charge, since the model is running on your own hardware. You are still paying for electricity and, if applicable, the hardware itself, and any request you route to a cloud fallback provider still bills at that provider’s normal rates, such as Claude Haiku 5.5’s published $0.10 to $0.50 per million token pricing.

Can I use a local model and Claude Opus 5.5 in the same setup?

Yes. That is the setup this tutorial builds in Steps 9 and 13: configure both as providers, then assign different routing categories, such as default versus longContext, to each one, so Claude Code automatically uses the right model for each kind of request without you switching anything manually.

What hardware do I actually need to run a coding-capable local model?

It depends on the model. Smaller agent-oriented models in the 30 billion parameter class with only a few billion active parameters run acceptably on 16 to 24GB of RAM or VRAM. Larger models like the 74 billion parameter Nemotron 3.5 Bolt target 24GB machines at a 2-bit quantization, while something like the 284 billion parameter DeepSeek V4 Flash needs roughly 156GB of system memory to run locally, which puts it out of reach for most laptops.

Is my code sent anywhere when I use a local model through the router?

When a request is routed to a local provider, it stays on your machine, since the model runs entirely through your local Ollama or LM Studio server with no outbound call. The moment a request is routed to a cloud fallback provider instead, whether that is Claude Haiku 5.5, Opus 5.5, or another supported provider, that request does leave your machine through the normal API call, exactly as it would without the router.

Which local model should I start with?

Match the model to your hardware audit from Step 1 before anything else. If you are on a 16 to 24GB machine, start with a smaller agent-oriented mixture of experts model built specifically for tool calling, such as one in the Nemotron 3.5 Lightning or Qwen3-Coder-30B class, and only move up to a larger model once you have confirmed tool calling works reliably in Step 12’s tests.

Does Claude Code Router work on Windows?

The router installs through npm the same way on Windows as on macOS or Linux, but most of the underlying local AI tooling it coordinates targets a POSIX style shell first. Windows users generally get the smoothest experience running the backend and router inside WSL2, though the desktop application and native Windows installs for both Ollama and LM Studio are also actively maintained.

What happens if my local model can’t handle tool calling well?

You will see it directly in Step 12’s tests: the model will describe an edit or a command instead of actually executing it through Claude Code’s tools. At that point your options are picking a different, more explicitly agent-oriented model from Step 4, or routing that specific task category to your cloud fallback from Step 13, which is exactly the kind of case the router’s per-category routing was built to handle.

Related Coverage

Daniel Okafor

Daniel Okafor

Senior AI Reporter

Daniel Okafor is the Senior AI Reporter at TrendinTech, where he covers large language models, machine learning research and the practical use of artificial intelligence across business and government. He has a particular interest in evaluation: how models are benchmarked, where those benchmarks fail and what that means for the companies betting on them.

All stories by Daniel Okafor (391)

Related Articles