feat(providers): add OrcaRouter as a named provider - #65
Closed
nissrin2020ali-ux wants to merge 1 commit into
Closed
feat(providers): add OrcaRouter as a named provider#65nissrin2020ali-ux wants to merge 1 commit into
nissrin2020ali-ux wants to merge 1 commit into
Conversation
Add OrcaRouter (https://api.orcarouter.ai/v1) as a first-class provider in the Settings "Via API Key" group, mirroring the existing OpenRouter integration. Its auto-routing models (orcarouter/auto, orcarouter/free, orcarouter/fusion, ...) live in a small Cebian-side catalog because they are not part of pi-ai's generated model catalog. Wire the catalog through resolveModel, listUsableModelGroups, and the provider settings UI so users can pick an OrcaRouter model after pasting their API key, with Cebian attribution headers on every request. Closes maotoumao#64
|
👋 感谢你的贡献!不过这个 PR 暂时被系统自动关闭了。 本项目要求:每个 PR 必须关联一个经过维护者批准的 issue(带 怎样让这个 PR 被接受:
如果你觉得这是误判,欢迎在评论区告诉我们。 👋 Thanks for contributing! This PR was auto-closed for now. This project requires every PR to reference an issue that has been approved by the maintainer (carrying the How to get it accepted:
If you believe this was a mistake, feel free to comment. |
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
Cebian's promise is "bring your own API key from any model provider" and its feature table lists "OpenAI, Anthropic, Google, and any OpenAI-compatible endpoint via custom providers." That last bucket is where gateway services end up today — but a gateway isn't just an anonymous base URL, it's a provider with its own model namespace and its own routing behavior. OpenRouter already gets first-class treatment in the Settings → "Via API Key" list; this PR gives OrcaRouter the same treatment.
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 Cebian 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.What changed
lib/providers/registry.ts— addedorcaroutertoAPIKEY_PROVIDERS, so it shows up in Settings → Providers alongside OpenRouter.lib/providers/orcarouter.ts(new) — a small catalog of OrcaRouter's native auto-routing models (orcarouter/auto,orcarouter/free,orcarouter/fusion,orcarouter/fusion-flash,orcarouter/fusion-mini), pointing athttps://api.orcarouter.ai/v1with the same Cebian attribution headers the OpenRouter integration sends. Vendor-prefixed models (e.g.deepseek/deepseek-chat) are intentionally left out — Cebian already ships dedicated providers for those vendors, and OrcaRouter exposes hundreds of them with no per-model metadata to curate against.lib/providers/resolve-model.ts— resolvesorcarouterfrom that local catalog (it lives outside pi-ai's generated model catalog), mirroring the existingopenrouterspecial case.lib/providers/usable-models.ts— the model selector lists OrcaRouter models once an API key is stored.components/settings/provider/ProviderApiKeyItem.tsx/ProviderSummary.tsx/components/chat/ModelSelector.tsx— the API-key connectivity test, provider summary, and model picker all read from the OrcaRouter catalog.Why a small static catalog instead of a dynamic fetch
OrcaRouter's
/v1/modelsreturns 200+ entries with no cost/context metadata, and its unique value is theorcarouter/*routing models — those are what this catalog ships. Users can still add any specificvendor/modelas a custom OpenAI-compatible provider if they want a pinned upstream.Testing
pnpm run checkpasses locally (typecheck + i18n lint + 674 tests, including new unit tests for the catalog,resolveModel, andlistUsableModelGroups).resolveModel({ provider: 'orcarouter', modelId: 'orcarouter/auto' })→complete()from@earendil-works/pi-ai/compat(the same callProviderApiKeyItemuses for its connectivity check) returned an"ok"completion from OrcaRouter's live API withmaxTokens: 5. Skipped automatically when no API key is present.orcarouter/autopasses Cebian's connectivity heuristic (maxTokens: 5, expects "ok"), and that OrcaRouter acceptsmax_tokensand theHTTP-Referer/X-Titleattribution headers.Related Issues
Closes #64
Checklist
pnpm run checkpasses locallyI'm an engineer on the OrcaRouter team.
Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter