Skip to content

jev-model-router

Python router where Jev classifies prompt difficulty and stakes, then confidence-gated rules choose an OpenAI model tier.

ProjectprototypeMIT

Overview

jev-model-router is a Python package that selects a model tier using TypeSafe's Jev and returns the decision without calling any downstream model. The list summary describes Claude tiers, while the README maps tiers to OpenAI models (Luna, Terra, Sol, Astra) in a config file.

For each prompt, one Jev call asks two questions: a Choice of tier (simple, moderate, complex or frontier) and a Score of stakes from 0 to 2 for how costly a wrong answer would be. The router applies confidence-gated routing: low-confidence tier classifications fall back to moderate, and high stakes escalate one tier even when confidence is fine. Thresholds and criteria are described as starting points to tune. It offers a CLI (route, classify, serve) and an HTTP endpoint, unit tests with mocked calls and a manual eval script.

What the decision model decides

TypeQuestionAnswers
Choicetier: is this request simple, moderate, complex or frontier?simple · moderate · complex · frontier
Scorestakes: how costly would a wrong answer be (0-2)?0 · 1 · 2

How it works

  1. Send the prompt to Jev with tier and stakes questions
  2. Fall back to moderate when tier confidence is low
  3. Escalate one tier when stakes exceed the threshold
  4. Map the tier to a model and return the decision to the app

Strengths

  • Explicit confidence fallback and stakes override
  • Router never calls downstream providers itself
  • Unit tests with mocked Jev calls

Caveats

  • Tier criteria and thresholds need tuning
  • README and list differ on whether tiers map to Claude or OpenAI models
  • Requires a TypeSafe key

Getting started

pip install -e ".[dev]", set TYPESAFE_API_KEY in .env, then jev-router route "Write a haiku about databases"

At a glance

Type
Project
Status
prototype
Language
Python
Runtime
CLI and HTTP server
Has code
yes
Has tests
yes
License
MIT

Use cases and integrations

How curated lists describe it

Frequently asked questions

What does Jev decide?

The difficulty tier of a prompt and how costly a wrong answer would be.

What happens on low confidence?

The router falls back to the moderate tier.

Does it call the chosen model?

No. It only returns the decision; your app makes the downstream request.

Related projects

  • Alibaba's AgentScope 2.0 agent framework, which added a JevClassifierModel for binary, choice and score decisions via the TypeSafe SDK.

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

    PluginproductionRust, TypeScript
  • Kilo Code's cloud monorepo, where a System One classification replaced an LLM call in the auto-routing path.

    ProjectproductionTypeScript
  • 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