I Got Tired of Paying Frontier Prices for Markdown Formatting — So I Built a Model Switcher

I Got Tired of Paying Frontier Prices for Markdown Formatting — So I Built a Model Switcher

If you’ve spent any real time building with AI coding agents, you’ve probably noticed something a bit absurd: the same expensive, heavyweight model that can reason through a distributed systems bug is also the one being asked to clean up a JSON file or reformat some HTML. It works, sure. But it’s like hiring a senior architect to change a light bulb.

That mismatch is what pushed me to build ModelSwitcher Agent — a small orchestration system that decides, task by task, which model actually deserves to do the work.

The problem I kept running into

Working across both Claude Code and Codex-based setups, I kept hitting the same handful of issues:

Token consumption gets out of hand fast. Agents tend to resend context they already have, scan repositories they don’t need to, and produce far more verbose output than the task called for.

Model allocation is lazy. Most setups just pick one model and use it for everything — architecture decisions and markdown formatting get treated the same way. Using a top-tier reasoning model for HTML cleanup isn’t a small inefficiency, it’s just wasteful.

There’s no runtime intelligence. Nothing is checking whether a task is trivial or genuinely hard. Nothing is tracking what you’re actually spending. Nothing is compressing context that’s gone stale.

Context tends to explode. Repos get rescanned, files get reloaded even when nothing changed, and prior context gets duplicated — and past a certain point that starts hurting reasoning quality, not just your wallet.

None of this is a knock on the models themselves. It’s a gap in how we’re using them.

What the tool actually does

ModelSwitcher Agent routes each task to a model based on its complexity, how much reasoning depth it needs, latency requirements, and your token budget. In practice, that looks something like this:

  • Formatting or cleanup tasks → a small, cheap model
  • Standard CRUD API work → a mid-tier model
  • Architecture decisions or security analysis → the frontier model
  • Documentation → a lighter model tuned for that kind of writing

It also escalates or downgrades automatically as a task evolves, logs token usage so you can actually see what’s happening, and compresses context along the way instead of letting it balloon.

The setup itself is intentionally low-friction. For Claude Code, you drop a CLAUDE.md file into your project root or your ~/.claude folder. For Codex, it’s an AGENT.md file in the equivalent spot. If you already have one of those files, you just make sure the new content goes in first. Restart the agent, and it’s routing.

Being honest about the savings number

Here’s the part I want to be upfront about, because it’s where a lot of “AI cost savings” claims fall apart under scrutiny.

You’ll often see figures like “80% cheaper” thrown around for model routing, and that’s technically true — but only as a per-token, list-price comparison between the cheapest and most expensive tiers. It’s not what you’ll actually see across a real workload.

The heavy tasks — deep architecture work, multi-step agentic reasoning, large-codebase analysis — genuinely need the frontier model regardless of routing, and those tasks dominate total spend by nature. Routing only helps on the lighter, more frequent stuff sitting around them.

When I modeled this against a realistic “many small tasks, some medium, a few heavy ones” coding workload, the blended saving landed closer to 20% — not 80%. And that number moves depending on your own task mix: lean more trivial and you’ll save more, lean more reasoning-heavy and you’ll save less.

Rather than ask anyone to just take my word for it, the repo ships a benchmark harness so you can measure it against your own workload:

cd benchmark
python3 benchmark.py # modeled projection, no API calls needed
python3 benchmark.py --live # real measurement, needs ANTHROPIC_API_KEY

A live-measured result on a real-world workload is still on my roadmap — I’d rather publish something true and modest than something flashy and wrong.

Why I think this matters

None of this is groundbreaking research. It’s closer to just applying a bit of common sense to how these agents get used day to day — the same instinct that makes you not call a plumber to change a light bulb. As more of us lean on AI agents for actual production work, the cost of not thinking about this adds up fast, both in dollars and in the noise it adds to context windows.

If you’re running Claude Code or Codex regularly and have felt that twinge of “did this really need the expensive model,” the repo is open and the setup takes a few minutes: github.com/neps-in/model-switcher-agent.

Napoleon Arouldas
Napoleon Arouldas
Articles: 4

Leave a Reply

Your email address will not be published. Required fields are marked *