feat: add OrcaRouter as a native provider#27842
Open
zhenjunchen-png wants to merge 1 commit into
Open
Conversation
OrcaRouter is an OpenAI-compatible meta-router that aggregates 150+ upstream LLMs and exposes a virtual `orcarouter/auto` smart-routing entry. This integration mirrors OpenRouter / ZenMux / Kilo / LLM Gateway patterns: - packages/core/src/plugin/provider/orcarouter.ts (new): V2 plugin that injects HTTP-Referer + X-Title attribution headers on provider load - packages/core/src/plugin/provider/index.ts: register OrcaRouterPlugin - packages/opencode/src/provider/provider.ts: legacy custom() entry for the same headers - packages/core/test/plugin/provider-orcarouter.test.ts (new): 5 unit tests mirroring provider-openrouter.test.ts coverage - packages/web/src/content/docs/providers.mdx: OrcaRouter section with /connect flow, orcarouter/auto adaptive routing notes, and extra_body routing-preference example Catalog data is submitted to models.dev separately (anomalyco/models.dev#1778); opencode will pick up the OrcaRouter provider entry once that PR merges and models.dev refreshes.
228108f to
223ca4c
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #
No tracking issue — OrcaRouter is already listed in models.dev (anomalyco/models.dev#1778, merged), and this PR is the standard opencode-side glue (attribution headers + docs) that mirrors what every other meta-router (OpenRouter, ZenMux, Kilo, LLM Gateway) ships.
Type of change
What does this PR do?
Adds OrcaRouter as a native provider. OrcaRouter is an OpenAI-compatible meta-router that routes a single API key across 80+ upstream LLMs (OpenAI, Anthropic, Google, xAI, DeepSeek, Qwen, Kimi, MiniMax, z.ai). It also exposes a virtual
orcarouter/autorouter that picks an upstream per request based on a per-workspace strategy (cheapest/balanced/quality/adaptive/gated_adaptive).Same pattern as the existing OpenRouter / ZenMux / Kilo / LLM Gateway plugins — five files, the only functional change is stamping
HTTP-Referer: https://opencode.ai/andX-Title: opencodeso OrcaRouter can attribute traffic to opencode in its console:packages/core/src/plugin/provider/orcarouter.ts(new) — v2OrcaRouterPlugin, fires onprovider.update.packages/core/src/plugin/provider/index.ts— register the plugin.packages/opencode/src/provider/provider.ts— legacycustom()entry for the same headers.packages/core/test/plugin/provider-orcarouter.test.ts(new) — 5 unit tests mirroring the OpenRouter / Kilo coverage.packages/web/src/content/docs/providers.mdx— OrcaRouter section.Disclosure: I work on the OrcaRouter team.
How did you verify your code works?
cd packages/core && bun test test/plugin/provider-orcarouter.test.ts— 5/5 pass. Re-ran the sibling tests (openrouter / zenmux / kilo / llmgateway / nvidia), 19/19 still pass.bun typecheckclean inpackages/coreandpackages/opencode.bun run dev .), the model picker shows the full OrcaRouter catalog (87 entries includingorcarouter/orcarouter/auto). Sent prompts against a pinned model (orcarouter/openai/gpt-5) and againstorcarouter/auto; both completed and the OrcaRouter console showed the requests with theHTTP-Referer/X-Titleheaders from this PR.Invalid tokenerror instead of crashing.Screenshots / recordings
Not a UI change — provider registration, plugin, docs.
Checklist