All shelves / Mods / Usage
laya-router
By marcreichel
laya-router is a Claude Code usage mod by marcreichel.
Routes the session once from its first prompt to a model and effort, and draws that route on the status line.
Draws
Install
The marketplace name is laya-router.
/plugin marketplace add marcreichel/laya-router /plugin install laya-router@laya-router
It runs inside the Claude Code process. The side panel is only what the author's README names. Read the repo before you install, or run claude plugin validate on the plugin folder.
- Version
- 0.3.0
- License
- MIT
- Repo stars
- 6
- Last change
- 2026-10-16
What it can reach
- Draws in the session
- Reaches the network or an outside service
- Sees tool calls
- Calls another program on this machine
Start laya-serve first, for example with docker compose up in this repo. Install asks for layaUrl, default http://localhost:8000, and an optional layaApiKey, which is sent as a Bearer token. Laya classifies the prompt on this machine, and routing costs no tokens. The first prompt is the only one that picks the model, because switching mid-session drops the prompt cache and the whole conversation is re-read at full price. A first prompt under three words stays on /model. A skill call is routed from the typed text plus the first 2000 characters of the skill, or from the typed text alone where that hook is unavailable. Subagents keep the model their definition names. Below a confidence of 0.475, or 0.375 when Fable is enabled, or when laya-serve is unreachable, the request goes out unchanged. Changing /model after routing stops the override for the rest of the session. /effort alone does not, and the mod keeps sending the routed effort. Trivial prompts go to claude-haiku-5-5 at low effort, routine to claude-sonnet-5-5 at medium, hard to claude-opus-5-5 at high, and research to claude-fable-5-1 at xhigh only when enableFable is on, otherwise Opus. enableFable is off by default. Each model's effort is a picker in /config, from low to max, and Claude Code lowers a level the model does not support. Three failed or identical tool calls in a row, or a later prompt read as a harder tier, put one status line asking you to consider a higher /model, once per session. Later prompts are classified in the background, so they do not wait on laya-serve. You decide whether a switch is worth re-reading the conversation uncached. The status line shows the tier and confidence, or unsure, or offline. /model keeps showing the session's own model, because a mod rewrites each request and cannot set the session's model. /laya-log prints the stored routes as JSON lines, the last 1000 entries. The author says the thresholds are the lowest that keep about 90 percent of routed prompts on the expected tier in the repo's eval.
The plugin is the repository. The marketplace name is laya-router. The route on the status line is why this page files it under usage. claude-router picks a model and effort for each turn from a classifier, and draws the tier above the prompt. effortless draws a bar above the prompt with the reasoning effort it picked for this prompt, how full the chat is, and how long the prompt cache stays warm. This one routes once from the first prompt, through Laya on this machine, and keeps that model and effort. Laya is the classifier the README names, and laya-serve is that classifier running on this machine. With layaUrl left at localhost the call stays on this machine. A different URL is where the prompt and the optional key go. The status text is set when a tier is chosen, when the classifier is unsure or offline, and when a harder tier is suggested. The tool-call handler only counts failures toward that suggestion. A routing failure lets the prompt through.
Demo

What it hooks into
session.startWhen a session startscommand.runWhen you run its slash command/laya-logsession.endWhen a session endsprompt.submitWhen you send a promptskill.promptA Claude Code eventturn.stepAt each step of a turntool.callAround a tool call, where it can hold one
Read from the on() calls in its hook modules. Open its source under Files to check what each one does.
Slash commands 1
/laya-logShow what laya-router routed and what happened after, as JSON lines
Files
The author's README and source, 4 files. They load when you open them.
Facts
- Author
- marcreichel
- Category
- Usage
- Marketplace
- laya-router
- Version
- 0.3.0
- License
- MIT
- Repo stars
- 6
- Last change
- 2026-10-16
- Language
- TypeScript
- Files
- 17