Skip to content

feat: add OrcaRouter provider#3729

Open
zhenjunchen-png wants to merge 1 commit into
chatboxai:mainfrom
zhenjunchen-png:feat/orcarouter-provider
Open

feat: add OrcaRouter provider#3729
zhenjunchen-png wants to merge 1 commit into
chatboxai:mainfrom
zhenjunchen-png:feat/orcarouter-provider

Conversation

@zhenjunchen-png

@zhenjunchen-png zhenjunchen-png commented May 29, 2026

Copy link
Copy Markdown

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-in orcarouter/auto adaptive 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 under https://api.orcarouter.ai/v1
  • 8 curated flagship models in defaultSettings.models (the orcarouter/auto router plus 7 channel flagships)
  • Attribution headers HTTP-Referer: https://www.orcarouter.ai/ + X-Title: Chatbox injected via @ai-sdk/openai-compatible's createOpenAICompatible({ headers })no new npm dependency added
  • modelsDevProviderId: 'orcarouter' registered in provider-mapping.ts so the models.dev registry can enrich model metadata at runtime (the corresponding providers/orcarouter entry already exists on models.dev)
  • Reasoning support via the existing extractReasoningMiddleware({ tagName: 'think' }) shared with OpenAICompatible

Disclosure: I'm an engineer on the OrcaRouter team.

Files changed

File Type Notes
src/shared/types/provider.ts mod (+1) add OrcaRouter = 'orcarouter' to ModelProviderEnum
src/shared/providers/definitions/models/orcarouter.ts new OrcaRouter extends OpenAICompatible; pins apiHost; injects attribution headers in getProvider()
src/shared/providers/definitions/orcarouter.ts new defineProvider({...}) with 8 curated models + modelsDevProviderId
src/shared/providers/definitions/models/orcarouter.test.ts new unit tests for apiHost / name / option pass-through
src/shared/providers/index.ts mod (+1) side-effect import of the new provider definition
src/renderer/components/icons/ProviderIcon.tsx mod (+4) OrcaRouter case renders the brand PNG via <image href={…}>
src/renderer/static/icons/providers/orcarouter.png new (108×108, 17 KB) brand logo used by ProviderImageIcon and ProviderIcon
src/shared/model-registry/provider-mapping.ts mod (+1) orcarouter: 'orcarouter' mapping (required by index.contract.test.ts)
scripts/orcarouter-live-test.mjs new live-API smoke script (non-stream / stream / reasoning / bad key / bad model / list-models)

Total tracked diff against main: 4 files modified (+7 lines), 5 files added.

Curated models

modelId nickname context output
orcarouter/auto OrcaRouter Auto 128k 16k
openai/gpt-5.5 GPT-5.5 400k 128k
google/gemini-3.5-flash Gemini 3.5 Flash 1M 64k
anthropic/claude-opus-4.7 Claude Opus 4.7 1M 128k
grok/grok-4.3 Grok 4.3 256k 64k
deepseek/deepseek-v4-pro DeepSeek V4 Pro 160k 160k
minimax/minimax-m2.7 MiniMax M2.7 200k 128k
qwen/qwen3.7-max Qwen 3.7 Max 1M 64k

The 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)

1

2. Chat → model selector dropdown, OrcaRouter group with the 8 curated flagships

2

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, modelsDevProviderId mapping consistency, and that every curated model ID is backed by defaultSettings.models. Unit test verifies apiHost is pinned, provider name is OrcaRouter, 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 without temperature (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:

  • I agree to contribute all code submitted in this PR to the open-source community edition licensed under GPLv3 and the proprietary official edition without compensation.
  • I grant the official edition development team the rights to freely use, modify, and distribute this code, including for commercial purposes.
  • I confirm that this code is my original work, or I have obtained the appropriate authorization from the copyright holder to submit this code under these terms.
  • I understand that the submitted code will be publicly released under the GPLv3 license, and may also be used in the proprietary official edition.

Please check the box below to confirm:

  • I have read and agree with the above statement.

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>
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c6216dc3-0690-4197-b569-b4c81ba1fc03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant