anthropics / anthropics/claude-cookbooks
[PROPOSAL] Cookbook: Route each task to the cheapest model that can do it
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 52.7k
- Forks
- 6.3k
- Ø Merge
- 25 Min.
- Gemergte PRs (30 T.)
- 6
Beschreibung
There is a good proposal open on reducing token costs (#705). This is a different lever and I think they sit side by side rather than overlap: instead of using fewer tokens on one model, pick the cheapest model that still clears the task.
The idea is a small classifier you run before the real call. It reads the task description and returns a tier (Haiku / Sonnet / Opus) with a one-line reason. Trivial fetches and short lookups go to the cheapest tier; design, security, and multi-step work go up; everything else defaults to the middle. In an agent that dispatches many sub-tasks, routing the easy majority down is where the savings come from, and the hard minority still gets the strong model.
What the notebook would cover:
- The classifier itself, as a short prompt with explicit rules, run on a batch of mixed tasks.
- A measured table: for each task, the routed tier, a quality check against a reference answer, and the cost difference versus sending everything to one strong model.
- The failure mode that matters: a task routed too low that quietly returns a worse answer. How to catch it (a cheap verification pass on low-tier outputs) and when the routing is not worth it.
It uses only the messages API. I would target the agents/cost section and follow the contributing guide. Happy to coordinate with #705 so the two read as complementary rather than redundant.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.