Skip to content

[Feature]: Support multiple fallback models for a single Agent (Model Failover Strategy) #703

Description

@Hogeexxl

Prerequisites

  • I have searched existing issues and discussions to avoid duplicates
  • This feature request is specific to oh-my-opencode (not OpenCode core)
  • I have read the documentation

Problem Description

Problem Description

Currently, each Agent in oh-my-opencode is bound to a single specific model configuration.

I often encounter situations where the primary high-performance model (e.g., Claude-3.5-Opus) hits rate limits (429) or runs out of quota/credits during a task. When this happens, the Agent stops working, and I have to manually edit the configuration file to switch to a cheaper or available model, which interrupts the workflow.

Use Case Example:
I want to configure my Agent "Sisyphus" with a primary model and a backup model.

  1. Primary: Claude-Opus-4.5 (for high-quality reasoning).
  2. Backup: Gemini-3-Pro (for fallback).

If the primary model fails (due to insufficient quota or rate limits), I want the system to handle it gracefully.

Proposed Solution

I suggest adding support for Multiple Models or a Fallback Mechanism for a single Agent.

Feature details:

  1. Configuration: Allow the model field to accept an array of models, or add a new fallback_models field.
  2. Auto-Switching: If the current model returns a specific error (e.g., Quota Exceeded, Rate Limit, or API Error), automatically retry the request using the next model in the list.
  3. Manual Switching: Alternatively, allow users to quickly toggle between pre-configured models for the current Agent in the UI without modifying the config file.

Mockup of potential config:

{
  "agent": "Sisyphus",
  "models": [
    {
      "name": "claude-opus-4.5",
      "priority": 1
    },
    {
      "name": "gemini-3-pro",
      "priority": 2
    }
  ],
  "strategy": "fallback" // or "manual"
}


Alternatives Considered

Manually changing the config file every time a model runs out of credits.

Additional Context

This feature would be extremely useful for users managing costs or relying on unstable API providers.

### Proposed Solution

I suggest adding support for **Multiple Models** or a **Fallback Mechanism** for a single Agent.

**Feature details:**
1. **Configuration:** Allow the `model` field to accept an array of models, or add a new `fallback_models` field.
2. **Auto-Switching:** If the primary model returns a specific error (e.g., Quota Exceeded, Rate Limit, or API Error), automatically retry the request using the next model in the list.
3. **Manual Switching:** Alternatively, allow users to quickly toggle between pre-configured models for the current Agent in the UI without modifying the config file.

**Mockup of potential config:**
```json
{
  "agent": "Sisyphus",
  "models": [
    {
      "name": "claude-opus-4.5",
      "priority": 1
    },
    {
      "name": "gemini-3-pro",
      "priority": 2
    }
  ],
  "strategy": "fallback" // or "manual"
}

### Alternatives Considered

_No response_

### Doctor Output (Optional)

```shell

Additional Context

No response

Feature Type

New Agent

Contribution

  • I'm willing to submit a PR for this feature
  • I can help with testing
  • I can help with documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions