Skip to content

feat: add OrcaRouter as a native provider#27842

Open
zhenjunchen-png wants to merge 1 commit into
anomalyco:devfrom
zhenjunchen-png:feat/add-orcarouter-provider
Open

feat: add OrcaRouter as a native provider#27842
zhenjunchen-png wants to merge 1 commit into
anomalyco:devfrom
zhenjunchen-png:feat/add-orcarouter-provider

Conversation

@zhenjunchen-png
Copy link
Copy Markdown

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

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

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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/auto router 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/ and X-Title: opencode so OrcaRouter can attribute traffic to opencode in its console:

  • packages/core/src/plugin/provider/orcarouter.ts (new) — v2 OrcaRouterPlugin, fires on provider.update.
  • packages/core/src/plugin/provider/index.ts — register the plugin.
  • 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 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?

  • Unit tests: 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.
  • Typecheck: bun typecheck clean in packages/core and packages/opencode.
  • End-to-end with my own OrcaRouter API key: launched the TUI (bun run dev .), the model picker shows the full OrcaRouter catalog (87 entries including orcarouter/orcarouter/auto). Sent prompts against a pinned model (orcarouter/openai/gpt-5) and against orcarouter/auto; both completed and the OrcaRouter console showed the requests with the HTTP-Referer / X-Title headers from this PR.
  • Wrong-token path: confirmed a bogus key returns a clean Invalid token error instead of crashing.

Screenshots / recordings

Not a UI change — provider registration, plugin, docs.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 16, 2026
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.
@zhenjunchen-png zhenjunchen-png force-pushed the feat/add-orcarouter-provider branch from 228108f to 223ca4c Compare May 16, 2026 08:41
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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