Tokenless: Reducing AI Spend via Dynamic Model Routing
Frontier models are overkill for 80% of agent turns, yet most developers stick to them because they can't risk the hallucinations of a cheaper model on a critical task. The real inefficiency isn't the cost of a single prompt, but the cumulative waste of using a "sledgehammer" like Claude 3.5 Sonnet or GPT-4o for trivial responses. Tokenless tackles this by acting as an API gateway that routes traffic turn-by-turn between different LLMs based on the complexity of the request.
The core logic here is a dynamic switching mechanism. Instead of a static "if-this-then-that" rule, the router determines in real-time whether a prompt requires a frontier model or if a cheaper open-source alternative can handle it without sacrificing quality. This is particularly useful for an AI workflow where an agent might spend several turns doing basic data formatting (cheap) and only one turn doing complex architectural reasoning (expensive).
Technical Deep Dive into the Routing Logic
The approach Tokenless uses is quite interesting because it doesn't just rely on a classifier to guess the difficulty of a prompt. Instead, it leverages a technique where multiple models are queried, and the system uses the progress of those responses to make a routing decision. This minimizes the performance dip usually associated with "cheap" routing.
From a deployment perspective, one of the biggest concerns with model switching is cache invalidation. Usually, jumping between models would kill your prompt cache and spike latency. However, if the routing algorithm is aware of whether the cache is "hot" or "cold," you can maintain efficiency even while swapping the underlying LLM.
- Performance: The team claims a version of their router matches Claude performance while cutting costs by 50%.
- Integration: It functions as a gateway, meaning it sits between your agent and the model providers.
- Scalability: It's designed to handle the high-volume traffic patterns seen in enterprise agent deployments.
If you're managing a production-grade AI workflow and your API bills are scaling linearly with your user base, this kind of dynamic routing is the only way to maintain margins. It moves the conversation from "which model is best" to "which model is appropriate for this specific millisecond of computation."
For those wanting to see the technical implementation, the developers shared their process here:
https://usetokenless.com/blog/building-tokenless/
And for a quick visual on how the gateway integrates into an existing stack:
https://youtu.be/sjZWriclclsAll Replies (5)
How does this differ from DigitalOcean's Model Synthesis? They seem to be doing the exact same thing.
The terminalbench results look suspicious. Can you share an ablation study against a tiny 7B classifier to prove this is SOTA?
Skeptical about the cold cache issue. How often does the model actually switch mid-task in a real production environment?
Worried about those input token costs. Does the routing overhead eat all the savings on long-context queries?
I don't get how more API calls save money. Isn't a single model with caching way cheaper?