October 3, 2026
Jev picks the model for the task: LangChain applies the choice to the entire agent run
As of Oct 3, 2026, Jev 1.13 costs $0.042 per million input tokens: the cost of classifying a request before choosing a model.

Harrison Chase
@hwchase17
Cool project from @dbreunig LangChain has ModelRouterMiddleware for this: Jev reads the first message, picks a model, and that model handles the entire run. Jev is so inexpensive that you can use a custom hook to select a model again after each tool result. Documentation: https://docs.langchain.com/oss/python/integrations/providers/typesafe#model-routing https://x.com/dbreunig/status/2106456056042025235
A quick example of a model router, using DSPy and Jev, based on your initial prompt. Sketched this out in ~15 min, by request, and am surprised at how well it works! https://gist.github.com/dbreunig/949b42c7202508881d7c5a64ccd0fb9b
· 1.4K views
Jev analyzes the request, while ModelRouterMiddleware in LangChain selects a model for the entire AI agent run.
Instead of specifying one fixed model, the developer provides several options and selection criteria. In Drew Breunig's ready-to-use example, Jev describes the request, and Python code chooses between claude-haiku-4-5, claude-sonnet-5-5 and claude-opus-5-5. The threshold for a simple one-line answer is 0.85; for escalation, it is 0.5.
LangChain setup. Installation starts with `pip install "langchain-typesafe[experimental]" langchain-openai`. Create a key at console.typesafe.ai and set it with `export TYPESAFE_API_KEY=...`.
Import `ModelChoice` and `ModelRouterMiddleware` from `langchain_typesafe.experimental.middleware`. Define the models and their `criteria` in `choices`, then pass the router to `create_agent(..., middleware=[router])`. The middleware classifies the latest user message and uses the selected model for every model call in that run.
Selecting the model again. After each tool result, you can select a model again using custom middleware with the `before_model` hook. `TypeSafeClassifier` accepts LangChain messages directly.
Breunig also shared a ready-to-use `dspy-jev-router.py`. It requires `pip install "dspy[typesafe]==3.4.0"` and the same `TYPESAFE_API_KEY` environment variable.
According to TypeSafe's documentation as of Oct 3, 2026, the `jev-latest` alias points to `jev-1.13.0`, and output tokens are free. Jev accepts up to 64,000 tokens per request, while the shared `state` portion of the request plus the longest question must fit within 32,000 tokens. The model processes `state` once and evaluates the questions in parallel.
As of the same date, TypeSafe allows 100,000 tokens/s and 80 requests/s. When these limits are exceeded, the service returns HTTP 429.
Primary sources: [LangChain model routing setup](https://docs.langchain.com/oss/python/integrations/providers/typesafe#model-routing), [ready-to-use DSPy and Jev example](https://gist.github.com/dbreunig/949b42c7202508881d7c5a64ccd0fb9b).
The model selected in LangChain is available in the run result via `result["model_route"].choice`.
Source
