opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: model fallback in specific agents

Open kobi2187 opened this issue 10 months ago • 5 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Can you please add a model fallback in the yaml part of the specific_agent.md file?

---
description: ...
mode: primary
model: [ 'anthropic/claude-sonnet-4-5', 'opencode/grok-4' , 'google/gemini-3-pro', 'openai/gpt-5-turbo' ]

expected behaviour: if a model is unavailable or out of tokens, it will use the next one automatically (or ask the user according to pref).

syntax - for example as a yaml list. should let user know if file has a parsing issue (wrong syntax) or model unavailable (not connected).

kobi2187 avatar Jan 20 '26 08:01 kobi2187

This issue might be a duplicate of existing issues. Please check:

  • #7602: [FEATURE]: Native Model Fallback / Failover Support - Directly addresses model fallback between different models with global and agent-level configuration
  • #8687: [FEATURE]: Fallback models in configuration - Requests multiple models in config as an array for fallback (CLOSED)
  • #8673: [FEATURE]: fallback models for (sub) agents - Explicitly requests array of fallback models with automatic switching (CLOSED)
  • #1267: Support per rule model fallbacks for outages and credit depletion - Older request for multiple models per mode in order of preference

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Jan 20 '26 08:01 github-actions[bot]

Strong +1 for this. My concrete use case: I have subagents pinned to cheap/free models (e.g. opencode/grok-code for shell-exec, opencode/gpt-5-nano for general) to avoid burning expensive tokens on trivial tasks. But free models occasionally hit rate limits or produce weak results for complex subagent work.

A fallback array like model: ['opencode/gpt-5-nano', 'openai/gpt-5-nano', 'google/gemini-2.5-flash-lite'] would let me tier: free → ultra-cheap paid → cheap paid, with automatic failover. Right now the only workaround is running a LiteLLM proxy as a custom provider, which adds unnecessary infrastructure for what should be a native config option.

farukg avatar Feb 16 '26 13:02 farukg

A much needed feature so that no human intervention is needed to switch models, also can be useful in opencode github agent (We can set 2-3 models and automatic fallback handles whichever is possible) @rekram1-node

dhruvkej9 avatar Feb 17 '26 08:02 dhruvkej9

Extremely useful for me as well. I have a sub agent set to Claude Models, would be great to switch to Gemini when I run out of tokens. Right noew the subagent just get stuck and I don't even notice it

marcodiniz avatar Feb 27 '26 16:02 marcodiniz

To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

github-actions[bot] avatar Apr 29 '26 03:04 github-actions[bot]