You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: plugin hook for dynamic model routing based on prompt complexity #18844
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Every prompt sent through OpenCode uses the same model, whether it's "hello" or a complex multi-file refactor. There's no way to match model cost to prompt complexity. A developer on Claude ($15/1M tokens) spending 200 simple prompts/day wastes $50-60/month on prompts a free model handles perfectly.
Proposed Solution
Add a chat.model plugin hook that fires before each prompt, allowing plugins to dynamically route messages to different models based on content analysis.
This enables:
De-escalation: Route simple tasks ("hello", "list files") to free/cheap models
Escalation (opt-in): Route complex tasks to premium models
Subagent inheritance: Subtasks inherit the routed model
Per-prompt override: Users can force their selected model with !premium
Maybe suggested before but not totally sure:
Found it. There are existing issues that match:
I opened #30457 with a minimal implementation of the chat.model hook.
This should unblock the core plugin-routing part of this request: plugins can now choose a different { providerID, modelID } before an LLM call, which makes prompt-complexity routing possible.
Activity
github-actions commentedon Mar 23, 2026
This issue might be a duplicate of existing issues. Please check:
(Note: you've already identified these yourself in the issue body. Consider closing this issue in favor of one of the above.)
feat: add chat.model hook with reference token-optimizer plugin
JGuck commentedon Jun 3, 2026
I opened #30457 with a minimal implementation of the
chat.modelhook.This should unblock the core plugin-routing part of this request: plugins can now choose a different
{ providerID, modelID }before an LLM call, which makes prompt-complexity routing possible.github-actions commentedon Aug 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.