Skip to content

jcm-router

Local proxy for Claude Code that uses Jev to pick model and effort per message, routing subagents but guarding the cached main chat.

Proxyprototype

Overview

jcm-router is a local proxy that sits between Claude Code and the Anthropic API and asks Jev which model and reasoning effort each message needs: trivial questions to Haiku, everyday work to Sonnet, hard problems to Opus or Fable. The user's Claude subscription login keeps working.

Its most useful content is a measured failure. An early version routed everything, and over 309 logged requests cost $106.73 against an $87.19 baseline, a $19.53 loss, $17.12 of it from the main chat: each model switch discarded the per-model prompt cache and rewrote around 360k tokens at cache-write price. Subagents, with small cold contexts, had nothing to lose. The router now always routes subagents and only switches the main chat when a cost guard says the switch is cheap. A dashboard prices every logged request twice, as run and on the originally requested model, so users can check savings on their own usage.

What the decision model decides

TypeQuestionAnswers
ChoiceWhich model should handle this message?Haiku · Sonnet · Opus · Fable
ChoiceHow much reasoning effort does this message need?—

How it works

  1. Claude Code sends requests to localhost:8787
  2. Proxy asks Jev for model and effort
  3. Subagent requests are rerouted; main chat only when the cost guard approves
  4. Request is forwarded to the Anthropic API
  5. Dashboard compares actual cost to baseline

Strengths

  • Honest published loss data showing where routing hurts
  • Cost guard protects prompt-cache value in long chats
  • Dashboard lets users verify savings on their own logs

Caveats

  • Routing the main chat can cost more than it saves
  • Requires Bun, a Claude subscription and a TypeSafe key

Getting started

`bun install`, copy .env.example to .env with TYPESAFE_API_KEY, then `bun run up` and point Claude Code at http://localhost:8787.

At a glance

Type
Proxy
Status
prototype
Language
TypeScript
Runtime
Bun local proxy
Has code
yes

Use cases and integrations

How curated lists describe it

  • Coding agents: local proxy that picks the Claude model and reasoning effort per message with a Jev decision while leaving the cached main chat untouched.

    yibie/awesome-jev
  • Local proxy that picks the Claude model and effort per message using TypeSafe Jev. Routes subagents, leaves your cached main chat alone.

    hellogumbo/awesome-jev

Frequently asked questions

What does jcm-router decide?

Which Claude model and effort level each message should use.

Why not route every message?

Switching models in a long chat throws away the prompt cache; the README measured a $19.53 loss doing that.

Does it need an Anthropic API key?

No, your Claude Code subscription login keeps working; you need a TypeSafe key.

Related projects

  • 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
  • Claude Code mod that sets model and effort per turn and subagent from a prompt classifier: Jev by default, or Clef, OpenAI or Ollama.

    Proxybeta
  • TypeScript/Bun launcher that asks Jev which model and reasoning effort each Codex, Claude Code or Pi turn should use.

    ProjectbetaTypeScript
  • CLI, Claude Code plugin and Pi virtual model that pick the right model per prompt from one Jev call with a complexity floor.

    PluginbetaTypeScript
  • Claude Code mod that picks reasoning effort per prompt with a Haiku judge, optionally Jev, and shows cache and context state.

    ProjectbetaTypeScript
  • Go CLI model router that uses one Jev analysis to recommend a model, harness and effort level, then selects deterministically.

    CLIbetaGo