Model Recommender
Recommends the best models on OpenCode Zen and OpenCode Go by cache ratio, token cost, and session cost.
0
131,835
7.1k in 7 days
51.4
Multi-signal model
7 days ago
2026-09-27
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-model-recommender@1.0.0-alpha.4"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-model-recommender@1.0.0-alpha.4"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-model-recommenderOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
An OpenCode plugin that recommends the best models on
OpenCode Zen (opencode) and OpenCode Go (opencode-go) using live
catalog pricing. Shares its sidebar building blocks with
opencode-plugin-kit.
Prerequisites
- OpenCode V2.0.3 or newer (plugin API is beta). 2.0.3 is the floor: earlier 2.x releases ship no
./tuisubpath export, so the TUI entrypoint cannot resolve@opencode/plugin/tui.
Metrics
Cache ratio — cache-read price ÷ input price. Lower = cached context (the bulk of agent traffic) is relatively cheaper.
Token cost — blended $/1M tokens:
0.7 × input + 0.3 × output(agent traffic is input-heavy).Session cost — estimated cost of a representative coding session: 400k input tokens (80% cache reads, 20% cache writes) + 50k output tokens. Override per call:
{ "sort": "sessionCost", "session": { "freshInput": 200000, "cacheReadShare": 0.6, "output": 30000 } }
Usage
Once loaded, the plugin provides:
models_recommendtool — call with{ sort: "cacheRatio" | "tokenCost" | "sessionCost", providers?, limit?, free?, session? }.models_detailstool — price breakdown for one model (defaults to the current model)./recommend-modelscommand — asks the agent to run the tool and present three rankings, plus how your current model compares./model-detailscommand — price breakdown for the current model (or pass<providerID> <modelID>)./model-viewcommand — pick which providers the sidebar picks cover (All / Zen / Go); persisted across restarts.
The sidebar widget shows the top picks, free models, and whether your current model is already the cheapest — or how much you'd save per session by switching.
Install
Published on npm.
Config (recommended) — add it to your OpenCode config (opencode.json, e.g.
~/.config/opencode/opencode.json) and it installs on startup:
{ "plugins": ["opencode-model-recommender"] }
Manual:
npm install opencode-model-recommender
Project-local:
cp -r opencode-model-recommender .opencode/plugins/
opencode2 service restart
Restart the TUI (or opencode2 service restart) after changing the config.
Remove
Remove the plugin's entry from the plugins array in opencode.json.
Extending to other providers
Edit DEFAULT_PROVIDERS in index.ts (e.g. ["opencode", "opencode-go", "openai", "anthropic"])
or pass providers per call — no code change needed for ad-hoc lookups.
License
GNU Affero General Public License v3.0 — see LICENSE.
Releases
Changelog entries use CHANGELOG_TEMPLATE.md: bullets grouped into semantic categories (Added / Changed / Fixed …) that map 1:1 from Conventional Commit types (feat → Added, fix → Fixed, …). Breaking changes get a ### Breaking block and a major bump.
Similar plugins
Context Usage
opencode-context-usage
OpenCode TUI plugin: a /context command with the exact token breakdown behind the built-in Context panel (last request) plus session-wide usage, subagent totals, cache hit rate and cost.
Oc Usage
@taraksh011/oc-usage
OpenCode plugin — live token usage, cost, and TPS display
Openrouter Costs
opencode-openrouter-costs
OpenCode TUI plugin — sidebar widget showing OpenRouter session cost and account balance