Repository navigation
[FEATURE]:Model de-duplication/grouping + provider priority routing with seamless failover (cost/quota-aware) #14739
Copy link
Copy link
Closed
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Background / Problem
In OpenCode, the available model list can come from multiple providers/entry points (e.g., Claude Subscription, GitHub Copilot, various API providers). This often leads to:
- Duplicate models in the UI: the same underlying model (e.g., Opus 4.6) appears multiple times because it is offered by different providers, making selection confusing.
- No way to express billing/quota priority: users may want to consume the “cheapest / already-paid / subscription quota” first (e.g., Claude Pro subscription) and only fall back to pay-as-you-go APIs later.
- Manual switching is disruptive: when a provider hits quota limits, rate limits, or temporary outages, users must manually change the provider/model, breaking workflow and reliability.
Request / Desired Behavior
Add a mechanism to group/merge models by the underlying model identity, and within a merged model, automatically route requests through a user-defined provider priority order, with transparent failover to the next provider offering the same model.
Example desired flow
- User selects a single merged model: “Opus 4.6”
- Actual routing priority configured by user:
- Claude Subscription Pro
- GitHub Copilot
- API Provider A
- API Provider B
- When the first provider is out of quota / unavailable / rate-limited, OpenCode automatically switches to the next provider for the same model.
- Switching should be seamless and “invisible” to the user (no manual action required).
Proposed Solution (High-level)
1) Model De-duplication / Grouping (Model Group / Alias)
Introduce a “Model Group / Alias” concept:
- UI/config shows one model entry: e.g.,
opus-4.6(or user-defined alias likeopus46) - The group contains multiple provider-backed implementations of the same model:
provider=claude_subscription_pro, model=opus-4.6provider=github_copilot, model=opus-4.6provider=api_provider_a, model=opus-4.6
- Grouping rules:
- Prefer provider-supplied canonical model id when available
- Also allow manual mapping/merging, since naming can differ across providers
2) Provider Priority Order (Cost/Quota-aware)
For each model group, allow configuring a provider priority list (user adjustable), e.g.:
claude_subscription_progithub_copilotapi_provider_aapi_provider_b
3) Seamless Failover (Transparent fallback)
At request time:
- Try the highest priority provider first
- Automatically fall back on:
- quota/credits exhausted (
quota exceeded,insufficient credits, etc.) - provider unavailable or timeout
- 429 rate limit (optionally after retry/backoff)
- auth failure (optionally surface a warning but still allow fallback where possible)
- quota/credits exhausted (
- Keep the user-facing selection stable:
- The model remains “Opus 4.6” (merged model)
- Optionally log/telemetry records the actual provider used (for debugging)
UX / UI Suggestions
- Default model list shows only merged models; add a toggle to “show all provider variants”
- Model details page:
- list all providers available for the merged model
- allow reordering provider priority
- show provider health/status (available / rate limited / quota exhausted / missing token, etc.)
- Runtime (optional):
- status indicator like: “Opus 4.6 (via Claude Pro)” (can be hidden)
Example Config (concept)
Illustrative only; adapt to OpenCode’s existing config format.
models:
- alias: opus-4.6
group:
- provider: claude_subscription_pro
model: opus-4.6
- provider: github_copilot
model: opus-4.6
- provider: api_provider_a
model: opus-4.6
routing:
sticky_mode: session # optional: none | session | time_window
allow_feature_downgrade: false
failover:
on:
- quota_exceeded
- rate_limited
- provider_unavailable
- timeout
retry:
attempts: 1
backoff_ms: 300Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Activity
github-actions commentedon Feb 23, 2026
This issue might be a duplicate of existing issues. Please check:
Nikain commentedon Feb 23, 2026
Thanks — I reviewed #13977 and I think my request is related but not a duplicate.
Key difference: system-level model identity & provider routing, not project/agent-level lists
What I’m asking for (system-level)
Merge/Deduplicate identical models across providers into a single “model identity” (alias/group) at the global config / system layer.
For that merged model identity, support a global provider priority order:
When quota is exhausted / rate-limited / provider unavailable, OpenCode should seamlessly fail over to the next provider for the same model, without the user having to change model selection.
Why system-level matters
Relationship to #13977
I see #13977 as potentially complementary:
If maintainers agree, I’m happy to reword this issue title/description to make the scope distinction clearer (system/global vs project/agent).
github-actions commentedon Apr 25, 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.