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]: Add Omniroute provider with dynamic model discovery #25947
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Add Omniroute as a built-in provider in OpenCode.
Omniroute is an OpenAI-compatible provider/gateway. It can expose user-defined/custom models, so a static bundled model list is not enough. Users currently need to configure Omniroute manually as a custom OpenAI-compatible provider and keep model definitions in sync themselves.
I found related issues about dynamic model discovery for generic OpenAI-compatible custom providers, but this request is specifically for first-class Omniroute support:
Implement it as an OpenAI-compatible provider, e.g. via @ai-sdk/openai-compatible.
Support dynamic model discovery for Omniroute, so models added by the user in Omniroute become available in OpenCode without manually editing the OpenCode config.
If possible, use Omniroute's OpenAI-compatible model listing endpoint, for example /v1/models, or a provider-specific discovery endpoint if Omniroute exposes one.
Why this helps:
Omniroute users can add their own custom models and route them through one OpenAI-compatible endpoint.
OpenCode would show the actual available Omniroute models instead of requiring users to duplicate model metadata in config.
This makes Omniroute consistent with the provider UX for model gateways while preserving custom model support.
Reacted by Chris Kuethe, Jason Landbridge, < Marcelo Caetano /> and Felipe A L Pereira
changed the title [-]Add Omniroute provider with dynamic model discovery[/-][+][FEATURE]: Add Omniroute provider with dynamic model discovery[/+]on May 6, 2026
Thank you for updating the issue! It now follows the contributing guidelines and looks good. We appreciate the clear description and the context you provided about Omniroute.
Dynamic model discovery is the right approach for OpenAI-compatible gateways. Static model lists break the moment the gateway adds or removes models. Here's a pattern that works reliably across diverse backends:
1. Probe /v1/models with graceful fallback
asyncdefdiscover_models(base_url: str, api_key: str, timeout: float=5.0) ->list[str]:
"""Discover available models from an OpenAI-compatible endpoint."""try:
asyncwithhttpx.AsyncClient(timeout=timeout) asclient:
resp=awaitclient.get(
f"{base_url.rstrip('/')}/v1/models",
headers={"Authorization": f"Bearer {api_key}"}
)
ifresp.status_code==200:
data=resp.json()
return [m["id"] formindata.get("data", [])]
except (httpx.TimeoutException, httpx.ConnectError):
passreturn [] # Caller falls back to static list
2. Cache with TTL and background refresh
Model lists rarely change mid-session. Cache for 5-15 minutes with a background refresh:
When the /v1/models response doesn't include capability metadata, infer from naming patterns:
*instruct* -> chat/completion
*embed* -> embeddings only
*vision* or *omni* -> multimodal
*tts* / *whisper* -> audio
This won't be perfect but handles 90% of real-world model names.
4. Health check on startup
Run a lightweight /v1/models probe when the provider is first configured and surface errors immediately in the UI rather than waiting for the first chat request to fail.
This pattern is what many multi-provider tools use (including gateway services) — it eliminates the "model not found" class of errors that users hit when gateways update their model catalog.
Activity
github-actions commentedon May 6, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:(e.g.[FEATURE]: Add Omniroute provider with dynamic model discovery)Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
[-]Add Omniroute provider with dynamic model discovery[/-][+][FEATURE]: Add Omniroute provider with dynamic model discovery[/+]github-actions commentedon May 6, 2026
Thank you for updating the issue! It now follows the contributing guidelines and looks good. We appreciate the clear description and the context you provided about Omniroute.
XidaoApi commentedon May 9, 2026
Dynamic model discovery is the right approach for OpenAI-compatible gateways. Static model lists break the moment the gateway adds or removes models. Here's a pattern that works reliably across diverse backends:
1. Probe
/v1/modelswith graceful fallback2. Cache with TTL and background refresh
Model lists rarely change mid-session. Cache for 5-15 minutes with a background refresh:
3. Capability inference from model IDs
When the
/v1/modelsresponse doesn't include capability metadata, infer from naming patterns:*instruct*-> chat/completion*embed*-> embeddings only*vision*or*omni*-> multimodal*tts*/*whisper*-> audioThis won't be perfect but handles 90% of real-world model names.
4. Health check on startup
Run a lightweight
/v1/modelsprobe when the provider is first configured and surface errors immediately in the UI rather than waiting for the first chat request to fail.This pattern is what many multi-provider tools use (including gateway services) — it eliminates the "model not found" class of errors that users hit when gateways update their model catalog.
github-actions commentedon Jul 9, 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.