| ▲ | Show HN: Smart model routing directly in Claude, Codex and Cursor(github.com) | |||||||||||||||||||||||||
| 44 points by adchurch 2 hours ago | 32 comments | ||||||||||||||||||||||||||
We built a model router that plugs into coding agents (e.g. Claude Code, Codex, Cursor, etc.) and intelligently sends requests to the best model to serve them. Here's a quick demo of running it locally: https://www.youtube.com/watch?v=isKhAyivtfM. At Weave, we write most of our code with AI, and it's been getting more expensive. This came to a head when Opus 4.7 was released and, thanks to its tokenizer changes, our costs shot up. We knew we didn't need Opus for everything but we didn't want to lose out on the intelligence for the cases where you really need it. So we decided to build a model router to handle this for us. The Weave Router acts as an Anthropic/OpenAI endpoint specifically for coding agents. It looks at every inference request and intelligently (more on that in a sec) decides what model to send it to, handling all the translations required along the way. So it can use faster/cheaper models (e.g. DeepSeek v4, GLM 5.2, Kimi K2.6) when possible, and frontier models (Opus 4.8 & GPT 5.5 (& Fable whenever it's back)) when necessary. How do we know what model to route to? We trained an RL model on tens of thousands (so far!) of agent traces. We reward the routing model when it selects an LLM that successfully completes the given task. Here's an example: if you ask the router to plan a complex change, it will (probably) route that request to Opus 4.8. Subagents exploring the codebase to gather context will be routed to more suitable models (e.g. DeepSeek V4 Flash). Then when you have the plan ready to implement, it will be (most likely) be handed to a quicker model (e.g. GLM 5.2) to carry it out. We've been using this internally for the last month or so. We've saved 40% on tokens vs. what we otherwise would have paid, with no noticeable differences in quality or velocity. The router is source-available under Elastic License 2.0, so you can self-host it. Or if you prefer, you can also use our hosted version: weaverouter.com. I'll be here to answer any questions you may have! | ||||||||||||||||||||||||||
| ▲ | g00k 29 minutes ago | parent | next [-] | |||||||||||||||||||||||||
Man, I'm not so sure if I'd use something like this because the way I prompt already changes based upon what model I am using. I'm not convinced it would route to the right model based on my diction or whatever. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | stpedgwdgfhgdd an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||
The thing I do not get with these routers is that you will have more cache misses (5min ttl). And if there is one thing i’ve learned; using the cache is crucial. How does this router translate to $$$ when developing? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | k9294 13 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
What about request caching? If you swap to a cheaper model mid execution it might cost more that to make multiple requests to the already cached provider? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | spqw 34 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
This + making sure common requests are saved as reusable skills and scripts would probably save a large part of my token usage As prices increase we will see more of these tools to optimise and make the best use of token budget | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | mkagenius 7 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
We have created Murmur[1] which kind of works with your existing subscription (having API key is not mandatory). You can just tag @copilot @codex from claude code to delegate work to them. (it can also do it on its own too btw) 1. https://github.com/instavm/murmur - Murmur | ||||||||||||||||||||||||||
| ▲ | suyash 18 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
I would rather just use OpenCode - leverage AI models, even can host locally or paid ones with ease. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | gautam_io 23 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
This is cool! Will this use my Claude Pro/Max subscription? Or will it always use the API billing "pay as you go"? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | alansaber 25 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
"We reward the routing model when it selects an LLM that achieves the task successfully" sounds pretty oversimplified | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | debarshri 35 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
It is funny. We are building something similar. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | _pdp_ an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||
Cool.. but I still don't get how this is going to save money. It seems to me that it might actually burn more money just because the whole system now seems to be coming from different LLMs. Also, small LLMs are prone to stop before completion, throw errors and produce loops. Is this factored in the design of the tool? I am not sure. edit: spellcheck | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | arendtio an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||
What is the difference from Cursors 'auto' mode? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | emilio_srg2 28 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
but this means you work with API pricing rather than subscription pricing. Isn’t it better to use claude or codex CLI etc directly in terms of cost? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | slopinthebag 19 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
> At Weave, we write ~all our code with AI This is probably not a very effective way of marketing imo. At least, it turns me completely off. | ||||||||||||||||||||||||||
| ▲ | ai_slop_hater 42 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||
Isn't this more expensive than always using the same model, since, as I understand, by routing to different models you give up on cache? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | iluvcommunism 5 minutes ago | parent | prev [-] | |||||||||||||||||||||||||
This is basically what I need, a router. I’m tired of changing intelligence & speed levels manually. | ||||||||||||||||||||||||||