@coool/opencode-adaptive

中文文档
1.6.3发布于 2026/11/11MITTypeScriptESM + CJS近 30 天下载 2089

Execution supervisor plugin for OpenCode v2: capability-tier routing, structured-evidence escalation, horizontal failure recovery, and resource health tracking.

原始使用文档
文档目录9 节
  1. What you can do with it
  2. Features
  3. Install
  4. Set up
  5. Tiers
  6. When a model fails
  7. Limits
  8. Troubleshooting
  9. Privacy

@coool/opencode-adaptive

npm version npm downloads

Automatic model fallback and routing for OpenCode.

You list your models in order of preference. Adaptive runs each task on the first one that works. When a model hits a quota, rate limit or outage, work moves to the next one. When the preferred model is back, it is used again.

It is set up entirely from the /adaptive menu in OpenCode. There are no config files to edit and no model IDs to type.

What you can do with it

Use subscriptions first, pay-as-you-go second. Put your subscription models at the top of the list and an API provider such as OpenRouter at the bottom. You get the most out of what you already pay for. The API only takes over when the subscriptions are out of quota, and the subscriptions are used again as soon as they reset.

Use cheap models for small work. Keep separate lists for quick, standard and advanced work. Typo fixes don't need your strongest model.

Leave long runs unattended. If a model fails mid-task, work continues on the next ready model in the tier, and the preferred model is used again at the next task — finished tool calls are not repeated, even across an OpenCode restart. A /goal run is a series of tasks, so it carries on by itself.

Features

  • Menu setup. Models, order and mode are set in /adaptive with model search. No config files.
  • Tiers. Quick, standard and advanced work each get their own list, and a failure stays inside the tier the work needs. The agent can ask for a tier with the adaptive_tier tool. Routing follows fixed rules, not a prompt the model may or may not obey.
  • Quota awareness. It reads usage from provider response headers. When a subscription is nearly used up (about 10% left), new tasks go to the next ready model in the tier, and it is used again after the reset time when the provider reports one.
  • Recovery that survives a restart. If work is interrupted and cannot continue right away because no model in its tier is ready, it is saved and resumes by itself when the first one returns (for example when a quota resets), without a new prompt and without repeating finished tool calls — even after an OpenCode restart. Meanwhile the footer shows Adaptive · waiting · resumes 18:42.
  • Dry run. In observe mode it records what it would have done, with the reason, before it changes anything. A session can have its own mode.
  • Manual controls. Mark a model healthy after a cooldown you know has passed, and resume or cancel parked work from the session itself — no prompt resend, no repeated tool calls.
  • Doctor. One report (/adaptive → Doctor) flags empty tiers, models that have gone missing or lost tool support, limited resources and parked work, with what to do next.
  • Escalation on evidence only. An outage never sends work to a more expensive tier. Moving up needs a context overflow, a policy rejection, or an explicit request from the agent.

Install

opencode plugin add @coool/opencode-adaptive

Needs OpenCode 2.2.1 or newer.

Set up

  1. Start OpenCode and run /adaptive.
  2. Open Models, pick a tier, and choose Add model…. Search for a model and select it. Repeat, best first. If the tier a task needs is empty, OpenCode's own model runs it.
  3. Open Mode and choose active.

New installs start in observe mode: Adaptive records what it would do but changes nothing. Look at Receipts to check its decisions, then switch to active.

ModeWhat happens
offNothing.
observeDecisions are recorded, not applied. This is the default.
activeDecisions are applied. A task changes model only when its model fails.

Any session can override the global mode: open /adaptive inside the session and choose This session….

To reorder or remove a model, select it in the tier list. Status shows each model's state, including subscription usage (used 72%, resets 18:42) when the provider reports it.

Everything lives in the /adaptive menu:

EntryPurpose
StatusTiers, resource health, capacity evidence.
ModelsEdit ordered tier membership.
Modeoff, observe or active, globally or for this session.
TierThis session's tier request.
PinPin one model.
ReceiptsEvery routing decision, with the reason.
HealthMark a model healthy again after a cooldown or quota reset.
Parked workResume this session's parked work now (bypasses the give-up budget), or cancel.
DoctorCheck tiers, model availability, tool support, health, and parked work.

Tiers

A tier is an ordered list of models. The order is your policy, and Adaptive never changes it.

  • Quick for small, mechanical work.
  • Standard for everything else. This is the default.
  • Advanced for hard work.

A model can be in more than one tier.

The tier for a task is the first of these that applies:

  1. A pinned model (/adaptive → Pin).
  2. A tier request for the session: the agent can declare one with the adaptive_tier tool, or you set it inside a session with /adaptive → Tier.
  3. A per-agent tier from the agentTiers setting (RPC only).
  4. standard.

Background requests such as titles and summaries are observed but not routed separately in v1 — they keep OpenCode's own model.

No language model or keyword matching is involved. A model is skipped if it is unknown or can't fit the context, and the receipt says why. Adaptive only uses models you added.

When a model fails

  • Rate limit, quota, timeout, outage: if the error is clear-cut and another model in the same tier is ready, the task switches to it and carries on from the current session. Your prompt is not resent and finished tool calls are not repeated. If the error is unclear or no other model is ready, OpenCode's normal retry continues.
  • A model fails repeatedly: it is paused for a cooldown, then tried once. If that works, it is back.
  • Every model in the tier is blocked as a task starts: OpenCode's own model runs it, and the decision is recorded as a receipt with the reason. A task that fails to recover is saved and resumes when a model returns.
  • Every model in the tier runs out of quota mid-task: the task waits, and continues on whichever model resets first. The footer chip (and the GUI composer pill) says when. Sending your own prompt or picking a model yourself ends the wait.
  • You cancel: nothing is retried or switched.
  • Auth error or unknown model: the model is marked unavailable and skipped.

An outage never moves work to a stronger tier. Work only moves up on real evidence: a context overflow, a content-policy rejection, or the agent calling adaptive_escalate with a reason and evidence. This happens at most twice per task.

Limits

  • No borrowing between tiers. If a tier is exhausted, the task runs on OpenCode's own model rather than another tier's models. To let a model serve two tiers, add it to both.
  • A task that moved up a tier stays there. The next task is routed again from scratch.
  • Usage figures come from response headers and are best effort. Providers that use WebSockets don't expose them.
  • The browser/desktop settings page is experimental. No released OpenCode loads it yet, so use /adaptive.
  • In the web UI (including on mobile) type /web-adaptive for the mode and model status, or /web-adaptive on, off, observe, active to switch the mode. It is a server command, which the web app lists in the composer's slash menu.

Troubleshooting

  • Nothing changes. You are in observe mode. Switch to active in /adaptive → Mode.
  • A model is never picked. Its provider must be connected in OpenCode.
  • Receipts show park on a new task. Every model in its tier was blocked when the task started, so it ran on OpenCode's own model. The receipt says why; check /adaptive → Status for cooldowns.
  • A model stays limited although its quota reset. The provider did not report the reset yet. If you know better, /adaptive → Health marks it healthy.
  • Why did it pick that model? /adaptive → Receipts.
  • "Plugin failed" toast. The plugin didn't load. Update it with opencode plugin update, or remove and add it again.

Privacy

Nothing leaves your machine. No telemetry, no network calls of its own, no secrets in settings, receipts or logs. Receipts keep the newest 200 entries and are never added to prompts.

版本与发布记录

@coool/opencode-adaptive 共发布 15 个版本,首次发布于 2026/11/03;过去 12 个月发布了 15 个版本。

版本发布日期距今
1.6.3latest2026/11/112 天前
1.6.22026/11/113 天前
1.6.12026/11/103 天前
1.6.02026/11/104 天前
1.5.02026/11/086 天前
1.4.12026/11/068 天前

关于 @coool/opencode-adaptive 的常见问题

@coool/opencode-adaptive 是什么?

Execution supervisor plugin for OpenCode v2: capability-tier routing, structured-evidence escalation, horizontal failure recovery, and resource health tracking.

如何安装 @coool/opencode-adaptive?

在项目目录运行 npm install @coool/opencode-adaptive,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@opencode/plugin(>=2.2.1 <3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@coool/opencode-adaptive 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@coool/opencode-adaptive 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@coool/opencode-adaptive 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@coool/opencode-adaptive 可以商用吗?

@coool/opencode-adaptive 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@coool/opencode-adaptive 的下载量有多少?

根据 npm 官方下载统计,@coool/opencode-adaptive 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,089 次,日均约 70 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@coool/opencode-adaptive 还在维护吗?

最新版本 1.6.3 发布于 2026/11/11(2 天前);至今共发布 15 个版本,其中过去 12 个月发布了 15 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。