I used Cursor to cut my AI costs by 50-70% with a simple local hook
By PixelSurfer27 · ISSUE · About Cursor
I have been building with AI agents for \~18 months and realized I was doing what a lot of us do: leaving the model set to the most expensive option and never touching it again.
I pulled a few weeks of my own prompts and found:
* \~60–70% were standard feature work Sonnet could handle just fine
* 15–20% were debugging/troubleshooting
* a big chunk were pure git / rename / formatting tasks that Haiku handles identically at 90% less cost
The problem is not knowledge; we all know we should switch models. The problem is friction. When you are in flow, you do not want to think about the dropdown.
So I wrote a small local hook that runs before each prompt is sent in Cursor. It sits alongside Auto; Auto picks between a small set of server-side models, this just makes sure that when I do choose Opus/Sonnet/Haiku, I am not wildly overpaying for trivial tasks.
**It:**
* reads the prompt + current model
* uses simple keyword rules to classify the task (git ops, feature work, architecture / deep analysis)
* blocks if I am obviously overpaying (e.g. Opus for git commit) and suggests Haiksomeone
* blocks if I am underpowered (Sonnet/Haiku for architecture) and suggests Opus
* lets everything else through
* ! prefix bypasses it completely if I disagree
**It is:**
* 3 files (bash + python3 + JSON)
* no proxy, no API calls, no external services
* fail-open: if it hangs, Cursor just proceeds normally
On a retroactive analysis of my prompts it would have cut \~50–70% of my AI spend with no drop in quality, and it got 12/12 real test prompts right after a bit of tuning.
I open-sourced it here if anyone wants to use or improve it:
[https://github.com/coyvalyss1/model-matchmaker](https://github.com/coyvalyss1/model-matchmaker)
I am mostly curious what other people's breakdown looks like once you run it on your own usage. Do you see the same "Opus for git commit" pattern, or something different?
229 upvotes · 5 comments
Comments (5)
ChillPanda905: given how varied intent can be and how easy it is to use any of the keywords you list in casual ways that don't reflect intended level of complexity, it's very difficult to picture working reliably and consistently.
You should look into passing this through local NLP to process and classify the p
ChillScout586: Are you saying you use prompts just to commit code?
PixelSurfer27: Isn't this what their "auto" mode does?
HappySpark80: Might try it out thx. But lately I’ve been trying to be better at it and will use opus for planning and then auto or sonnet for executing. Cursor seems to save those preferences too. Same in Claude code, I’ll use the opusplan model
SolarSurfer919: I wonder if I will be able to setup it also in Claude Code. Also wondering if switching models using skills / commands might do the work rather than hook
More discussions about Cursor on HonestUse