feat(providers): add OrcaRouter as a named OpenAI-compatible provider - #436
feat(providers): add OrcaRouter as a named OpenAI-compatible provider#436lovejones2914-spec wants to merge 1 commit into
Conversation
Mirror the existing OpenRouter wiring end to end so OrcaRouter works as a first-class provider rather than an anonymous custom base URL: - modelResolver: detect/normalize api.orcarouter.ai base URLs, add a default base, and hydrate model metadata + pricing from the OrcaRouter /v1/models catalog and /api/pricing ratios. - client: route OrcaRouter base URLs through the OpenAI chat/completions adapter and forward HTTP-Referer / X-Title attribution headers from ORCAROUTER_REFERER / ORCAROUTER_TITLE. - providerRoutePlan/run/sessionRunner/engine: add an orcarouter/ model-id route and ORCAROUTER_API_KEY key source, with a boundary-safe hostname classifier (lookalike domains never receive OrcaRouter credentials). - providerFailures: classify OrcaRouter auth failures and redact sk-orca- keys. - docs: docs/orcarouter.md plus OrcaRouter rows in the provider tables. - tests: unit coverage for catalog hydration, routing, failure hints, and lookalike-host rejection; L3 live call verified against api.orcarouter.ai.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 29, 2026, 12:01 AM ET / 04:01 UTC. ClawSweeper reviewWhat this changesThe PR adds OrcaRouter as a named OpenAI-compatible API provider, including routing, credential selection, catalog metadata, diagnostics, tests, and documentation. Merge readinessKeep this PR open for maintainer product direction and revision: the named-provider idea is coherent and has a real API trace, but the new credential route permits an HTTP downgrade, the advertised ORCAROUTER_API_KEY-only path fails for the default model, and catalog resolution is not actually best-effort when pricing fetches fail. Priority: P1 Review scores
Verification
How this fits togetherOracle’s API-mode CLI resolves a requested model to a provider route and credential, then constructs the corresponding client for the provider endpoint. This change adds an OrcaRouter route that feeds the existing OpenAI-compatible chat-completions adapter. flowchart LR
A[CLI model request] --> B[Engine selection]
B --> C[Provider route selection]
C --> D[Credential selection]
D --> E[OrcaRouter endpoint]
E --> F[OpenAI-compatible client]
F --> G[Model response and session logs]
Decision needed
Why: This adds a maintained third-party endpoint, credential convention, catalog format, and pricing-ratio dependency; source review cannot determine whether that recurring product surface is wanted. Before merge
Findings
Agent review detailsSecurityNeeds attention: The new named-provider credential route does not require HTTPS before dispatch. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: If maintainers sponsor named OrcaRouter support, restrict its credential route to HTTPS, make the ORCAROUTER_API_KEY-only fallback match the documented invocation, isolate optional pricing failures from model discovery, add regression coverage, and add one Unreleased changelog entry. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives two deterministic paths: configure only ORCAROUTER_API_KEY and use the default model to reach a missing OPENAI_API_KEY error, or use an HTTP OrcaRouter base URL to select the named credential without a TLS guard. No target code was executed in this read-only review. Is this the best way to solve the issue? No. The existing custom base URL and model-override path already supports OpenAI-compatible gateways, so a named integration needs explicit sponsorship; if sponsored, it must fix the TLS, default-routing, and optional-pricing faults before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bbc1b3b0261d. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What
Adds OrcaRouter as a named provider, mirroring the existing OpenRouter wiring as closely as possible. OrcaRouter is an OpenAI-compatible AI gateway built for both models and agents. Like OpenRouter, it exposes a provider/model namespace across many models, but it also combines adaptive routing, automatic failover, zero-markup inference, observability, guardrails, and agent-tool governance behind the same endpoint. Adding
orcarouteras a first-class provider means Oracle's users can use that stack directly, without treating OrcaRouter as an anonymous custom base URL. 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.Changes
This mirrors how Oracle already wires OpenRouter (the shared provider-routing contract in
providerRoutePlan.ts), file by file:src/oracle/modelResolver.ts: detect/normalizeapi.orcarouter.aibase URLs (isOrcaRouterBaseUrl/defaultOrcaRouterBaseUrl/normalizeOrcaRouterBaseUrl), and hydrate model metadata from the OrcaRouter/v1/modelscatalog plus pricing ratios from the public/api/pricingendpoint. The catalog returns the same OpenRouter-shapeddata[]payload, so the existingmapToOpenRouterIdmapping is reused. The hostname check is boundary-safe (onlyapi.orcarouter.aior a subdomain matches), so a lookalike hostname never receives OrcaRouter credentials.src/oracle/client.ts: route OrcaRouter base URLs through the OpenAI chat/completions adapter (same as OpenRouter/custom proxies) and forward optional attribution headersHTTP-Referer/X-TitlefromORCAROUTER_REFERER/ORCAROUTER_TITLE.src/oracle/providerRoutePlan.ts: routeorcarouter/...model ids tohttps://api.orcarouter.ai/v1and selectORCAROUTER_API_KEYas the key source. Unprefixed custom model ids keep the existing OpenRouter fallback, so current setups are unchanged.src/oracle/run.ts,src/cli/sessionRunner.ts,src/cli/engine.ts: thread the OrcaRouter route, missing-key message, and API-mode detection through the runtime.src/oracle/providerFailures.ts: classify OrcaRouter auth failures and redactsk-orca-...keys from error messages.docs/orcarouter.md: new provider guide (setup, models, headers), plus OrcaRouter rows in theREADME,docs/index.md,docs/install.md,docs/openai-endpoints.md,docs/cli-reference.md,docs/mythical-pro-agents.md, anddocs/followup.mdprovider tables.tests/: unit coverage for catalog hydration,orcarouter/...routing, key-source selection, failure hints, and lookalike-hostname rejection.How it was verified
pnpm typecheck,pnpm lint, andpnpm format:checkall pass.browserTabstest that needsrsync, which is not installed in this container).resolveProviderRouteselects the OrcaRouter route (providerLabel=OrcaRouter,base=api.orcarouter.ai/v1,keySource=ORCAROUTER_API_KEY), and a real chat/completions call throughcreateDefaultClientFactoryreturned"ORCA-LIVE-OK".OrcaRouter API keys start with
sk-orca-; full model catalog is at https://www.orcarouter.ai/models. Questions or feedback: Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouterI'm an engineer on the OrcaRouter team.