Repository navigation
[ON HOLD — do not merge] feat(llm): add named OrcaRouter provider for backend LLM - #942
Marc-oss-hub wants to merge 1 commit into
Conversation
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]>
|
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
left a comment
There was a problem hiding this comment.
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
orcarouterblock sits after theopenrouterone, andshouldUseOpenRoutercannot swallow it —orcarouter/…does not start withopenrouter/. It also precedes thegemini/litellm/ env-LITELLM_BASE_URL/ bare-Gemini fallthrough, soconfiguredProvider === 'orcarouter'is not dead. stripProviderPrefixnow composes both parsers. For any non-orcarouter/modelparseOrcaRouterModelis the identity, so the Gemini fallback path for existing providers is unchanged.- The
DEFAULT_MODELfallthrough ingetOrcaRouterConfig, the env-onlyapiKey, and the throw-on-missing-key are identical togetOpenRouterConfig. Consistent, and the sanitize test correctly assertsorcarouter.apiKeyis 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:
baseUrlis admin-settable and validated bynormalizeModel— a model-name normalizer, not a URL check. Every backend LLM prompt goes to whatever host is typed. This is exactly true ofopenrouteron main today, so the PR propagates the pattern rather than introducing it; worth a separate issue against both.- There is no
llmServicetest file inbackend/__tests__at all, sogenerateViaOrcaRouterand the dispatch predicate ship untested — as does every sibling provider. The 44 lines added toglobalModelConfigService.test.jscover 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.
|
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. |
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 onthe 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
Related Issues
N/A
What this changes
backend/services/globalModelConfigService.ts: adds theorcarouterblock(
baseUrl+model) to thellmServiceconfig, its sanitize/merge logic andthe provider allowlist
backend/services/llmService.ts: addsgetOrcaRouterConfig,generateViaOrcaRouter,parseOrcaRouterModeland routing when the provideris
orcarouteror the model carries anorcarouter/prefixfrontend/src/components/admin/GlobalIntegrations.tsx: adds OrcaRouter to theBackend LLM Provider picker with Base URL + Model fields
.env.example: documentsORCAROUTER_API_KEY/ORCAROUTER_BASE_URLbackend/__tests__/unit/services/globalModelConfigService.test.js: coversOrcaRouter 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
sk-orca-).ORCAROUTER_API_KEY.openai/gpt-5.5,anthropic/claude-sonnet-5ordeepseek/deepseek-v4-flash. The full catalog is athttps://www.orcarouter.ai/models.
Test Plan
cd backend && npm test) —globalModelConfigServiceunit suite and
admin.globalIntegrationsroute suite green; see Notes for thefull-suite caveat in this sandbox
cd frontend && npm test)tsc --noEmitclean, frontendeslint src/.../GlobalIntegrations.tsxclean, frontendtsc --noEmitclean./dev.sh upNotes for Reviewer
Verified live through the new code path:
generateTextwith anorcarouter/-prefixed model returns a normal completion fromhttps://api.orcarouter.ai/v1/chat/completions.
In this Windows sandbox the full backend
npm testrun hangs on an unrelatedopen-handle test after the changed-file suites pass; the suites covering the
changed code (
globalModelConfigService.test.js,admin.globalIntegrations.test.js)are green.