# TypeSafe Dispatcher (beta)

The beta classifier that picks models by work kind instead of asking an LLM.

v1.0.18 added a second routing backend. With `dispatcher_beta` on, routing is a single classification call to TypeSafe (`https://api.typesafe.ai/v1/systemone`, model `jev-latest`) instead of a prompt to one of your own models, so no registered model is spent on routing. It needs a `TYPESAFE_API_KEY` in the keychain — the TUI asks for one when the toggle is turned on, and `POST /v1/model` returns 400 with `missing_key` when it is absent. Keys come from the TypeSafe Console (`https://console.typesafe.ai/keys`).

The call asks up to three questions about the request: what kind of work it is, whether it names a specific non-`pass` model, and — when the session has earlier turns — whether it continues the previous subject. It has 3 seconds to answer. The work answer picks the tier order and the reasoning level:

| Work | Tier order | Reasoning |
|---|---|---|
| `code` | S > A > B > C | `xhigh` |
| `research` | S > A > B > C | `high` |
| `work` (the default for anything else) | A > S > B > C | `medium` |
| `chat` | B > C > A > S | `none` |
| `fetch` | C > B > A > S | `low` |

A model named in the request goes first; when none is named and the subject is unchanged, the session's previous model takes that slot so its prompt cache is reused. When the previous model leads this way, the reasoning level stays at the previous one — since v1.1.1 whenever it is a valid level, not only when it is higher — and since v1.1.1 these leading picks are no longer reshuffled by provider priority; only the ranked candidates after them are. The previous model is recorded after each successful reply and expires after 30 minutes for `openai` / `codex`, 60 minutes for `gemini`, and 5 minutes for other providers. The remaining candidates are sorted by tier, reading `model_tag` first and falling back to the naming rules above; within a tier, `claude-code` and then `codex` models come first, then ties break by model family in the order the naming rules list them. For `research` work, `copilot@` models move behind the others of the same rank because of Copilot's smaller context window (since v1.0.26). `pass` models are left out of this ranking. The request context is the last 4 user and assistant turns, each cut at 2,048 characters (6 turns at 2,000 before v1.0.19). If the call fails or times out, routing falls back to the LLM dispatcher.

Turn it on with `/model` → `dispatch` → **TypeSafe/Jev(beta)** in the TUI, or `POST /v1/model` `{dispatcher_beta: true}`. Picking an ordinary model as the dispatcher turns it back off.
