Skip to content

feat(agent): add OrcaRouter as a named LLM provider preset - #130

Open
putraperdana1207-pixel wants to merge 1 commit into
0xsline:mainfrom
putraperdana1207-pixel:feat/orcarouter-provider
Open

feat(agent): add OrcaRouter as a named LLM provider preset#130
putraperdana1207-pixel wants to merge 1 commit into
0xsline:mainfrom
putraperdana1207-pixel:feat/orcarouter-provider

Conversation

@putraperdana1207-pixel

Copy link
Copy Markdown

Summary

OpenChatCut's built-in agent is powered by the Vercel AI SDK, and its Agent LLM settings expose each model vendor as a named provider preset in shared/llm-providers.ts. Every preset is picked up automatically by the settings UI, the server-side keystore, model selection, and the /llm proxy — so adding a new OpenAI-compatible gateway is a small, well-defined wiring change.

This PR adds OrcaRouter as a first-class named provider preset, mirroring the existing OpenRouter wiring exactly: same openai-compatible protocol, same /chat/completions proxy path, same Bearer-key handling, same settings-page auto-generation.

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 orcarouter as a first-class provider means OpenChatCut users can use that stack directly, without treating OrcaRouter as an anonymous custom base URL.

What changed

File Change
shared/llm-providers.ts New orcarouter preset: protocol: 'openai-compatible', baseUrl: 'https://api.orcarouter.ai/v1', defaultModel: 'orcarouter/auto' — directly beside the openrouter preset it mirrors
server/keystore.ts Whitelist LLM_ORCAROUTER_API_KEY, LLM_ORCAROUTER_BASE_URL, LLM_ORCAROUTER_MODEL (same three slots as every other provider)
src/components/settings/VisionModelPane.tsx OrcaRouter label in the vision-provider picker
src/components/settings/vendorIcons.tsx orcarouter vendor id + a monogram mark (no official SVG vendored yet, same treatment as xAI/BytePlus)
src/agent/ai-sdk.verify.ts Coverage for the new preset: normalizeLlmProvider, defaultModelForProvider, providerApiPath, and getLanguageModel provider id (orcarouter.chat)
README.md / README_ZH.md OrcaRouter added to the Agent row in the Architecture table

The runtime path needs no new code: createProviderFactory's default branch already constructs createOpenAICompatible({ name: provider }) for non-dedicated providers, so orcarouter resolves to the orcarouter.chat adapter exactly like openrouter.chat does, and server/plugins/llm-proxy.ts routes x-openchatcut-provider: orcarouter to the preset base URL with a Bearer key from the keystore.

How the provider is used

In Settings → Agent 模型 → Agent 大脑, OrcaRouter now appears as its own vendor page. Save an OrcaRouter API key, and the model picker offers orcarouter/auto (the adaptive default) or any vendor/model id the gateway exposes (e.g. anthropic/claude-opus-4.8, deepseek/deepseek-v4-pro).

Verification

  • npx tsc -b --force — passes
  • npm run lint — passes
  • Targeted verifies for the touched paths (src/agent/ai-sdk.verify.ts, shared/model-capabilities.verify.ts, server/keystore.verify.ts, server/llm-proxy.verify.ts, src/agent/settings/agent-settings.verify.ts, server/key-probes.verify.ts) — all pass
  • npm run build — passes
  • Live check: a real round-trip through the /llm proxy helpers to https://api.orcarouter.ai/v1/chat/completions with model: orcarouter/auto returned HTTP 200 with a valid completion

The full npm test suite runs locally except the Remotion headless-browser segment, which needs a system libnspr4/libnss3 that this sandbox cannot install; the remaining suite (including every provider-path verify) is green, and CI's ubuntu runner installs those libraries.

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.

Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter

I'm an engineer on the OrcaRouter team.

Adds orcarouter to the LLM_PROVIDER_PRESETS registry as an
openai-compatible provider mirroring the existing OpenRouter preset:
same protocol, proxy routing, and settings auto-generation. The preset
wires the provider through the settings UI, the server keystore, and the
model-selection catalog; users save their OrcaRouter key and pick
orcarouter/auto (or any vendor/model id) like any other provider.

- shared/llm-providers.ts: register the orcarouter preset
  (https://api.orcarouter.ai/v1, default orcarouter/auto)
- server/keystore.ts: whitelist LLM_ORCAROUTER_{API_KEY,BASE_URL,MODEL}
- src/components/settings: provider label + vendor icon monogram
- src/agent/ai-sdk.verify.ts: coverage for normalize/default/path/CLM
- README(.md/_ZH.md): list OrcaRouter in the Agent provider row

Verified: npx tsc -b, npm run lint, targeted verifies, npm run build,
and a live 200 round-trip through the /llm proxy to api.orcarouter.ai.
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