Free AI Router Cuts Coding Costs by Up to 85% (Setup Guide)

You do not need three separate AI subscriptions to code well. A free, open-source router can sit between your coding tool and every major model, then quietly send each prompt to whichever one can handle it for the least money.

Here’s the thing. Most people paying for Claude, ChatGPT, and Gemini at the same time are not doing it because they need all three for every task. They are doing it because switching between them by hand is annoying, and because nobody wants to be stuck mid-project when one hits a rate limit. A router fixes both problems at once.

The tool getting attention right now is called llm-router, and it does exactly what a lot of coding-cost videos have been describing lately without naming a specific project. It sits quietly between your coding tool (Claude Code, Codex CLI, Gemini CLI, Cursor, or anything that speaks MCP) and whichever model providers you have connected. Every prompt gets classified, then routed to the cheapest model that can actually do the job.


What This Router Actually Does

The idea is simple, but the mechanics are worth understanding before you install anything. When a prompt comes in, a classifier decides how hard the task looks. Most of that classification is free: regex-style heuristics catch a large share of prompts instantly. For the ambiguous ones, it can fall back to a cheap local model or Gemini Flash to make the call, at a fraction of a cent per decision.

Once the difficulty is scored, the router walks a chain of models from cheapest to most capable. A quick syntax question might land on a local Ollama model or a free Gemini tier. A gnarly refactor gets bumped up to GPT-4o or Gemini Pro. Something that genuinely needs deep reasoning, like designing a distributed tracing strategy, goes to Claude Opus or a reasoning-tier model. You are not manually swapping models in a dropdown. The tool is doing that triage for you, on every single prompt.

It also handles the annoying failure case nobody plans for. If a provider is rate-limited, down, or out of quota, the router automatically falls through to the next option in the chain instead of just erroring out on you mid-session.


Why It’s Worth Paying Attention To Right Now

Multi-model workflows have quietly become the norm rather than the exception. Developers routinely have a Claude subscription for architecture work, a ChatGPT or Codex plan for quick iteration, and a Gemini key for anything long-context. Nobody sat down and planned this. It happened because each model genuinely is better at different things, and switching costs friction, not money, so people just paid for everything.

A router is the natural answer to that mess. llm-router has been independently scored on RouterArena, a community leaderboard that benchmarks routers on accuracy, latency, cost efficiency, and fallback reliability, which matters if you want more than a vendor’s own word that a routing tool works. It is also a small, actively maintained project, not a sprawling enterprise platform, which means the setup stays approachable for a solo developer or a small team rather than something that needs a platform engineer to babysit.


Step-by-Step: Set It Up

The whole process takes about five minutes if you already have at least one model provider key sitting around. Here is the order to do it in.

Step 1: Install the package

pip install llm-routing
llm-router install

The PyPI package is named llm-routing, but the command you actually run is llm-router. That mismatch trips people up on the first try, so double-check you typed the CLI command correctly if it does not respond.

Step 2: Add your provider keys

You only need one provider to get started. Add whichever ones you already pay for or have free access to.

export OPENAI_API_KEY="sk-..."
export GEMINI_API_KEY="AIza..."
export OLLAMA_BASE_URL="http://localhost:11434"
export OPENROUTER_API_KEY="sk-or-v1-..."

If you already run Claude Code on a Pro or Max plan, you can skip API keys entirely for a first test. Routing works through MCP tool calls that only reach out to external models when doing so is actually cheaper, so there is no setup tax just to try it.

Step 3: Verify your providers are connected

llm-router health

This checks connectivity for everything you configured and flags anything that is not responding, before you get halfway into a coding session and hit a silent failure.

Step 4: Point it at your coding tool

llm-router install # Claude Code (default)
llm-router install --host codex # Codex CLI
llm-router install --host gemini-cli # Gemini CLI
llm-router install --host vscode # VS Code
llm-router install --host cursor # Cursor

For Claude Code, Codex CLI, and Gemini CLI, this installs hooks that intercept and route prompts automatically, so your existing workflow does not change at all. For VS Code and Cursor, routing happens through MCP tools you call on demand rather than automatically, which is worth knowing before you assume every prompt is being routed in those editors.


How It Decides Which Model To Use

Routing behavior is controlled by a policy, and you can pick how aggressively it should chase savings versus how conservatively it should protect quality.

PolicyTypical SavingsBest For
Aggressive60 to 75 percentMaximum cost reduction
Balanced (default)35 to 45 percentA middle ground between cost and quality
Conservative10 to 15 percentQuality first, savings second
Cost Aggressive70 to 85 percentRoutes through OpenRouter’s open-weight models plus task specialists

Switching policy is one environment variable:

export LLM_ROUTER_POLICY=aggressive

There is also an enforcement setting worth knowing about if you are trying to protect a Claude Code subscription’s five-hour quota specifically. Setting enforce: smart with mode: zero_claude in the router’s config blocks a prompt from silently falling through to a native Claude turn. If you genuinely want Claude Code to handle something itself, you prefix the prompt with claude: on purpose.


What The Savings Actually Look Like

A quick heads-up before you get excited about specific percentages: these numbers depend heavily on your workload. If your day is mostly boilerplate and simple questions, you will land near the high end of a policy’s range. If you spend most of your time on genuinely hard problems, you will not, because the router is supposed to send those to the expensive model anyway.

The project’s own methodology compares your actual spend against a baseline where every single prompt went to the most expensive model in your chain. Token counts are estimated rather than pulled from an exact tokenizer, and cost data comes from pricing tables that can lag behind provider price changes. The maintainers are upfront that a widely shared “87 percent” figure represents one person’s peak result over a specific stretch, not a number you should expect by default. The honestly documented range is 35 to 80 percent, which still adds up fast if you are running dozens of prompts a day.


The Honest Caveats

This is a genuinely useful tool, but a few things are worth knowing before you build your whole workflow around it.

It runs entirely on your own machine. There is no hosted proxy and no account required, which is good for privacy, but it also means your prompts get sent to whichever provider the router picks, exactly as if you had called that provider directly. Read that provider’s privacy policy the same way you would if you were using it on its own.

Usage logs are not encrypted by default. They sit in a local SQLite file. If that matters to you, turn on full-disk encryption on the machine running it.

Classification is not perfect. A router can occasionally send a harder task to a cheaper model than it deserved, which is exactly why the conservative policy exists for people who would rather lose some savings than risk a weak answer on something important.

It is a small, community-run project. That is a strength for transparency and speed of iteration, but it also means fewer guarantees than a funded enterprise product. Check the issues page before you lean on it for anything mission-critical.


Who This Actually Makes Sense For

If you already juggle two or more paid AI coding tools and you are tired of manually deciding which one gets which prompt, this closes that gap without asking you to give any of them up. It is also a solid fit if you are trying to stretch a single subscription’s usage limits further, or if you just want visibility into where your AI spend is actually going instead of guessing at the end of the month.

If you only use one model for everything and you are happy with that, you probably do not need this yet. The value shows up once you are paying for more than one provider at a time.


The Bottom Line

The real shift here is not the tool itself. It is that picking a single AI model for everything is starting to look like the wrong question. The interesting decision is no longer “which model,” it is “which model for which prompt,” and that is exactly the decision a router is built to make for you, automatically, every single time you hit enter.

If you want to keep the interface you already know but stop overpaying for questions that did not need your most expensive model, this is a five-minute setup with a real payoff. It also pairs well with our guide on running Claude Code on free models entirely, if you want to push costs even lower on top of smarter routing.

Stop guessing which AI model to use. Let a free router do the math for you, on every prompt, automatically.


Sources and Further Reading

  1. llm-router on GitHub
  2. llm-routing package on PyPI
  3. RouterArena independent router benchmark
  4. llm-router provider setup documentation
  5. llm-router routing policy documentation
  6. 2026 guide on LLM gateways and multi-model routing trends

Leave a comment

Website Built by WordPress.com.

Up ↑