Skip to content
claudemods

CC Model Router, a Claude Code model routing mod: pick Haiku, Sonnet or Opus per turn

Picks Haiku, Sonnet or Opus for each Claude Code turn from keywords in your prompt, with a cache-aware cooldown.

Permissions

  • Reads filesCan read files and list directories on your machine ($.fs.read / list / stat / exists).
  • Reads your promptsCan see what you type and the conversation transcript (prompt.* / session.append / session.messages).
  • Adds commands/toolsRegisters new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).
tested with
v2.1.310
last tested
requires
Claude Code ≥ 2.1.287
surfaces
none

Install inside Claude Code:

/plugin install cc-model-router --marketplace misterkante/cc-model-router
All install options ↓

What does this mod do?

CC Model Router is a community mod by Gilchrist Kante (misterkante). It does Claude Code model routing: before each turn it reads your prompt, guesses what kind of task it is, and sets the model and the effort level for that turn. Simple jobs go to Haiku with low effort, ordinary coding goes to Sonnet with medium effort, and debugging goes to Opus with high effort. The aim is to stop paying Opus prices for git status and to stop using Haiku on a flaky test.

The guess is a keyword count, not a model call. According to the plugin's source there are three tiers (mechanical, implementation, debugging) with built-in word lists, and you can add your own words or change a tier's model and effort in a JSON file. Prompts that start with / are ignored, and subagents are not routed. The repository also ships a separate npm command-line tool, ccmr; this page covers only the plugin in the plugin folder.

Install

Use any of the methods in the install block; they install straight from the author's own marketplace. Start a new session afterwards. There is no setup step, and /ccmr shows what the router is doing.

$ install cc-model-router

Requires Claude Code ≥ 2.1.287

Installs from the author's own marketplace: misterkante/cc-model-router

  1. 1.One line, inside Claude Code

    /plugin install cc-model-router --marketplace misterkante/cc-model-router

    Paste into a running session (v2.1.275+). Claude Code asks to add the marketplace first.

  2. 2.From your shell

    claude plugin marketplace add misterkante/cc-model-router
    claude plugin install cc-model-router@cc-model-router

    Then run /reload-plugins in any session that is already open.

  3. 3.Try it without installing

    git clone https://github.com/misterkante/cc-model-router
    claude --plugin-dir ./cc-model-router/plugin

    Loads the mod for one session only. Nothing is added to your settings.

How it works

The plugin is one hooks module, plugin/hooks/register.js, plus a classifier and a config merger. On prompt.submit it classifies the text and stores the decision. On turn.start it matches that decision to the turn, and on turn.step it rewrites the model and effort of the main agent's step. If the decision is "keep", the step passes through untouched. This is from register.js:

if (item.decision.action !== "apply") {
  return yield* next(e);
}

return yield* next({
  ...e,
  model: item.decision.model,
  effort: item.decision.effort
});

In the default per-turn mode, a move to a higher tier is applied at once. A move down is applied only when at least minTurnsBetweenSwitches turns (default 2) have passed since the last switch and the match confidence is at least minConfidence (default 0.5). Confidence is the winning tier's score divided by the total score; with no keyword match it is 0.4 and the default tier is used. In session mode the first decision is reused for the whole session, and in off mode nothing changes. The prompt.submit hook has a .catch that lets the prompt through unchanged if the router throws.

Customize it

There are no /config options. Settings come from ~/.claude/model-router.json (or the folder named by the CC_ROUTER_CONFIG_DIR environment variable) and from .claude/model-router.json in the project, which wins. You can set:

  • defaultTier: the tier used when no keyword matches.
  • tiers: a different model, effort or weight per tier.
  • extraKeywords: extra words per tier, for example words in your own language.
  • routing: mode (per-turn, session or off), cacheAware, minTurnsBetweenSwitches and minConfidence.

The repository includes examples/model-router.json as a starting point. After editing, send a prompt and run /ccmr to check the effect.

Permissions & safety

We read every file the plugin loads: plugin.json, hooks/hooks.json, hooks/register.js, lib/classifier.js, lib/config.js and the tests. It has no package.json, no install script, no bundled or minified code, no binary other than a PNG icon, and it imports nothing from outside its own folder. The repository's root-level CLI, hooks and benchmark scripts are not part of the plugin and were not loaded.

  • Changes model and effort: this is the point of the mod. The turn.step hook replaces model and effort on main-agent steps, so a wrong guess can send a hard task to Haiku or an easy one to Opus. Keywords are matched crudely, so check /ccmr if the model surprises you.
  • Gating hook: prompt.submit is a gating hook, but it only records the decision and always passes the prompt on, including when it fails.
  • Reads files: $.fs.exists and $.fs.read read the two model-router.json files above. $.env.get reads HOME and CC_ROUTER_CONFIG_DIR.
  • No writes, network or processes: it does not write files, run commands, open connections, start daemons or read secrets. It has no telemetry.
  • Command: it registers /ccmr, which prints the current model and the last decision, including the text of your last prompt, in the transcript.

The license is MIT with a LICENSE file. The copyright line names "cc-model-router contributors". claude plugin validate passed with no errors and no warnings, and the author's 7 tests passed on Claude Code 2.1.310.

Reads files
Can read files and list directories on your machine ($.fs.read / list / stat / exists).
Reads your prompts
Can see what you type and the conversation transcript (prompt.* / session.append / session.messages).
Adds commands/tools
Registers new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).

Compatibility & troubleshooting

Checked with Claude Code 2.1.310 on macOS (validate and tests). The mod needs a Claude Code build with function hooks. If nothing seems to change:

  • Run /ccmr. "no decision yet" means no prompt has been classified in this session.
  • Look for "routing": { "mode": "off" } in your global or project config.
  • Remember that prompts beginning with / and subagent turns are not routed.
  • In session mode only the first prompt's decision applies for the whole session.
  • Per-turn switching can invalidate the prompt cache, as the author's README states. If your cache hit rate drops, try session mode or raise minTurnsBetweenSwitches.

FAQ

Does the router call the API or send my prompts anywhere?
No. The classifier is a pure keyword matcher that runs inside Claude Code. The plugin makes no network requests, runs no processes and has no telemetry. It only reads two optional config files.
How does it decide which model to use?
It lowercases the prompt and counts keyword hits per tier. Mechanical words such as "rename", "lint" or "git commit" score for Haiku, words such as "implement", "add" or "refactor" score for Sonnet, and words such as "debug", "error" or "flaky" score for Opus. The highest score wins, and a prompt with no match falls back to the default tier, Sonnet.
Will switching models break my prompt cache?
It can, because a cache belongs to one model. The default settings are cache-aware. Moving up to a stronger model happens at once. Moving down needs at least two turns since the last switch and a confidence of 0.5 or more. You can turn the guard off with cacheAware set to false, or stop switching with the "session" or "off" modes.
Does it route subagents?
No. The turn hook returns early when the event has an agentId, so subagents keep the model they were given. The author's README lists this as a limitation.
How do I see what it decided?
Run /ccmr. It prints the current model, the last decision with the prompt it applied to, and the active mode, cacheAware and minTurns values.
Use Haiku running in Claude CodeFeatured

Use Haiku

Start a Claude Code prompt with _ and that one turn runs on Haiku, with a visible hint at every step.

  • spinner
  • transcript
  • status
  • Reads your prompts
  • Changes the UI

tested with v2.1.303

Token Weather running in Claude CodeFeatured

Token Weather

A weather forecast for your Claude Code context window above the prompt, with recent turns and a prompt-cache countdown.

  • above-prompt
  • Reads files
  • Runs commands
  • Changes the UI
  • Stores data

tested with v2.1.307

More in Context, quota, cost, Timers, todos, standups.