两行代码实现LLM自动路由,Plano开源方案实测成本减半
Automatic LLM routing in two lines of code!
Automatic LLM routing in two lines of code!
(without touching the agent code)
Teams usually hardcode the model directly into every LLM call, which means every task gets the same model regardless of what it actually needs.
But the prompt intent is already the signal you need to route differently.
A smart approach is actually implemented in Plano (open-source), which lets you do that with just one config change.
See the code snippet below.
Point `base_url` to Plano's local endpoint, and your client starts routing based on prompt intent.
For instance: - "Write a binary search" routes to `claude-sonnet-4.5` for code generation. - "Capital of France?" routes to `gpt-4o-mini` for general tasks.
You don't need to touch a single line of your agent code.
`planoai obs` is Plano's observability command.
It gives you a live view of every routing decision, the model picked, the route taken, and the cost per request.
Plano is fully open-source, and you can self-host it natively or via Docker.
GitHub repo: https://github.com/katanemo/plano
(don't forget to star it ⭐ )
To see this in practice, I put this exact pipeline in front of my Hermes agent, and the bill dropped 2x, without changing a line of agent code. I have also written an article with the complete walkthrough about it.
Read it below.
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力