feat(orcarouter): add OrcaRouter as a first-class OpenAI-compatible provider - #259
feat(orcarouter): add OrcaRouter as a first-class OpenAI-compatible provider#259nissrin2020ali-ux wants to merge 1 commit into
Conversation
…rovider - src/orcarouter.js: new zero-dep forwarder for orcarouter/* models — posts /v1/chat/completions verbatim to https://api.orcarouter.ai/v1 with the operator's ORCAROUTER_API_KEY and relays the OpenAI-compatible JSON/SSE response back (test seam mirrors devin-connect-catalog.js) - src/handlers/chat.js: short-circuit orcarouter/* models after access control and before the Windsurf backends; maps transport failures to a clean 502 - src/models.js: register orcarouter/free, fusion, fusion-flash, fusion-mini, auto with provider/backend 'orcarouter'; cloud-catalog filter never hides them (they do not consume Windsurf account-pool quota) - src/config.js + .env.example: ORCAROUTER_API_KEY + base URL - src/handlers/cascade-metadata-egress.js: OrcaRouter display name - README.md / README.en.md: third-party provider section + env row - test/orcarouter.test.js: unit + handler routing tests (mock transport) - test/cloud-catalog-filter.test.js: gate orcarouter models out of the Cascade-catalog view like special-agent models
|
I am not merging this. This repo turns Windsurf / Devin into OpenAI / Anthropic / Gemini. It is not a generic OpenAI-compatible multiplexer. Astraflow (#184) already taught that: catalog rows with no working transport, later all I read What does not:
Do not rebase. Do not add messages / responses / Gemini on this branch expecting a merge. Anyone who wants OrcaRouter can point the client at Closing as not planned. |
What & why
WindsurfAPI turns Windsurf/Devin's models into OpenAI/Anthropic/Gemini-compatible API endpoints, and it already accepts third-party OpenAI-compatible providers (Astraflow landed via #184 as a catalog + config entry). This PR adds OrcaRouter the same way — but with a working forwarder, not just catalog entries.
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 this project's 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.Changes
src/orcarouter.js(new): zero-dependency forwarder. Posts/v1/chat/completionsverbatim tohttps://api.orcarouter.ai/v1withORCAROUTER_API_KEYand relays the OpenAI-compatible JSON or SSE response back. Mirrors the__setCatalogRequestImpltransport seam fromdevin-connect-catalog.js.src/handlers/chat.js: short-circuitsorcarouter/*models after access control and before the Windsurf backends (no account-pool or LS contact); transport failures map to a clean502 upstream_error.src/models.js: registersorcarouter/free,fusion,fusion-flash,fusion-mini,autowithprovider/backend: 'orcarouter'; the cloud-catalog filter never hides them (they consume the operator's gateway key, not Windsurf quota). Any raworcarouter/<id>forwards too, so the gateway's fullGET /v1/modelscatalog is reachable without a static entry.src/config.js/.env.example:ORCAROUTER_API_KEY+ base URL;src/handlers/cascade-metadata-egress.js: OrcaRouter display name.Testing
test/orcarouter.test.js(new): 10 tests — transport mock covers request construction (auth header, path, body), success/error/SSE relay, the 503 when no key is set, dynamicorcarouter/<id>routing, and 502 on transport failure. All green.test/cloud-catalog-filter.test.js: gatesorcarouterout of the Cascade-catalog view likespecial_agentmodels.npm test: 4314 tests, 4299 pass, 15 pre-existing env-sensitive failures (mutate-verify-harness 12, restart 2, update-script-release-target 1) that fail identically onmasterwithout this change.orcarouter/fusion-mini→ 200 with a real completion; streaming → 200 with SSE frames relayed and[DONE]; confirmed through the fullhandleChatCompletionspath.Checklist
Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter
I'm an engineer on the OrcaRouter team.