Top
Best
New

Posted by adchurch 1 day ago

Show HN: Smart model routing directly in Claude, Codex and Cursor(github.com)
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!

201 points | 109 commentspage 4
_pdp_ 1 day ago|
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

adchurch 1 day ago|
It saves money because some agent sessions can be entirely handled by a smaller model (also relevant: subagents use fresh context windows so a subagent with a simple task can be routed to a smaller model even if the main agent needs a frontier model).

Totally right about small LLMs btw, that's why we trained this on real agent sessions where we forced it to use different models. If the routing model sees small models can't handle a certain type of task then they won't be assigned. (Also as a fallback we have some guardrails that will have a bigger model come in to "rescue" a smaller model if it gets stuck)

Reuben_Santoso 1 day ago||
this is impressive. genuinely better than most people appraoches with using LLM as another judge to help route. which just uses more tokens than saves
adchurch 1 day ago|
Appreciate the kind words! Lmk if you have any feedback on it from using!
arendtio 1 day ago||
What is the difference from Cursors 'auto' mode?
adchurch 1 day ago|
Fun fact: Cursor's "auto" mode is just Composer (or at least it was last time I checked). So it's different in the sense that it actually does route to more than 1 model
arendtio 17 hours ago||
How did you check? Like looking at the results or at the actual implementation?

I mean, I know that it mostly chooses Composer, but I wonder if it is hard-wired or if they have a logic that just selects Composer most of the time?

emilio_srg2 1 day ago||
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?
adchurch 1 day ago|
If you have a Claude/Codex subscription then we use that (and account for the subsidized price accordingly when making routing decisions) instead of API billing. So you get the best of both worlds: subsidized usage for frontier models + save by using open/smaller models when it's genuinely better.

In practice, lots of ppl are using this to make their Claude sub limits go further!

emilio_srg2 1 day ago||
I see but didn’t they severely limited the usage allowed with `claude -p`
adchurch 1 day ago||
But we're not routing via `claude -p`, if you have sub usage available + it's the right choice to route to a Claude model, then the router is approximately a transparent passthrough. So it gets billed like normal `claude` usage rather than `claude -p`.
debarshri 1 day ago||
It is funny. We are building something similar.
adchurch 1 day ago|
Oh cool, feel free to reach out to me at andrew@workweave.ai if you ever want to share notes! We've learned a lot in the process of building this so far :)
mkagenius 1 day ago||
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

adchurch 1 day ago|
Very interesting - curious how you've used it yourself so far? I can imagine one use case would be having e.g. GPT 5.5 review Opus 4.8's work?
mkagenius 1 day ago||
Useful in splitting a big task - some parts are easy so give it to say Gemini. Some are harder so give it to gpt 5.5 and so on.

Also the throughput kind of increases since providers are different.

yiyingzhang 18 hours ago||
Curious what's the typical switching frequency in your experiments and experience. How do you control the tradeoff of cache matching and model efficiency?
slopinthebag 1 day ago||
> 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.

adchurch 1 day ago|
Fair enough, not meant to be marketing just a statement of fact. Would have turned me off too 18 months ago but times change...
ai_slop_hater 1 day ago||
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?
adchurch 1 day ago|
If you statelessly route each new request: yes it does end up being more expensive!

So our routing is cache-aware. It will have a much higher threshold to switch from one model to another if there's already some cache for the first model. Experimentally this solves the problem (like I said we've saved 40% ourselves vs. what we would have otherwise paid).

Bishop81 56 minutes ago|
[flagged]
More comments...