feat: add OrcaRouter as a named provider type - #195
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
src/lib/providers/types.ts,providerTypes.ts): newOrcaRoutertype constant + guards (isOrcaRouterProviderType, extendedisOpenAIProviderType).src/lib/security/urlPolicy.ts): OrcaRouter defaults tohttps://api.orcarouter.ai/v1withchat/completionsandmodelsendpoints.src/lib/api/schemas.ts): acceptsOrcaRouterand normalizes like the other provider types.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.src/components/settings/ProviderSettings.tsx): OrcaRouter appears in the API type dropdown with thehttps://api.orcarouter.ai…base URL placeholder and a "Get Key" link to https://www.orcarouter.ai.DEFAULT_PROVIDER_TYPEnow documentsOrcaRouterindocs/environment-variables.mdand the feature list inREADME.md.Test Plan
pnpm check:importspnpm format:checkpnpm lintpnpm typecheckpnpm test— 1441 passed / 250 files (14 pre-existing jsdom worker-startup errors also reproduced on cleanmainwith the local Node 20; CI runs Node 22)https://api.orcarouter.ai/v1with modelorcarouter/autoreturned HTTP 200 (ORCA-LIVE-OK)Notes:
Disclosure: I'm an engineer on the OrcaRouter team.