For pi-coding-agent and DeepSeek Harness

Never let the CTO do the engineer’s job. And vice versa.

A small judge decides. When it cannot, it leaves your model alone.

You name two models: a cheap, fast one and a strong one. Before each message runs, a smaller model reads it and picks which one handles it. The cheap one takes code, tests, and small fixes. The strong one takes architecture, security, and the decisions you would rather not make twice. Judging costs a few thousand tokens and about a second.

Any provider when one is down, the next one takes over Nothing to run it lives inside your agent — no server, no database MIT, nothing to pull in turn it off any time, or delete it
pi-shift-router — in pi
status bar · toasts · auto
router: deepseek-flash
tier: fast
mode: auto
judge 🧭 judging…
gear default
🦾 [deepseek-flash] → fix the failing test
🧭 judging…
🧠 [Claude Opus] ← upgraded for the architecture question
⚠️ Claude Opus 429 → switching to gpt-astra — retry in 1m
🧠 [gpt-astra] ← strong tier takes over
See how
The family

Two agents, one router.

Same features, same commands, same defaults. Install one.

  • pi-shift-router v1.8.0
  • dsh-shift-router v0.7.5

pi-shift-router

v1.8.0
for pi-coding-agent

The original. One command in pi, and it starts deciding. Big jobs can be split across cheap workers.

  • No runtime dependencies · ~409 kB
  • Judge modes: LLM chain or decision model
  • 641 unit tests

dsh-shift-router

v0.7.5
for DeepSeek Harness

Install as a plugin, then set it up in Settings or run /router config.

  • No dependencies of its own
  • GUI config card + live commands
  • 443 tests · credential-free e2e

They release separately, so the DeepSeek Harness version can lag a release.

Quick Start

Install it. Name two models. Done.

Those are the only two things you set. Everything after that is automatic, and /router off turns it back off.

  1. 01 Install
  2. 02 Pick your models
  3. 03 Watch it work
  1. 01 / 03

    Install

    One command. pi adds it to your settings and loads it the next time you start.

    What you're adding
    • Nothing extra — it brings no packages of its own — the one host package it uses is already in pi
    • No telemetry — it collects nothing and adds no background process
    • Nothing to undo — remove it and pi goes back to whichever model you picked
    pi — zsh
    $ pi install npm:pi-shift-router
    Resolving pi-shift-router@1.8.0...
    ✔ Downloaded and registered
    ✔ Added to ~/.pi/agent/settings.json
    ℹ Loaded on next pi launch — nothing else to do.
  2. 02 / 03

    Pick your models

    Run /router config and pick two: one cheap and fast, one strong. Save them for yourself, or just for this project.

    How to pick
    • The cheap one — the best value you have, not the absolute cheapest — the judge runs on it too, so its judgment counts
    • The strong one — a frontier model, for the work that matters
    • More than one — put 2–3 in each list and they take over for each other when one gets rate-limited
    See recommended pairings
    pi-shift-router — Configuration
    / router config
    pi-shift-router — Configuration
    › 🦾 Fast — 0 model(s) (engineer: execution, daily coding)
    🧠 Smart — 0 model(s) (CTO: direction, review, hard problems)
    🧭 Judge — 🦾 reuse the Fast tier chain
    🎨 UX settings
    🔒 Cache-aware routing
    🔄 Model catalog — refresh now (53 available)
    💾 Save & exit
    🚫 Discard & exit
    ↑↓ navigate · enter to select
  3. 03 / 03

    Watch it work

    /router status opens a dashboard showing what it decided and what it cost. Your next message is the first one it routes.

    What the output means
    • Cost — what each side spent, and what the session would have cost without the router
    • Switches — how often it went up to the strong model, and how often it came back down
    • Paused — which models are waiting after a rate limit, and when they come back
    • Gear — how willing it is to spend — /router eco, default, or sport
    pi — /router status
    / router status
    Shift Router · status dashboard
    Last decision
    🧠 smart · claude-opus-5 θ 0.33 · confidence 0.91
    why "design the auth flow" clears the expected-cost bar
    Tiers
    🦾 Fast deepseek-v4-flash → glm-5.2 (fallback ready)
    🧠 Smart claude-opus-5 → gpt-5.6-sol
    ⚙ gear: default (R=3) judge: fast-chain
    Chains
    🦾 deepseek-v4-flash ctx 38% cache 82% ✅
    🧠 claude-opus-5 ctx 61% cache 74% ✅
    Money · this session
    saved $2.742 of $3.210 (85%) vs all-smart: deepseek-v4-flash
    spent $0.465 fast ▓░░░░░░░░░ 10% · smart ▓▓▓▓▓▓▓▓░░ 90%
    orchestration $0.0689 (5 workers)
    Last audit: ✓ clean
    Config: user (~/.pi/agent/pi-shift-router.json)
    q / esc closes
How it works

Most of your work does not need the strong model.

A cheap model and a strong one can differ by 4× to 50×. So the strong one handles only what needs it.

One message in three clears the bar. Below it, nothing changes.

Simple work sent to the strong model wastes the price difference. Hard work left on the cheap one costs more: you send it again, you pay for the strong model anyway, and you lose an afternoon finding out. So the router leans expensive — roughly one message in three earns the strong model. Below that, it would rather change nothing than guess.

Most of what you ask is small.

A rename, a new test, a typo. That does not need a frontier model, and the cheap one is faster at it.

The decision is nearly free

One small call, one or two seconds, billed at your cheap model's price. Turn down one strong call and you have covered hundreds of them.

A provider having a bad day

Rate limit, timeout, an account out of credit — the next model you listed for that job takes over, usually within the same message. It never switches to the expensive side on its own.

Engineer

Fast

Code, tests, bug fixes, the same edit across a hundred files. The answer is already decided; someone just has to carry it out accurately. A rename should not cost flagship prices.

  • Code, tests, bug fixes
  • The same edit across many files
  • Anything low-stakes
CTO

Smart

Less of your work, and none of it safe to get wrong. Architecture, security, the review that changes what you build next, the decision you would rather not make twice. It runs the whole message, so the code is its own.

  • Architecture and design calls
  • Reviews that change what happens next
  • Anything hard to undo
Fast drag Smart
The judge

One small call per message

A small model reads your message and answers two things: which model, and how sure it is. That number is the chance this message needs the strong one. It is the only decision in the system — after it, the model you picked works at its own level.

judge: { mode: fast-chain | custom | decision }
The bar

One knob

R, default 3, which puts the bar at about one message in three. Turn it up to be stingier, down to be freer. Or take a preset: /router eco, /router default, /router sport.

economics: { reworkPenalty: 3, downgradeMemory: 2 }
When things break

The next model, not a retry

Rate limit, server error, or an empty balance — that model waits longer each time it fails, and the next model you listed for the job takes over, usually within the same message. If the judge cannot be reached either, it falls back: another judge, then no routing at all. It never invents an answer to keep going.

cooldown: 1m → 4m → 16m → 1h → 4h → 6h
When one model is not enough

Split it rather than upgrade it

Some work is not a harder version of the same thing. It is several things. There the strong model stops working alone: it plans the job, writes the instructions for one cheap worker on a piece at a time, reads what comes back, and sends it out again if it is not right. Simple messages never go through this.

  • Plan, write the instructions, check, repeat, accept
  • After every run it checks: was the answer backed by anything, did it answer the question, is any of it a placeholder
  • Each worker's cost is counted on its own line, not folded into the main bill
  • Workers start with no history, which is what keeps them small — about $0.004 for one narrow job, against $0.06 for copying a 176k-token conversation into a new session
  • Two hard stops: three rounds, or two failed workers on the same piece before the strong model takes it over
  • Needs pi-subagents; without it, complex messages simply run on the strong model, as they always did
Gear presets

One knob, three speeds

Take a speed. The presets set the knob for you.

  • /router eco θ 0.5
  • /router default θ 0.33
  • /router sport θ 0.2
default
R = 3 spend knob
θ 0.33 bar

Where it starts. When the two look about equal, it takes the strong one.

Judge modes

Three ways it can decide

By default the decision comes from the cheap model that also does the work. You can change that.

  1. 01 The cheap model default
  2. 02 One separate model
  3. 03 A model built for decisions Beta

The cheap model

default

Uses the cheap model you already have for regular work. Nothing to set up.

One separate model

Let one specific model do all the deciding, separate from the ones doing the work. Useful if you have a model you trust with decisions.

A model built for decisions

Beta

Built to do only this: hand it a typed question, get back the answer and a probability. Nothing to parse, so nothing can arrive broken — about $0.0001 a message. pi 1.8 carries 53 of them.

Why it is off by default

Decision models are off by default, and that is a decision rather than caution. They are slow right now — 1.4 to 6.6 seconds a verdict, which is the provider still ramping up capacity. They suit batch work and background tasks. For a message you are sitting and waiting on, use the LLM judge. If one stops answering, the router falls back to your LLM judge.

Use cases

Where the models come from

Any mix works. Each side is a list of models, best first.

  1. 01 Several providers
  2. 02 One provider, two levels
  3. 03 Local plus cloud
01

Several providers

Two or three models on each side. If one runs out of quota, the next one takes over.

02

One provider, two levels

One bill, one set of limits. Their cheap model for the day, their best model for the hard messages.

03

Local plus cloud

The cheap model runs on your own machine, the strong one in the cloud. Routine work never leaves the computer, and hard messages still get the best model.

FAQ

Questions, answered

The short answers.

09 questions

Ordered the way a first-time reader asks them.

Is it safe to try?

Yes. Until you pick two models it does nothing at all and your agent keeps the model it already had. /router off turns it off immediately, and deleting the folder leaves you exactly where you were.

Does this actually save money?

Yes, as long as your work is mixed. Routine messages stop paying flagship prices, and the decision itself costs a few thousand tokens and 200 milliseconds to 2 seconds at the cheap model's price — turn down one strong call and you have paid for hundreds of them. If every message you send is genuinely hard, it will not save you anything.

What exactly does the strong model do?

The same work, with a stronger model behind it. It thinks, calls tools, edits files, and keeps going until the task is done — it writes the code, rather than leaving notes on someone else's. What changes is when it gets used: architecture, security, review, anything you would rather not redo.

What is a decision model?

Most routers ask an LLM whether a message is hard, then parse JSON out of the reply. A decision model is built for only that: hand it typed questions and it returns the option plus a probability — fast, 0.99. The router compares 0.99 to the bar and moves on. Nothing to parse means nobody has to recover from a model that added a comma, and a missing field means no verdict rather than a guess. A verdict costs input tokens only — about $0.0001 a turn. TypeSafe's Jev started it; OpenAI, Cloudflare and Perplexity followed, pi 1.8 carries the transport for all of them, and /router config lists what your install can actually reach. It is off by default: 1.4 to 6.6 seconds a verdict is slower than the LLM judge, so it suits batch and background work, and it steps down to your LLM judge if it stops answering.

What happens when a model — or the judge — fails?

You keep working. A rate limit, a server error, an empty balance, or Codex running out of its usage all count: that model waits — 1 minute for a server error, 16 for the rest, longer each time it fails, up to six hours — and the next model in your list takes over, sometimes mid-message. It never crosses to the expensive side, so a strong-model call stays strong. The judge does not guess either: when it cannot reach a verdict it keeps your current model, then falls back to another judge, then to no routing at all.

What is orchestration, and does it cost more?

On a message the judge calls complex, the strong model stops working alone: it plans the job, gives one cheap worker a piece at a time, reads the result, and sends it back if it is not right. It does not cost more — planning runs on the strong model, the implementing on workers that start with no history (~$0.004 for a narrow job, against $0.06 for copying a 176k-token conversation), and two hard stops keep it bounded. Every worker must hand back a failure note; send the same note twice and the strong model does that piece itself. On by default, needs pi-subagents, and /router orchestrate off turns it off.

Can I control it?

Three ways. /router status shows the model in use, the last decision and why, which models are paused, and what each side spent against what the session would have cost on the strong model alone. One number sets how eager it is: R, default 3 — higher is stingier (R=2 for routine work, R=5 for architecture), or take a preset with /router eco, default or sport. To take over for one message, /route-force pins the tier or an exact model and /route-force auto clears it. /router off hands you the wheel for good.

How is it different from the alternatives?

OpenRouter Auto Router optimizes for quality, not your bill — their docs say routing to an expensive model is working as designed — and you do not set the lists, see the decision, or choose the failure mode. Cloudflare AI Gateway is versioned flows with quotas, but you draw the graph and it sees requests, not tasks. Among pi routers, pi-bifrost runs 7-step rules across 4 tiers and saves subscription quota rather than money; pi-smart-router runs a 12-step local pipeline with no LLM and needs a local database. This keeps the decision to one prompt you can read, two lists you can hold in your head, and every verdict visible in /router status.

Is there a version for DeepSeek Harness?

Yes — dsh-shift-router (v0.7.5), the same router on the harness, with no dependencies of its own. Install it as a plugin, then set both lists in the Settings card or with /router config. Everything here carries over, plus /router allow-workers on, which puts your cheap list in the harness's subagent allowlist so delegated workers really do run on the cheap model. 443 unit tests and a credential-free e2e. To install: add it as a plugin in the app and enter the package name, dsh-shift-router — or the repo address github:green-dalii/dsh-shift-router#v0.7.5, or a local path.