Skip to content

feat(providers): add OrcaRouter as built-in cloud provider#2187

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
xilema2:feat/orcarouter-provider
May 20, 2026
Merged

feat(providers): add OrcaRouter as built-in cloud provider#2187
senamakel merged 3 commits into
tinyhumansai:mainfrom
xilema2:feat/orcarouter-provider

Conversation

@xilema2
Copy link
Copy Markdown
Contributor

@xilema2 xilema2 commented May 19, 2026

Summary

  • Add OrcaRouter as a built-in slug alongside openai / anthropic / openrouter / custom in the AI Settings panel.
  • Wire https://api.orcarouter.ai/v1 + Bearer auth as the default endpoint / auth style, mirroring how OpenRouter is handled today.
  • Migrate legacy type = "orcarouter" config entries to the new slug-keyed shape (label, endpoint, auth_style) via the existing migrate_legacy_fields path.
  • Whitelist provider.orcarouter in the proxy service-key list so users can route OrcaRouter calls through a configured proxy.
  • Unit tests: factory builds orcarouter:<model> against an OrcaRouter cloud_providers entry; legacy type = orcarouter entry produces the correct slug / label / endpoint / auth_style.

Problem

OpenHuman already supports OpenAI-compatible multi-provider routers (e.g. OpenRouter) as first-class chips in the AI Settings panel, but OrcaRouter is not in the built-in list. Today a user has to add it as a custom provider and re-enter its endpoint each time, which loses the consistency the panel offers for other well-known meta-routers.

OrcaRouter is OpenAI-API-compatible (Authorization: Bearer … at https://api.orcarouter.ai/v1), so the work needed is purely metadata + UI surfacing — no new transport code, no new auth style.

Solution

  • src/openhuman/config/schema/cloud_providers.rs
    • Add "orcarouter" to legacy_label_for (→ "OrcaRouter") and legacy_default_endpoint (→ https://api.orcarouter.ai/v1).
    • Add Orcarouter to the legacy CloudProviderType enum and the three small match arms (default_endpoint, label, as_str). auth_style() falls through the existing catch-all to AuthStyle::Bearer.
  • src/openhuman/config/schema/proxy.rs — add "provider.orcarouter" to SUPPORTED_PROXY_SERVICE_KEYS.
  • src/openhuman/config/schema/types.rs — extend the provider-grammar doc-comment.
  • src/openhuman/inference/provider/factory_test.rs — add orcarouter_slug_model (builds orcarouter:orcarouter/auto against a config entry) and orcarouter_legacy_type_seeds_defaults (migration produces correct slug / label / endpoint / auth).
  • app/src/components/settings/panels/AIPanel.tsx
    • Add orcarouter to BUILTIN_PROVIDER_META (display label + chip tone).
    • Include orcarouter in the three slug arrays used for chip rendering, the default-slug picker, and the AddProvider/EditProvider <select>.
    • Add an API-key placeholder branch for orcarouter.
    • Extend defaultEndpointFor('orcarouter') → https://api.orcarouter.ai/v1.
  • app/src/utils/tauriCommands/config.ts — extend the legacy CloudProviderType union with 'orcarouter'.

No changes to provider transport, no new RPC, no protocol changes.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) — two new Rust tests in factory_test.rs (happy-path slug routing + legacy-config migration).
  • Diff coverage ≥ 80% — every new/changed line in Rust is covered by the two new factory_test cases or by the existing AIPanel.test.tsx suite. Will be confirmed by CI.
  • Coverage matrix updated — N/A: behaviour-only addition (one extra built-in slug option in an existing surface).
  • All affected feature IDs from the matrix are listed in the PR description under ## RelatedN/A: see above.
  • No new external network dependencies introduced — endpoint is exercised only through the existing OpenAI-compatible code path; tests don't hit the network.
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: additive built-in option in AI Settings, no release-cut surface change.
  • Linked issue closed via Closes #NNN in the ## Related section — N/A: no linked issue.

Impact

  • Runtime: desktop only (the only shipped target). Frontend gains one extra chip + dropdown option; Rust core gains one extra match arm. No migrations, no persistence changes — cloud_providers is already user-extensible.
  • Compatibility: existing user configs with type = "openrouter" or any other slug are untouched. Users who had previously added OrcaRouter manually as custom are unaffected (custom entries keep working).
  • Security: API keys still live in auth-profiles.json via AuthService, keyed by provider:orcarouter, identical to the other slug-keyed entries. No new secret-handling code path.

Related

  • Closes: N/A
  • Follow-up PR(s)/TODOs: none

AI Authored PR Metadata

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: feat/orcarouter-provider
  • Commit SHA: 75153c38 (tip; 68b01f6f main change + 75153c38 prettier wrap)

Validation Run

  • pnpm typecheck — pass (tsc --noEmit on app/)
  • pnpm lint — pass (0 errors on changed files; 46 pre-existing warnings in untouched files)
  • prettier --check on changed files — pass
  • Vitest AIPanel.test.tsx15 / 15 passed
  • cargo check --lib — pass (Rust 1.93.0 MSVC)
  • cargo test factory32 / 32 passed, including the two new orcarouter_* cases
  • cargo test cloud_providers — 2 / 2 passed
  • cargo fmt --check on changed files — pass

Validation Blocked

  • command: git push (pre-push husky hook)
  • error: Pre-push hook runs prettier --write . (would reformat ~858 unrelated files repo-wide that are already prettier-dirty on main) and pnpm rust:format (cargo not on the hook's PATH in this shell). Both failures are unrelated to the changes in this PR — the touched files were individually validated with prettier --check and cargo fmt --check and are clean.
  • impact: Pushed with --no-verify per CLAUDE.md git-workflow guidance for unrelated hook breakage. Per-file format checks above already confirm the diff itself is clean.

Behavior Changes

  • Intended behavior change: users can pick OrcaRouter from the built-in provider list in AI Settings instead of having to enter a custom endpoint.
  • User-visible effect: new "OrcaRouter" chip + dropdown option in the AI Settings panel; selecting it pre-fills https://api.orcarouter.ai/v1 and Bearer auth.

Parity Contract

  • Legacy behavior preserved: existing slugs (openai, anthropic, openrouter, custom) unchanged. The catch-all _ => "Custom" / _ => AuthStyle::Bearer branches remain intact, so any unknown legacy slug still falls back the same way.
  • Guard / fallback / dispatch parity checks: factory routing (<slug>:<model> grammar) already dispatches OrcaRouter via the generic Bearer OpenAI-compatible provider — no new dispatch branch added.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this one
  • Resolution: N/A

Disclosure: I'm an engineer on the OrcaRouter team. OrcaRouter (https://www.orcarouter.ai) is an OpenAI-API-compatible multi-provider LLM router; this PR only adds it to the built-in slug list and does not embed any router-side source.

Summary by CodeRabbit

  • New Features
    • Added OrcaRouter as a built-in cloud provider: appears in provider lists, editor dropdowns, connection chips, and uses an OrcaRouter-style API key placeholder.
    • Default endpoint for OrcaRouter set to https://api.orcarouter.ai/v1.
  • Documentation
    • Config docs updated to include orcarouter: routing grammar.
  • Tests
    • Added unit tests covering OrcaRouter provider string handling and legacy migration.

Review Change Stack

xilema2 added 2 commits May 19, 2026 15:06
- Add `orcarouter` to legacy_label_for / legacy_default_endpoint
  (https://api.orcarouter.ai/v1) so legacy `type=orcarouter` configs
  migrate cleanly, mirroring the existing OpenRouter handling.
- Add `Orcarouter` variant to the legacy CloudProviderType enum
  (default endpoint, label, wire string; auth_style falls through to
  Bearer via the existing catch-all).
- Whitelist `provider.orcarouter` in the proxy service-key list.
- Extend the AI Settings panel: BUILTIN_PROVIDER_META entry, slug
  options in chip rendering + AddProvider/EditProvider selectors,
  API-key placeholder, and defaultEndpointFor.
- Extend the TS `CloudProviderType` legacy type alias.
- Tests: factory builds `orcarouter:<model>` against an `orcarouter`
  cloud_providers entry; legacy `type=orcarouter` entry seeds the
  correct slug/label/endpoint/auth_style via migrate_legacy_fields.

OrcaRouter is an OpenAI-compatible multi-provider router (Bearer auth,
https://api.orcarouter.ai/v1), so it slots straight into the existing
`<slug>:<model>` factory grammar — no new transport code required.

I am an engineer on the OrcaRouter team.
@xilema2 xilema2 requested a review from a team May 19, 2026 08:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9a596f74-ab8b-464f-9397-40267a8bd8c7

📥 Commits

Reviewing files that changed from the base of the PR and between 75153c3 and 2cb07bd.

📒 Files selected for processing (1)
  • app/src/components/settings/panels/AIPanel.tsx

📝 Walkthrough

Walkthrough

Adds OrcaRouter as a built-in cloud provider: backend enum + metadata and legacy mappings, config docs and proxy key, frontend type and AIPanel UI updates (chips, placeholders, defaults, endpoint), and unit tests for parsing and legacy migration.

Changes

OrcaRouter Provider Integration

Layer / File(s) Summary
Backend provider schema: enum variant and metadata methods
src/openhuman/config/schema/cloud_providers.rs
CloudProviderType enum gains the Orcarouter variant. Methods default_endpoint(), label(), and as_str() are updated to handle the new variant. Legacy mapping helpers (legacy_label_for, legacy_default_endpoint) map orcarouter to "OrcaRouter" and https://api.orcarouter.ai/v1.
Backend configuration schema and proxy service support
src/openhuman/config/schema/types.rs, src/openhuman/config/schema/proxy.rs
Configuration docs add orcarouter:<model> provider-string grammar; SUPPORTED_PROXY_SERVICE_KEYS now includes provider.orcarouter.
Frontend TypeScript type definition
app/src/utils/tauriCommands/config.ts
CloudProviderType union reformatted to multiline and includes the orcarouter literal.
Frontend UI integration in AIPanel
app/src/components/settings/panels/AIPanel.tsx
Adds orcarouter to built-in provider metadata (label/tone), API-key placeholder (sk-orca-...), provider chips toggle list (connect/disconnect + routing scrub), CloudProviderEditor default slug candidates, provider dropdown options, and defaultEndpointFor mapping to https://api.orcarouter.ai/v1.
Unit tests for orcarouter provider handling
src/openhuman/inference/provider/factory_test.rs
New tests assert orcarouter:<model> routes to expected model ids and that legacy legacy_type = "orcarouter" migrates slug, label, endpoint, and auth_style correctly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A rabbit hops through orca-routed seas,
Slugs and endpoints carried on the breeze,
Configs whisper, schemas hum in tune,
UI chips glow beneath the moon,
Tests nibble paths to keep them true. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(providers): add OrcaRouter as built-in cloud provider' directly and clearly summarizes the main change: adding OrcaRouter as a built-in cloud provider across both backend config and frontend UI.
Docstring Coverage ✅ Passed Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

@coderabbitai coderabbitai Bot added the feature Net-new user-facing capability or product behavior. label May 19, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 19, 2026
Copy link
Copy Markdown
Contributor

@graycyrus graycyrus left a comment

Choose a reason for hiding this comment

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

Clean, well-structured addition — mirrors the existing OpenRouter pattern exactly. Nice disclosure about team affiliation too.

One minor nit inline, otherwise LGTM.

Comment thread app/src/components/settings/panels/AIPanel.tsx Outdated
Addresses graycyrus's review feedback — actual OrcaRouter keys use
the sk-orca- prefix, not sk-or-, so the placeholder now matches the
real format and is clearly distinct from OpenRouter's sk-or-.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@senamakel senamakel merged commit ee34387 into tinyhumansai:main May 20, 2026
29 checks passed
mtkik pushed a commit to mtkik/openhuman-meet that referenced this pull request May 21, 2026
…sai#2187)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CodeGhost21 pushed a commit to CodeGhost21/openhuman that referenced this pull request May 22, 2026
…sai#2187)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
…sai#2187)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Net-new user-facing capability or product behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants