A local router for cutting Claude Code model costs
A Claude Code workflow uses a small skeleton to avoid sending simple jobs to expensive by default. It is built with bash and Python standard only, with no and no pip install. The main idea is a local Ollama task router that scores each job from 0 to 10.
Jobs scored 0 to 5 go to such as , Groq, or Cerebras. Jobs scored 6 to 7 go to a mid-range model such as Groq llama-3.3-70b. Only jobs scored 8 to 10 are sent to when no cheaper choice looks suitable.
Every routing choice is saved in a JSONL log, so the real model-use pattern can be measured instead of guessed. In one personal log, 95 out of 98 choices avoided Claude’s top tier, but the setup was heavily tuned and the sample was small, so that number is not a general promise. The skeleton also includes session and a secret-scan gate, while the scoring logic may not work equally well in every setup.
Key points
- The setup routes Claude Code tasks by difficulty before choosing a model.
- Scores 0 to 5 go to such as , Groq, or Cerebras.
- Scores 6 to 7 go to a mid-range model, while 8 to 10 can use .
- Each routing decision is stored in a JSONL log for later review.
- The reported 95 of 98 top-tier avoidances came from one small, heavily tuned personal setup.