feat: add OrcaRouter provider#3729
Open
zhenjunchen-png wants to merge 1 commit into
Open
Conversation
Add OrcaRouter (https://www.orcarouter.ai/) as a built-in provider, following the same shape as the existing OpenRouter integration. OrcaRouter is an OpenAI-compatible LLM aggregator with namespaced model IDs (e.g. openai/gpt-5.5, anthropic/claude-opus-4.7) and a built-in orcarouter/auto adaptive router. - type: ModelProviderType.OpenAI under https://api.orcarouter.ai/v1 - 8 curated flagships in defaultSettings.models (auto + 7 channels) - HTTP-Referer + X-Title attribution via createOpenAICompatible headers — no new npm dependency - modelsDevProviderId: 'orcarouter' for models.dev enrichment - Reasoning via the existing extractReasoningMiddleware Disclosure: I'm an engineer on the OrcaRouter team. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Description
Add OrcaRouter as a built-in provider, following the same shape as the existing OpenRouter integration.
OrcaRouter (https://www.orcarouter.ai/) is an OpenAI-compatible LLM aggregator with a namespaced model ID convention (
openai/gpt-5.5,anthropic/claude-opus-4.7, …) and a built-inorcarouter/autoadaptive router that picks an upstream based on cost / latency / quality strategies configurable in the OrcaRouter console.The integration mirrors OpenRouter's design:
type: ModelProviderType.OpenAI, OpenAI-compatible REST underhttps://api.orcarouter.ai/v1defaultSettings.models(theorcarouter/autorouter plus 7 channel flagships)HTTP-Referer: https://www.orcarouter.ai/+X-Title: Chatboxinjected via@ai-sdk/openai-compatible'screateOpenAICompatible({ headers })— no new npm dependency addedmodelsDevProviderId: 'orcarouter'registered inprovider-mapping.tsso the models.dev registry can enrich model metadata at runtime (the correspondingproviders/orcarouterentry already exists on models.dev)extractReasoningMiddleware({ tagName: 'think' })shared withOpenAICompatibleDisclosure: I'm an engineer on the OrcaRouter team.
Files changed
src/shared/types/provider.tsOrcaRouter = 'orcarouter'toModelProviderEnumsrc/shared/providers/definitions/models/orcarouter.tsOrcaRouterextendsOpenAICompatible; pins apiHost; injects attribution headers ingetProvider()src/shared/providers/definitions/orcarouter.tsdefineProvider({...})with 8 curated models +modelsDevProviderIdsrc/shared/providers/definitions/models/orcarouter.test.tssrc/shared/providers/index.tssrc/renderer/components/icons/ProviderIcon.tsx<image href={…}>src/renderer/static/icons/providers/orcarouter.pngProviderImageIconandProviderIconsrc/shared/model-registry/provider-mapping.tsorcarouter: 'orcarouter'mapping (required byindex.contract.test.ts)scripts/orcarouter-live-test.mjsTotal tracked diff against
main: 4 files modified (+7 lines), 5 files added.Curated models
orcarouter/autoopenai/gpt-5.5google/gemini-3.5-flashanthropic/claude-opus-4.7grok/grok-4.3deepseek/deepseek-v4-prominimax/minimax-m2.7qwen/qwen3.7-maxThe full OrcaRouter catalog (~160 models) is reachable via the "Fetch Models" button (calls
GET /v1/models) and via models.dev registry enrichment.Screenshots
1. Settings → Model Providers, with OrcaRouter selected (provider list + brand logo + API key field + 8 curated models)
2. Chat → model selector dropdown, OrcaRouter group with the 8 curated flagships
Test plan
Automated (no API key required):
```bash
pnpm install
pnpm exec vitest run
src/shared/providers/index.contract.test.ts
src/shared/providers/definitions/models/orcarouter.test.ts
Test Files 2 passed (2)
Tests 6 passed (6)
```
Contract test verifies provider ID uniqueness,
modelsDevProviderIdmapping consistency, and that every curated model ID is backed bydefaultSettings.models. Unit test verifies apiHost is pinned, provider name isOrcaRouter, and constructor options pass through to the model instance.Live API smoke (requires a real OrcaRouter API key from https://www.orcarouter.ai/console):
```bash
bash / zsh
ORCAROUTER_API_KEY=sk-orca-xxx node scripts/orcarouter-live-test.mjs
PowerShell
$env:ORCAROUTER_API_KEY = 'sk-orca-xxx'; node scripts/orcarouter-live-test.mjs
```
Verified 6/6 cases pass against the live API: non-stream chat (
orcarouter/auto), streaming chat (openai/gpt-5.5), reasoning model withouttemperature(anthropic/claude-opus-4.7), invalid API key → HTTP 401, invalid model → error,GET /v1/models(160 entries).UI manual:
```bash
pnpm install
pnpm rebuild electron
pnpm run dev
Settings → Model Providers → click "OrcaRouter"
Paste API key from https://www.orcarouter.ai/console
Select e.g. orcarouter/auto from the 8 curated flagships
Send a message
```
Verified locally on Windows (screenshots above): provider appears in the list with brand logo, the 8 curated flagships populate the model dropdown, and sending a message routes through OrcaRouter and returns a reply.
Docs
I did not update
docs/technical/ai-providers.md. That file reads as a snapshot summary of internal providers as of March 2026 rather than a per-provider docs page. Happy to add an OrcaRouter line under the "聚合平台 / Aggregators" group if that matches the project convention.Contributor Agreement
By submitting this Pull Request, I confirm that I have read and agree to the following terms:
Please check the box below to confirm: