Skip to content

jev-router

TypeScript npm router that picks the cheapest of two or three model tiers able to handle a query, using one Jev classification.

ProjectbetaMIT

Overview

jev-model-router (repository jev-router by rajdhakad9826) routes each query to the cheapest LLM tier that can handle it, using Jev to classify how demanding the query is instead of spending an LLM call on routing. You configure two or three models ordered from weakest to strongest, each with a one-line capability description that becomes a level of the rubric sent to Jev.

With two models the decision is binary, with a threshold for routing to the stronger model (default 0.5). With three models it is a cascade: separate confidence levels govern escalating from the middle tier to the strongest (default 0.4) and dropping from the middle to the cheapest (default 0.6). The result includes the chosen model, its tier index, Jev's probability distribution and whether a configured fallback tier was used because the API failed. Strategy fields are validated strictly against the number of models.

What the decision model decides

TypeQuestionAnswers
ScoreWhich capability level does this query require?—

How it works

  1. Configure 2 or 3 models with capability descriptions
  2. Call router.route(query)
  3. Jev returns a distribution over the tiers
  4. Apply upgrade or downgrade confidence thresholds
  5. Return the chosen model, or the fallback if Jev fails

Strengths

  • No LLM call spent on routing
  • Asymmetric thresholds for upgrading and downgrading
  • Explicit fallback on API failure

Caveats

  • Limited to two or three tiers
  • Model descriptions drive routing quality
  • Requires a TypeSafe key

Getting started

npm install jev-model-router, export TYPESAFE_API_KEY, then new Router({ models: [...] }).route(query)

At a glance

Type
Project
Status
beta
Language
TypeScript
Runtime
Node library
Has code
yes
License
MIT

Use cases and integrations

How curated lists describe it

  • Cost-aware LLM router that picks the cheapest model capable of handling a query, using TypeSafe's Jev for fast classification instead of an LLM call.

    logicrw/awesome-jev-projects
  • Cost-aware LLM router that picks the cheapest model capable of handling a query, using TypeSafe's Jev for fast classification instead of an LLM call.

    hellogumbo/awesome-jev

Frequently asked questions

What does Jev decide?

Which capability tier a query requires, as a probability distribution.

How many models can I use?

Exactly two or three, ordered weakest to strongest.

What if the API fails?

The router returns the configured fallback tier and flags it.

Related projects

  • Local-first routing engine for long-running agent tasks that uses a Jev decider to pick a model group per turn.

    PluginproductionRust, TypeScript
  • Open-source AI gateway for 100+ LLMs that can use Jev to classify requests for complexity routing and to compact tool results.

    ProxyproductionPython
  • Open-source workspace for running and reviewing AI coding agents across devices, with an optional Jev-based automatic model router.

    ProjectproductionTypeScript
  • jev-router★ 593

    Per-turn model routing for Claude Code and Codex: wraps the real CLI and lets Jev send simple turns to fast models and hard ones to strong.

    ProxybetaJavaScript
  • Per-call router for Codex where Jev picks the model and thinking effort for every model call, including tool continuations.

    ProjectbetaPython
  • Model router where Jev classifies each request's task family and code picks the cheapest capable model on a cost Pareto chain.

    ProjectbetaTypeScript