GeezerVison is showing github.com — feat(core): add OmniRoute custom provider support by MohammadMD1383 · Pull Request #32170 · anomalyco/opencode
Conversation
Issue for this PR
Closes #
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Adds OmniRoute as a supported custom provider. OmniRoute is a gateway that connects to any OpenAI-compatible endpoint and dynamically discovers models via /v1/models.
When a user runs opencode auth login and selects OmniRoute, they're prompted for the endpoint URL and an optional API key. The provider then fetches the model list from the endpoint and makes them available for chat.
Key implementation details:
- Registered as a well-known
ProviderV2.ID with a static entry in the provider database
- Auth plugin prompts for endpoint URL and API key; SDK plugin loads
@ai-sdk/openai-compatible
- The custom loader normalizes the base URL (strips trailing
/v1 to prevent double-prefix in the discovery path)
- Model discovery fetches
GET ${baseURL}/v1/models — sends Authorization: Bearer header only when an API key was provided, skips it otherwise for unauthenticated endpoints
- Maps the response to internal
Model format with sensible defaults (128K context, 4K output) when fields are missing
- 13 contract tests covering model mapping, defaults, deduplication, error handling, and integration
How did you verify your code works?
bun typecheck passes across all packages
- All 13 new tests in
packages/opencode/test/provider/omniroute.test.ts pass
- Manually tested against a live OmniRoute instance: ran
opencode auth login, entered endpoint URL and API key, verified models appeared in the provider list and model selection dialog
Screenshots / recordings
N/A — provider-only change, no UI modifications
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate:
Based on my search results, I found several related PRs that involve gateway/proxy providers and auto-discovery mechanisms:
Potentially Related PRs:
-
#19959 - "feat(opencode): add local server provider with auto model discovery"
- Similar: Implements auto-discovery of models from a local server endpoint
-
#27554 - "feat(opencode): local LAN provider discovery + auto-discover models"
- Similar: Adds local LAN provider support with auto model discovery
-
#14468 - "feat(opencode): add LiteLLM provider with auto model discovery"
- Similar: Implements a provider with dynamic model discovery from an external service
-
#28387 - "feat(provider): add Aperture gateway provider"
- Similar: Adds support for a gateway provider (similar architecture to OmniRoute)
-
#32052 - "fix(provider): pass apiKey to createUnified for Cloudflare AI Gateway"
- Similar: Handles API key authentication for gateway providers
These PRs share similar patterns: gateway/proxy support, dynamic model discovery, and OpenAI-compatible endpoints. You may want to review them for consistency in implementation approach and whether any overlapping functionality should be consolidated.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jun 14, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.