Skip to content

feat: add OrcaRouter as a named provider type - #195

Open
XiaoHuo888-hue wants to merge 1 commit into
u14app:mainfrom
XiaoHuo888-hue:add-orcarouter-provider
Open

feat: add OrcaRouter as a named provider type#195
XiaoHuo888-hue wants to merge 1 commit into
u14app:mainfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Add OrcaRouter as a first-class, named provider type alongside Google, Anthropic, OpenAI, and OpenAI-compatible endpoints.

OrcaRouter is an OpenAI-compatible AI gateway that unifies frontier model APIs behind a single endpoint. 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.

What changed:

  • Provider type union (src/lib/providers/types.ts, providerTypes.ts): new OrcaRouter type constant + guards (isOrcaRouterProviderType, extended isOpenAIProviderType).
  • URL policy defaults (src/lib/security/urlPolicy.ts): OrcaRouter defaults to https://api.orcarouter.ai/v1 with chat/completions and models endpoints.
  • Runtime schema (src/lib/api/schemas.ts): accepts OrcaRouter and normalizes like the other provider types.
  • Chat dispatch (src/lib/api/chat-handler.ts): OrcaRouter routes through the OpenAI-compatible Chat Completions streaming path (isOpenAIProviderType), sharing the guarded OpenAI client factory and image/voice/model routes already used by OpenAI-compatible providers.
  • Settings UI (src/components/settings/ProviderSettings.tsx): OrcaRouter appears in the API type dropdown with the https://api.orcarouter.ai… base URL placeholder and a "Get Key" link to https://www.orcarouter.ai.
  • i18n: provider label + base URL placeholder added to en/zh/ja.
  • Docs: DEFAULT_PROVIDER_TYPE now documents OrcaRouter in docs/environment-variables.md and the feature list in README.md.
  • Tests: normalization, URL policy defaults, and runtime schema coverage for OrcaRouter.

Test Plan

  • pnpm check:imports
  • pnpm format:check
  • pnpm lint
  • pnpm typecheck
  • pnpm test — 1441 passed / 250 files (14 pre-existing jsdom worker-startup errors also reproduced on clean main with the local Node 20; CI runs Node 22)
  • L3 live check: an OpenAI-compatible client at https://api.orcarouter.ai/v1 with model orcarouter/auto returned HTTP 200 (ORCA-LIVE-OK)

Notes:

  • I updated docs when behavior changed.
  • I considered local-first data handling and hosted deployment safety — OrcaRouter uses the same guarded outbound URL policy, BYOK secret handling, and provider dispatch as existing types.
  • I added tests for this user-facing/provider change.

Disclosure: I'm an engineer on the OrcaRouter team.

Add OrcaRouter as a first-class provider type alongside OpenAI,
Anthropic, Google, and OpenAI-compatible endpoints.

- Extend the ProviderType union and provider type guards with
  ORCAROUTER_PROVIDER_TYPE so it is recognized across settings,
  url policy defaults, the BYOK runtime schema, and the model
  fetch route.
- Route OrcaRouter through the OpenAI-compatible Chat Completions
  dispatch (shared with OpenAI-compatible providers), defaulting
  base_url to https://api.orcarouter.ai/v1 with the /v1 models and
  chat/completions endpoints.
- Surface OrcaRouter in the provider settings UI, the base URL
  placeholder and a Get Key link to https://www.orcarouter.ai.
- Localize the new provider label across en/zh/ja and document the
  DEFAULT_PROVIDER_TYPE value in environment-variables.md.
- Add focused unit tests for normalization, url policy defaults,
  and the runtime schema.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>
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.

1 participant