Skip to content

pi-typesafe-router

Pi extension that classifies each request with Jev and routes it to one of three configured models, with doctor checks and shadow mode.

Projectbeta

Overview

pi-typesafe-router uses Jev to classify requests in Pi and route them to the right model for the task across three routes. Setup creates a configuration file, initially off, mapping all three routes to your currently selected model, which you then edit. A doctor command tests the classifier and configured models with synthetic requests, without sending your conversation, and verification persists across reloads when configuration and credentials match.

The router can be on, in shadow or off, and Pi's footer shows the mode plus the last classified route and target. Example configurations are provided for TypeSafe (jev-1.13.0), Cloudflare AI Gateway (typesafe/jev), Vercel AI Gateway (typesafe-ai/jev) and OpenRouter (typesafe/jev-1.13). The code separates transport adapters and response validation, configuration and bounded text projection, and deterministic routing policy. The README warns not to enable it alongside another automatic router.

What the decision model decides

TypeQuestionAnswers
ChoiceWhich of three routes fits this request?(inferred)—

How it works

  1. /typesafe-router setup <backend> to create config.
  2. /typesafe-router doctor to verify classifier and models.
  3. /typesafe-router on (or shadow).
  4. Each request is classified and routed to the mapped model.

Strengths

  • Doctor checks without sending your conversation.
  • Four backend options.
  • Shadow mode for evaluation.

Caveats

  • Do not run alongside another router.
  • Doctor checks may incur charges.

Getting started

pi install npm:pi-typesafe-router, then /typesafe-router setup typesafe, set TYPESAFE_API_KEY and /reload.

At a glance

Type
Project
Status
beta
Language
TypeScript
Runtime
Pi extension
Has code
yes

Use cases and integrations

How curated lists describe it

Frequently asked questions

Which backends are supported?

TypeSafe, Cloudflare AI Gateway, Vercel AI Gateway and OpenRouter.

Is routing on by default?

No, the config starts off.

Does doctor send my conversation?

No, it uses synthetic requests.

Related projects

  • Open-source team agent platform for Slack, GitHub and more that asks Jev once per session which agent runtime and model to use.

    ServicebetaTypeScript
  • 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
  • Hooks for Claude Code, Codex and pi that use Jev to suggest a skill each turn, plus a rule gate for subagent model routing.

    HookbetaJavaScript
  • Local-first macOS coding workspace that runs your agents and lets a local Laya or hosted Jev selector pick a route the host validates.

    ServicebetaRust
  • Oh My Pi extension where Jev classifies each prompt as simple or advanced and switches the model role, defaulting to advanced on doubt.

    PluginbetaTypeScript