r/opencode • u/Hacklone • 24d ago
I wrote an OpenCode plugin that keeps the task going when Claude hits its session limit
I kept losing momentum when Claude hit its session limit mid-task. OpenCode just stopped, and I had to pick another model and tell it to carry on. So I wrote Adaptive.
You sort your models into three tiers (quick, standard, advanced) in the order you prefer. When one runs out of quota or its provider goes down, Adaptive switches to the next model in the same tier and continues from where the session left off. It doesn't replay your prompt or redo tool calls that already ran.
What it does that plain fallback doesn't:
• Benches only what's actually exhausted. A Claude subscription limit sidelines that Claude provider, but the same model through OpenRouter stays available. A model-specific limit benches only that model.
• Comes back on its own. Once the limit resets, it returns to your preferred model at the next safe point, never mid-task.
• Never upgrades you just because something is down. It only moves to a stronger tier on real evidence that the task needs it, and that's capped.
• Steering is safe. Sending a message mid-task doesn't trigger a model switch.
• Your manual pick wins as long as that model works.
• State survives restarts. Health and quota windows are persisted.
It starts in observe mode, where it logs what it would have done without changing anything. Switch it to active in /adaptive once you trust it.
Install:
opencode plugin add @coool/opencode-adaptive
Then run /adaptive to set up your tiers. Needs OpenCode 2.2.1+.
Repo: https://github.com/coool-labs/opencode-adaptive
I didn't find an existing plugin that does all of this.
Feedback welcome, especially provider error messages it doesn't recognize yet.
0
u/xxayshah_ 21d ago
A gateway case I’d add to the tests: two different models under the same OpenCode provider ID. I work with Ofox, where that would be two `ofox/...` entries. If only one model is unavailable, the other should still be eligible; if the shared account balance is exhausted, trying the second won’t help. Your subscription-versus-OpenRouter example covers separate providers, but this would check the distinction within one provider. I haven’t tested Adaptive against Ofox, so this is a suggested test case, not a compatibility report.
1
u/[deleted] 24d ago
[removed] — view removed comment