Skip to content

feat: add OrcaRouter gateway descriptor - #2125

Open
Marc-oss-hub wants to merge 1 commit into
Gitlawb:mainfrom
Marc-oss-hub:feat/orcarouter-gateway
Open

Marc-oss-hub wants to merge 1 commit into
Gitlawb:mainfrom
Marc-oss-hub:feat/orcarouter-gateway

Conversation

@Marc-oss-hub

@Marc-oss-hub Marc-oss-hub commented Aug 13, 2026

Copy link
Copy Markdown

Add OrcaRouter gateway descriptor

Summary

Adds first-class support for OrcaRouter, an OpenAI-compatible model routing gateway, as a generated gateway descriptor. The gateway is set up like the existing OpenRouter entry, with its own base URL (https://api.orcarouter.ai/v1), dedicated ORCAROUTER_API_KEY credential, and a hybrid catalog that combines authenticated model discovery with curated entries for the orcarouter/auto named router and flagship models (openai/gpt-5.5, anthropic/claude-sonnet-4.6, google/gemini-3.5-flash).

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.

Impact

  • New gateway preset appears in /provider and profile flows via the generated preset manifest (following docs/integrations/how-to/add-gateway.md).
  • ORCAROUTER_API_KEY is added to the env-file allow-list so it can be stored in provider setup files.
  • The web provider list and README providers table surface the new gateway.
  • No changes to existing providers or routing behavior.

Testing

  • bun run integrations:generate (artifacts regenerated) and bun run integrations:check pass.
  • bun run typecheck passes.
  • bun run smoke passes (build + CLI version 0.28.0).
  • Focused test bun test src/integrations/gateways/orcarouter.test.ts passes (2 pass, 0 fail).
  • Integration suite bun test src/integrations passes except two pre-existing failures (discoverModelsForRoute ApiSmart timeout, AIMLAPI runtime attribution) that fail identically on clean main.
  • Live against OrcaRouter through the built CLI (--provider orcarouter --model openai/gpt-5.5): returned ORCA-OK.
  • Live GET /v1/models with the key returns 200 and includes orcarouter/auto and openai/gpt-5.5; orcarouter/auto chat returns 200.

Notes

  • dedicatedCredentialsOnly: true prevents a generic OPENAI_API_KEY from being sent to the OrcaRouter endpoint.
  • orcarouter/auto is a virtual model (the gateway resolves the serving model server-side), so it has no model descriptor reference, matching the existing gitlawb-opengateway auto entry.

Summary by CodeRabbit

  • New Features

    • Added OrcaRouter as a supported AI provider.
    • Added automatic model routing and access to GPT-5.5, Claude Sonnet 4.6, and Gemini 3.5 Flash.
    • Added model discovery with background refresh and API key configuration through ORCAROUTER_API_KEY.
  • Documentation

    • Updated provider documentation and setup guidance for OrcaRouter.

Add first-class support for OrcaRouter, an OpenAI-compatible model routing
gateway, as a generated gateway descriptor with hybrid catalog discovery
and curated flagship models (openai/gpt-5.5, anthropic/claude-sonnet-4.6,
google/gemini-3.5-flash) plus its orcarouter/auto named router. Registers
ORCAROUTER_API_KEY in the env-file allow-list, surfaces the provider in the
web provider list and README, and updates the compatibility/registry tests
for the new preset.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f141d6b6-9e80-4e05-9e80-2d6ae80e0ff9

📥 Commits

Reviewing files that changed from the base of the PR and between 575b407 and 76c01c5.

⛔ Files ignored due to path filters (2)
  • src/integrations/generated/integrationArtifacts.generated.ts is excluded by !**/*.generated.*, !**/generated/**, !src/integrations/generated/**
  • src/integrations/generated/integrationManifest.generated.ts is excluded by !**/*.generated.*, !**/generated/**, !src/integrations/generated/**
📒 Files selected for processing (7)
  • README.md
  • src/integrations/compatibility.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/integrations/gateways/orcarouter.ts
  • src/integrations/index.test.ts
  • src/utils/envFile.ts
  • web/src/data/providers.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode and ESM imports throughout the source code.

Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes when applicable.

Files:

  • src/integrations/compatibility.test.ts
  • web/src/data/providers.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use React and Ink patterns for terminal UI components.

Files:

  • src/integrations/compatibility.test.ts
  • web/src/data/providers.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Use chalk for terminal color and execa for child-process execution when those capabilities are needed.

Files:

  • src/integrations/compatibility.test.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Add or update tests when behavior changes, and run the narrowest useful focused test checks.

Files:

  • src/integrations/compatibility.test.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.

**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.

Files:

  • src/integrations/compatibility.test.ts
  • web/src/data/providers.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such as bun test ./path/to/test-file.test.ts when validating a narrowly scoped change.

Files:

  • src/integrations/compatibility.test.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when setup, commands, or user-facing behavior changes.

Files:

  • src/integrations/compatibility.test.ts
  • README.md
  • web/src/data/providers.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/compatibility.test.ts
  • README.md
  • web/src/data/providers.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/utils/envFile.ts
  • src/integrations/gateways/orcarouter.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/compatibility.test.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
  • src/integrations/gateways/orcarouter.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/compatibility.test.ts
  • src/integrations/index.test.ts
  • src/integrations/gateways/orcarouter.test.ts
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • README.md
web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When changing the web application, run the web typecheck and build checks.

Files:

  • web/src/data/providers.ts
web/**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When changing files under web/, run bun run web:typecheck and bun run web:build.

Files:

  • web/src/data/providers.ts
web/**

⚙️ CodeRabbit configuration file

web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.

Files:

  • web/src/data/providers.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: Gitlawb/openclaude PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-08-07T01:57:16.417Z
Learning: Applies to **/* : Update documentation when setup, commands, or user-facing behavior changes.
📚 Learning: 2026-08-07T01:57:07.096Z
Learnt from: CR
Repo: Gitlawb/openclaude PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-07T01:57:07.096Z
Learning: Applies to **/*.{test,spec}.{ts,tsx} : Add or update tests when behavior changes, and run the narrowest useful focused test checks.

Applied to files:

  • src/integrations/compatibility.test.ts
  • src/integrations/gateways/orcarouter.test.ts
📚 Learning: 2026-08-07T01:57:16.417Z
Learnt from: CR
Repo: Gitlawb/openclaude PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-08-07T01:57:16.417Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx} : Add or update tests when a code change affects behavior.

Applied to files:

  • src/integrations/compatibility.test.ts
🔇 Additional comments (8)
README.md (1)

284-284: LGTM!

web/src/data/providers.ts (1)

143-150: LGTM!

src/integrations/gateways/orcarouter.ts (2)

1-30: LGTM!

Also applies to: 37-65


31-36: 🔒 Security & Privacy

No cache change is required.

			> Likely an incorrect or invalid review comment.
src/integrations/gateways/orcarouter.test.ts (1)

5-27: 📐 Maintainability & Code Quality

Report focused validation results.

The supplied context does not include command output. Run and report these results before merge:

  • bun test ./src/integrations/gateways/orcarouter.test.ts
  • bun test ./src/integrations/compatibility.test.ts
  • bun test ./src/integrations/index.test.ts
  • bun test ./src/utils/envFile.test.ts
  • bun run typecheck
  • bun run typecheck:type-tests

As per coding guidelines, TypeScript behavior changes require focused tests and type checks. As per path instructions, report exact provider and integration validation commands.

Sources: Coding guidelines, Path instructions

src/integrations/compatibility.test.ts (1)

36-36: LGTM!

src/integrations/index.test.ts (1)

70-72: LGTM!

src/utils/envFile.ts (1)

96-96: LGTM!


📝 Walkthrough

Walkthrough

Changes

Adds OrcaRouter as an OpenAI-compatible provider with API-key authentication, hybrid model discovery, routing presets, compatibility coverage, environment configuration, and web and README documentation.

OrcaRouter provider

Layer / File(s) Summary
Gateway and model catalog
src/integrations/gateways/orcarouter.ts, src/integrations/gateways/orcarouter.test.ts
Adds the gateway configuration, readiness probe, cached model discovery, manual refresh, routing presets, and gateway tests.
Provider registration and credential wiring
src/integrations/compatibility.test.ts, src/integrations/index.test.ts, src/utils/envFile.ts
Registers the provider preset, exempts the server-resolved auto model from shared descriptors, and permits ORCAROUTER_API_KEY in provider environment files.
Provider catalog and documentation
README.md, web/src/data/providers.ts
Adds OrcaRouter setup details, endpoint information, model metadata, and routing descriptions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 76c01

This PR adds a localized OrcaRouter provider descriptor and related generated listings without changing existing provider behavior. No actionable merge-blocking risk remains beyond normal review and checks.

Possibly related issues

  • Gitlawb/openclaude#2122 — Adds a similar first-class OpenAI-compatible gateway with credentials, model discovery, presets, documentation, and tests.

Possibly related PRs

  • Gitlawb/openclaude#2080 — Adds and configures the OrcaRouter gateway and modifies overlapping gateway compatibility tests.
  • Gitlawb/openclaude#2060 — Updates the web provider catalog, including the same provider metadata area.
  • Gitlawb/openclaude#2109 — Adds a comparable OpenAI-compatible provider with credentials, discovery, presets, environment configuration, and tests.

Suggested reviewers: jatmn, kevincodex1, 0xfandom

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, scoped to OrcaRouter, and accurately describes the gateway descriptor changes.
Description check ✅ Passed The description includes the required Summary, Impact, Testing, and Notes sections with detailed change, test, and limitation information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed The diff adds auth, an external endpoint, routing, and background discovery; the PR description identifies these surfaces, credential isolation, scope, and reports no new blocker.
No Hidden Policy Change ✅ Passed The diff is a focused OrcaRouter addition; its default model, endpoint, discovery, usage setting, and dedicated-credential policy are explicit in the descriptor, tests, README, and manifest.
✨ 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.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found issues that need to be addressed before this is ready.

Findings

  • [P1] Persist /provider credentials under the dedicated OrcaRouter variable
    src/integrations/gateways/orcarouter.ts:13-14
    This marks the route as accepting only ORCAROUTER_API_KEY, but the generic profile flow stores the key entered in /provider only as OPENAI_API_KEY. Applying an OrcaRouter profile therefore leaves resolveRouteCredentialValue('orcarouter') empty, and both discovery and chat requests are unauthenticated; the startup-profile and relaunch paths have the same mismatch. Please add the dedicated-key profile/apply/persist/launch plumbing (as the other dedicated routes do), or do not declare this route dedicated-only.

  • [P1] Make the documented environment-only setup select OrcaRouter
    README.md:284
    resolveEnvOnlyProviderRouteId has no OrcaRouter branch, so in a clean environment with only ORCAROUTER_API_KEY set, the active route remains Anthropic. The advertised ORCAROUTER_API_KEY=... openclaude path—including the newly allowlisted provider env file—never selects this endpoint or its default model. Please wire safe env-only intent/default resolution for this key, or document the additional provider/base/model configuration that is actually required.

  • [P1] Scope the dedicated key to the canonical OrcaRouter endpoint
    src/integrations/gateways/orcarouter.ts:33
    Authenticated discovery accepts any caller/profile-supplied base URL while resolveRouteCredentialValue returns the ambient dedicated key without an OrcaRouter host boundary. A profile retained as route orcarouter but edited to https://evil.example/v1 consequently sends Authorization: Bearer <ORCAROUTER_API_KEY> to that host during /models discovery (and the inference path has the same credential-resolution contract). Please require the canonical OrcaRouter origin/path before using this dedicated credential, following the boundary used by ApiSmart.

  • [P1] Clear stale custom-auth state when selecting this fixed Bearer route
    src/integrations/gateways/orcarouter.ts:21-22
    supportsAuthHeaders: true combines with the generic provider-flag path to preserve OPENAI_AUTH_HEADER, OPENAI_AUTH_SCHEME, and OPENAI_AUTH_HEADER_VALUE from the previous provider. The request executor gives that custom value precedence: after switching with a valid Orca key, a reproduced request omitted Bearer auth and instead sent X-Old-Key: old-provider-secret to OrcaRouter. This both breaks authentication and discloses the prior provider's secret. Please model OrcaRouter's documented fixed Bearer contract and clear unsupported custom-auth state during the switch.

  • [P2] Filter discovery to chat-compatible models
    src/integrations/gateways/orcarouter.ts:33
    Generic OpenAI-compatible discovery keeps every /v1/models ID and discards OrcaRouter's supported_endpoint_types and output-modality fields. OrcaRouter's catalog also contains image, TTS, embedding, and video models that require other endpoints, so background discovery places entries such as openai/tts-1 and kling/* in the chat model picker; selecting one then sends it to Chat Completions and fails. Please add an Orca-specific mapModel filter for text-output/chat-capable entries, using the metadata documented by the Models API.

  • [P2] Override direct-provider limits with the routed model limits
    src/integrations/gateways/orcarouter.ts:45-54
    These entries inherit transport-specific shared descriptors: runtime resolution gives GPT-5.5 a 272,000-token context and Claude Sonnet 4.6 a 200,000-token context with only 8,192 output tokens. The routed APIs support much larger limits—GPT-5.5 is documented at 1.05M/128K and Sonnet 4.6 at 1M/64K—so OpenClaude compacts long sessions prematurely and hard-caps Sonnet output far below the gateway limit. Please add route-specific overrides (and preferably map discovery's context_length/max_completion_tokens) instead of reusing those direct-transport ceilings.

  • [P2] Correct the unconditional default-deny security claim
    PR description — “gateway-level, zero-trust security” paragraph
    The description says merely using this endpoint screens every prompt/response and governs every tool call on a default-deny basis, but OrcaRouter's own documentation says a key with no attached or workspace-default policy is allowed silently, a policy defaults to audit, and only the optional tight posture is default-deny. The code here does not configure any posture or policy, and locally executed tools are outside the gateway's view. Please state the required workspace/key policy setup and the enforcement boundary rather than implying these protections are automatic.

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