
**English** | [Türkçe](README.tr.md)
[](LICENSE)




**Give every OpenCode agent a primary, secondary, and tertiary model — and a local web UI to manage them.**
**First-class support for [oh-my-opencode-slim](https://github.com/alvinunreal/oh-my-opencode-slim) (OMO-Slim):** chains are written as native `agents.
.model` arrays, and OMO-Slim's own failover engine picks them up.
**Built for OpenCode v2.x** — uses the OpenCode V2 plugin API.
Stop editing config files by hand. Pick the models your setup actually has, chain them for failover,
and apply everything with one click.
---
## Why this exists
OpenCode lets you set **one model per agent**. When that model hits a rate limit, gets overloaded, or goes down, the agent stops working — and fixing it means hand-editing JSON files that are easy to get wrong.
**OpenCode Model Router** adds a missing layer on top of OpenCode:
- 🧩 **3-slot model chains** — `primary → secondary → tertiary` per agent, with automatic fallback.
- 🖥️ **Local web UI** — a clean, dark-themed control panel served by the plugin itself. No npm install, no build step, no cloud.
- ✅ **Only real models** — the picker lists exactly the models that are enabled in your OpenCode **Settings → Models** screen. No phantom entries, no guesses.
- 🔁 **Provider-aware refs** — the same model served by two different providers counts as two independent chain steps (`deepseek/deepseek-flash` ≠ `opencode-go/deepseek-v4.1-flash`).
- 🛡️ **Safe apply** — every write takes a `.model-router.bak` backup first, then updates the right file for `oh-my-opencode-slim` or plain OpenCode.
- 📦 **Zero dependencies** — one plugin file, built entirely on Bun/Node built-ins (`Bun.serve`, `bun:sqlite`, `node:fs`).
## How it works

Every agent gets a chain. When the primary model can't answer, the next step in the chain takes over — so a single rate limit no longer breaks your whole session.
Chains live in **one JSON state file**. The web UI reads and writes it; the plugin applies it to your real OpenCode configuration.
## Features
| | |
|---|---|
| **Agent coverage** | Works with every agent OpenCode knows: `orchestrator`, `explorer`, `librarian`, `oracle`, `designer`, `fixer`, `observer`, `build`, `plan`, and any custom agents you define. |
| **oh-my-opencode-slim first** | When the oh-my plugin is detected, chains are written as native `agents.