feat: add OrcaRouter as a first-class provider - #260
Open
nissrin2020ali-ux wants to merge 1 commit into
Open
Conversation
Mirror the existing cloudflare-ai-gateway named-provider slot so both API families route through OrcaRouter's single OpenAI/Anthropic- compatible /v1 namespace. PXPIPE_PROVIDER=orcarouter resolves both upstreams to https://api.orcarouter.ai (overridable with PXPIPE_GATEWAY_BASE_URL), keeping /v1 path segments. Co-Authored-By: Claude <noreply@anthropic.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.
What breaks without this
pxpipe's token-saving proxy already ships a named-provider slot (
PXPIPE_PROVIDER=cloudflare-ai-gateway) for routing both API families through one OpenAI-compatible gateway, but there is no first-class entry for OrcaRouter. 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. Users who point pxpipe at OrcaRouter today have to treat it as an anonymous custom base URL; this PR makes it a named provider so the whole stack is reachable without hand-rolledOPENAI_UPSTREAM/ANTHROPIC_UPSTREAMoverrides.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.
The change
PXPIPE_PROVIDER=orcarouterroutes both API families to OrcaRouter's singlehttps://api.orcarouter.ainamespace, fully parallel to howcloudflare-ai-gatewayis wired today. OrcaRouter speaks Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions under one/v1root (unlike Cloudflare's split/anthropic+/openaigateway shape), so the only real difference from the Cloudflare branch is that/v1is kept rather than stripped.File-by-file correspondence:
src/core/proxy.tsProxyConfig.providerunion gains'orcarouter';resolveUpstreams()gains the OrcaRouter branch (both families → same base,stripOpenAIV1: false);passthroughUpstreamfalls back to the newDEFAULT_ORCAROUTER_UPSTREAM(https://api.orcarouter.ai) when noPXPIPE_GATEWAY_BASE_URLis set.src/node.tsRuntimeConfig.providerandparseProvider()accept'orcarouter'; help text documents it, notingPXPIPE_GATEWAY_BASE_URLis now optional (OrcaRouter has a default base).tests/gateway.test.tsresolveUpstreams+ end-to-end routing tests fororcarouter(default base, base override,/v1kept on Anthropic Messages / OpenAI Responses / Chat Completions).docs/CLAUDE_CODE_PROVIDER_ROUTING.mdVerify
mainpnpm testandpnpm typecheckpass (the one local failure —restart.test.ts, "reads the real process table" — is an environment artifact: this container has nops, solistProcesses()returns[]; it passes on CI's ubuntu-24.04)I'm an engineer on the OrcaRouter team. Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter