Scan your whole stack
From OX Research Newsroom
Are you using @231self/opencode-router?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.6.3
@231self/opencode-router was last scanned on 29 Nov 2026 at version 0.6.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.6.3 LATEST | 29 Nov 2026 | No rules fired |
| 0.6.2 | 29 Nov 2026 | No rules fired |
| 0.6.1 | 29 Nov 2026 | No rules fired |
| 0.6.0 | 26 Nov 2026 | Not shown |
| 0.5.0 | 26 Nov 2026 | Not shown |
Findings for v0.6.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.6.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Per-turn model routing for OpenCode V2 and Kilo.
A small model running on your machine picks the right model for every turn — so a one-line question doesn't cost frontier tokens, and a hard refactor doesn't run on a model that will fail it.
Status: v0.6.3. Routing, subagent policy, the TUI
/routersurface, per-turn timing, the CLI, and the Kilo shim are implemented and tested. The context optimiser moved to@231self/opencode-compaction(install both for pruning). Design of record:docs/specs/2026-11-15-opencode-omlx-router-design.md.
/router web opens a dashboard on 127.0.0.1: plan burn first, per-model
unit prices (the cost of 1M tokens of a typical turn on each — measured from
your own turns where you have them, a labelled stand-in where you don't),
consumption bars by day or hour, and the recent routing decisions, each
expandable to its reason. Every table sorts, filters, and searches.
The server binds loopback only and every response is an allow-list
projection — counts, sizes, prices, and labels, never prompt text or tool
output. /router web stop closes it.

A coding agent makes you pick one model for a whole session. A one-line question then costs frontier-model tokens, while a hard refactor on a small model burns retries. This plugin routes each turn to the model that fits it, from a pool you control.
It ports the transferable ideas from
pi-smart-router — turn envelope,
deterministic triage, context-fit gate, cache-aware pinning, loop escalation,
decision logging — and drops the heavy machinery (HyDRA/ONNX embeddings,
benchmark calibration, virtual cost, planning delegate).
The pool can mix cloud models with local oMLX or llama.cpp models. Loopback providers are priced at zero, so a capable local model can take routine turns while cloud models handle the hard ones.
# 1. install
opencode plugin add @231self/opencode-router
# 2. choose the models the router may pick from
opencode-model-router config set pool.source list
opencode-model-router config set pool.models '["deepseek/deepseek-flash","deepseek/deepseek-v4-pro"]'
# 3. make sure a small judge model is served locally
opencode-model-router judge probe
# 4. talk normally; inspect the first decisions
opencode-model-router status
opencode-model-router history 5
In the TUI, /router opens the full menu, /router explain shows why the last
turn picked its model, and /router debug prints the diagnostic bundle.
| Requirement | Notes |
|---|---|
| OpenCode ≥ 2.3 | First-class; V2 plugin API |
| Kilo CLI ≥ 7.6.2 | Best-effort mode; see Kilo limitations |
| oMLX or llama.cpp | Local OpenAI-compatible server; oMLX defaults to http://127.0.0.1:1234/v1, llama-server to :8080 |
| A small judge model | e.g. a ~4B instruct model; oMLX, llama.cpp, or any OpenAI-compatible server; see Choose a judge |
| Node/Bun | Provided by OpenCode and Kilo; nothing extra to install |
No Rust toolchain is needed to install a released package. Building from source
requires Rust with the wasm32-unknown-unknown target.
Release/build details: docs/releasing.md.
opencode plugin add @231self/opencode-router
// ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["@231self/opencode-router"]
}
kilo plugin @231self/opencode-router
// ~/.config/kilo/kilo.jsonc or project kilo.jsonc
{
"$schema": "https://app.kilo.ai/config.json",
"plugin": ["@231self/opencode-router"]
}
git clone https://github.com/231self/opencode-router
cd opencode-router
bun install
bun run build:wasm # needs Rust with wasm32-unknown-unknown
Then point the host at the checkout:
// OpenCode
{ "plugins": ["/absolute/path/to/opencode-router"] }
// Kilo
{ "plugin": ["/absolute/path/to/opencode-router/src/index.js"] }
Kilo applies a decision at the next request boundary; see Kilo limitations.
The CLI installs as opencode-model-router. omlx-router remains an alias.
Config, state, plugin IDs, and OMLX_ROUTER_* env vars keep their historical
names, so existing setups keep working.
Three layers: a plain-JS adapter for the host, a Rust decision engine compiled to WebAssembly, and a short JSON-verdict call to a small local model.
prompt hook
├─ envelope: cheap Rust heuristics → signals + complexity hint
├─ short-circuit? (trivial · forced pin · escalation · empty pool)
├─ judge: 4B local model → JSON verdict [5 s budget]
├─ reconcile: judge + deterministic floor (judge can raise, never lower)
├─ gates → score → pin → chosen model
└─ session.switchModel(...) + write pin + decision record
context hook (same turn, from @231self/opencode-compaction)
├─ optimiser: token estimate → prune plan → afterTokens
└─ afterTokens feeds the next routing decision
telemetry (after the turn)
└─ turns.jsonl: routing/judge/core/switch time, tokens, cost
The routing brain is deterministic, has no I/O, and is unit-tested on its own. The only model call the plugin makes for a decision is the short verdict prompt to the judge endpoint you configure (localhost by default). If it is slow or down, deterministic heuristics take over and routing continues.
A classifier, not a chat model. It is asked one question per turn, and sees only:
It never sees the transcript, file contents, or tool output.
| Input | Value |
|---|---|
| Temperature | 0 |
| Max tokens | 220 |
| Format | response_format: json_object, one repair retry |
| Timeout | judge.timeoutMs (default 5 s) |
It returns:
{"task":"edit","complexity":2,"needsTools":true,"needsVision":false,
"contextNeed":"small","reasoningNeed":"medium","confidence":0.8}
The judge is a floor-adder. reconcile lets it raise complexity, reasoning,
or context need, but never lower what the deterministic signals already proved.
That is why a 4B that under-classifies a multi-file refactor cannot cause an
under-route. confidence is recorded but does not steer selection. On timeout,
HTTP, or parse failure the heuristic verdict is used, the decision log records
used: false, and the turn continues.
Before any judge call, the envelope computes word-boundary-aware markers:
| Signal | Trigger |
|---|---|
code |
code fences, source extensions, cargo/bun/npm/git |
agentic |
implement, fix, refactor, migrate, debug, add, run, test, … |
error_trace |
panic, traceback, exception, error:, exit code, … |
planning |
plan, design, architect, approach, trade-off, spec |
review |
review, audit, critique, security, look for bugs |
trivial |
short, no signals, small prompt and context |
multi_file |
≥ 3 code files, or 2 across files |
large_context |
estimated input over 60k tokens |
repeated_failures |
3+ consecutive identical tool failures |
Complexity starts at 1 and adds a point per signal (clamped to 5), with planning and review floored at 3. Trivial turns skip the judge entirely.
input ≤ context × 0.9), minimum
context, required tools, and required vision are hard filters.pin.cacheHitRatio (0.8) when nothing is measured yet. With a plan billing
record configured (/router plan, or the compaction plugin's /ctx plan),
the models the plan covers are priced at the plan's own shadow prices —
plan credits are what the user actually spends — and marked plan rate in
/router pool. A plan that publishes a dollar budget rather than a token
count (GitHub Copilot) is priced against the model's own list price: the
budget buys allowanceUsd / listPrice tokens, so the model costs list ×
priceUsd / allowanceUsd. A plan with no published allowance has no
shadow price, so it changes no price: those models keep catalog prices.
Local models stay free: they burn no allowance. This precedence is not
decided here — it lives in @231self/opencode-shared/cost-resolution.js,
which the compaction plugin calls too, so a model's price is one fact
shared by both.| Policy | Cost | Quality | Latency | Use when |
|---|---|---|---|---|
cost (default) |
0.6 | 0.3 | 0.1 | Cheapest model that clears the bar |
quality |
0.1 | 0.8 | 0.1 | Quality matters more than spend |
latency |
0.2 | 0.2 | 0.6 | Interactive work; favours local and flash tiers |
Changing the policy clears pins so the next turn is scored from scratch.
The router adds a block to the OpenCode sidebar showing this session's model, pin source, policy, judge, and quality score. It refreshes on model changes and finished turns. Where the host has no OpenTUI or no sidebar slot, the block is skipped and everything else works.
Override any preset, and optionally vary the blend by turn class:
{
"policy": "cost",
"policyWeights": { "cost": 0.6, "quality": 0.35, "latency": 0.05 },
"policyByClass": {
"planning": { "cost": 0.1, "quality": 0.8, "latency": 0.1 },
"review": { "cost": 0.1, "quality": 0.8, "latency": 0.1 },
"trivial": { "cost": 0.85, "quality": 0.1, "latency": 0.05 }
}
}
Turn classes are trivial, routine, agentic, planning, review, and
tool_continuation. A class override wins over policyWeights; omitted fields
inherit. /router policy custom prints the active weights and the config path.
Weights change which model wins a turn; pin thresholds decide whether the router
switches at all.
Provider prompt caches are per model and per provider. A switch pays one full prefill, so routing alone would thrash the cache. The pin is the counterweight.
| Mode | Behaviour |
|---|---|
cache |
Keep the incumbent to reuse its cache; switch only on hard breaks |
balanced (default) |
Keep unless a challenger wins by pin.switchThreshold (0.12) |
switch |
Take the best every turn, with cold-cache scoring |
Even in cache or balanced, a pin is released by:
pin.idleTtlMs, 5 min),pin.maxAgeMs, 30 min) or pinned turns (pin.maxTurns, 8),pin.costSwitchRatio (4×) the cheapest adequate
challenger,pin.flipFlopTurns, 3),Picking a model yourself (/model) becomes a forced pin until you run
/router auto, the session compacts, or the model disappears.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.