Skip to content

[ON HOLD — do not merge] feat(llm): add named OrcaRouter provider for backend LLM - #942

Closed
Marc-oss-hub wants to merge 1 commit into
Team-Commonly:mainfrom
Marc-oss-hub:feat/orcarouter-provider
Closed

Marc-oss-hub wants to merge 1 commit into
Team-Commonly:mainfrom
Marc-oss-hub:feat/orcarouter-provider

Conversation

@Marc-oss-hub

Copy link
Copy Markdown

Summary

Adds OrcaRouter as a named model provider for the
backend LLM service, mirroring the existing OpenRouter wiring. OrcaRouter is an
OpenAI-compatible model routing gateway exposing 190+ models from OpenAI,
Anthropic, Google, DeepSeek and others behind a single endpoint and one
sk-orca- key. It also runs gateway-level, zero-trust security for AI agents on
the same endpoint — screening every prompt/response and governing every tool
call on a default-deny basis, with no application code changes.

I'm an engineer on the OrcaRouter team.

Type

  • New feature
  • Agent integration

Related Issues

N/A

What this changes

  • backend/services/globalModelConfigService.ts: adds the orcarouter block
    (baseUrl + model) to the llmService config, its sanitize/merge logic and
    the provider allowlist
  • backend/services/llmService.ts: adds getOrcaRouterConfig,
    generateViaOrcaRouter, parseOrcaRouterModel and routing when the provider
    is orcarouter or the model carries an orcarouter/ prefix
  • frontend/src/components/admin/GlobalIntegrations.tsx: adds OrcaRouter to the
    Backend LLM Provider picker with Base URL + Model fields
  • .env.example: documents ORCAROUTER_API_KEY / ORCAROUTER_BASE_URL
  • backend/__tests__/unit/services/globalModelConfigService.test.js: covers
    OrcaRouter defaults and the apiKey drop on save

Why a separate provider rather than the OpenAI-compatible escape hatch

This mirrors how OpenRouter is wired in this repo, so the model picker, config
reference and env docs stay consistent for users.

How to use it

  1. Get an API key at https://www.orcarouter.ai/console (keys start with sk-orca-).
  2. Set ORCAROUTER_API_KEY.
  3. Pick a model id such as openai/gpt-5.5, anthropic/claude-sonnet-5 or
    deepseek/deepseek-v4-flash. The full catalog is at
    https://www.orcarouter.ai/models.

Test Plan

  • Backend tests pass (cd backend && npm test) — globalModelConfigService
    unit suite and admin.globalIntegrations route suite green; see Notes for the
    full-suite caveat in this sandbox
  • Frontend tests pass (cd frontend && npm test)
  • Linting / typecheck passes — backend tsc --noEmit clean, frontend
    eslint src/.../GlobalIntegrations.tsx clean, frontend tsc --noEmit clean
  • Tested locally with ./dev.sh up
  • Added/updated tests for new behavior

Notes for Reviewer

Verified live through the new code path: generateText with an
orcarouter/-prefixed model returns a normal completion from
https://api.orcarouter.ai/v1/chat/completions.

In this Windows sandbox the full backend npm test run hangs on an unrelated
open-handle test after the changed-file suites pass; the suites covering the
changed code (globalModelConfigService.test.js, admin.globalIntegrations.test.js)
are green.

Mirrors the existing OpenRouter wiring for OrcaRouter, the OpenAI-compatible
gateway at https://api.orcarouter.ai (sk-orca- keys).

- globalModelConfigService: add orcarouter block (baseUrl + model) to the
  llmService config, sanitize/merge logic, and provider allowlist
- llmService: add generateViaOrcaRouter (no attribution headers), config
  resolution from llmService.orcarouter + ORCAROUTER_* env, model prefix
  stripping, and routing when provider is 'orcarouter' or the model is
  prefixed with orcarouter/
- GlobalIntegrations admin UI: add OrcaRouter backend provider option with
  base URL + model fields
- .env.example: document ORCAROUTER_API_KEY / ORCAROUTER_BASE_URL
- unit tests: cover orcarouter defaults and key-drop on save

Co-Authored-By: Claude <[email protected]>
@lilyshen0722

Copy link
Copy Markdown
Contributor

On hold — Sam's call, 2026-08-19. Do not merge.

Not a quality judgement on the diff. The OrcaRouter provider is a new backend LLM dependency and Sam wants it left alone for now; it will be picked up deliberately rather than swept along with the queue.

@fable-lead @sprint-review @pod-architect — please skip this one when working the merge queue. If CI drifts red in the meantime that is expected and not worth chasing.

@lilyshen0722 lilyshen0722 changed the title feat(llm): add named OrcaRouter provider for backend LLM routing [ON HOLD — do not merge] feat(llm): add named OrcaRouter provider for backend LLM Aug 19, 2026

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprint Review — advisory read at bd7e8809

This PR carries the maintainers' [ON HOLD — do not merge] and has for 17 days; nothing below asks for that to change. It had no review at any head, so here is one for whenever the hold lifts.

The wiring is a faithful mirror of the OpenRouter path. I checked the things that usually break when a provider is copied:

  • Dispatch is reachable and unshadowed. The orcarouter block sits after the openrouter one, and shouldUseOpenRouter cannot swallow it — orcarouter/… does not start with openrouter/. It also precedes the gemini / litellm / env-LITELLM_BASE_URL / bare-Gemini fallthrough, so configuredProvider === 'orcarouter' is not dead.
  • stripProviderPrefix now composes both parsers. For any non-orcarouter/ model parseOrcaRouterModel is the identity, so the Gemini fallback path for existing providers is unchanged.
  • The DEFAULT_MODEL fallthrough in getOrcaRouterConfig, the env-only apiKey, and the throw-on-missing-key are identical to getOpenRouterConfig. Consistent, and the sanitize test correctly asserts orcarouter.apiKey is never persisted.

One thing to fix, small and concrete. GlobalIntegrations.tsx:1200 still reads:

"OpenRouter API key is sourced from Kubernetes secrets/env only (not editable in UI). Gemini continues using GEMINI_API_KEY."

The picker now offers a third provider that helper text does not name. An admin who selects OrcaRouter gets Base URL and Model fields, no key field, and no sentence telling them a key is needed at all — the first symptom is OrcaRouter API key is required thrown on every generateText, which then silently falls back to Gemini wherever GEMINI_API_KEY is set. That is a hand-maintained prose list of providers sitting next to an enum that grew; adding OrcaRouter to the sentence is the whole fix.

Two notes, neither this PR's to pay:

  • baseUrl is admin-settable and validated by normalizeModel — a model-name normalizer, not a URL check. Every backend LLM prompt goes to whatever host is typed. This is exactly true of openrouter on main today, so the PR propagates the pattern rather than introducing it; worth a separate issue against both.
  • There is no llmService test file in backend/__tests__ at all, so generateViaOrcaRouter and the dispatch predicate ship untested — as does every sibling provider. The 44 lines added to globalModelConfigService.test.js cover the config layer properly.

Given the hold and the third-party origin, I'd want the maintainers' call on the provider itself before the code details matter. The code, as code, is clean.

@lilyshen0722

Copy link
Copy Markdown
Contributor

Thanks for this, Marc. We're closing it. Every model call goes through our LiteLLM gateway, so adding providers one by one in the backend isn't a path we want to maintain. If OrcaRouter works as a LiteLLM provider, that's the route. Appreciate the clean PR.

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.

2 participants