Skip to content

feat: add OrcaRouter as a built-in AI model provider#3505

Open
jinhaosong-source wants to merge 1 commit into
teableio:developfrom
jinhaosong-source:add-orcarouter-provider
Open

feat: add OrcaRouter as a built-in AI model provider#3505
jinhaosong-source wants to merge 1 commit into
teableio:developfrom
jinhaosong-source:add-orcarouter-provider

Conversation

@jinhaosong-source

@jinhaosong-source jinhaosong-source commented Jul 6, 2026

Copy link
Copy Markdown

Why are these changes needed?

Disclosure: I'm an engineer on the OrcaRouter team.

OrcaRouter is an OpenAI-compatible meta-router: a single endpoint that fronts 150+ upstream
models and adds server-side routing strategies and an ordered per-request fallback list. On top
of routing it layers a security/governance product (request-level guardrails such as policy
enforcement, PII/secret redaction, and per-key access controls) and a declarative routing DSL.

Users can already connect OrcaRouter today via the generic OpenAI Compatible provider type.
This PR makes it a first-class provider so it shows up in the AI Settings provider list with
its own label, brand icon, and the correct base-URL / model placeholders — the same treatment
OpenRouter already gets — instead of asking users to know it's "OpenAI-compatible" and hand-type
the endpoint.

What changed

Mirrors the existing OpenRouter wiring, but backed by the built-in OpenAI-compatible SDK — so
there is no new dependency (same approach the qwen / zhipu / lingyiwanwu provider types
already use):

  • packages/openapi — add ORCAROUTER = 'orcarouter' to the LLMProviderType enum. Validation
    is z.enum(LLMProviderType), so no separate string list needs updating.
  • apps/nestjs-backend/src/features/ai/util.ts — map ORCAROUTER to
    createOpenAICompatibleWrapper (the same wrapper used by OPENAI_COMPATIBLE, which forces the
    Chat Completions API and fixes non-standard proxy stream responses), and add ORCAROUTER to the
    getAdaptedProviderOptions case that sets includeUsage: true.
  • apps/nextjs-app/.../ai-config/constant.ts — add the provider to LLM_PROVIDER_ICONS and to the
    LLM_PROVIDERS dropdown list (label OrcaRouter, base URL https://api.orcarouter.ai/v1).
  • packages/icons — add an OrcaRouter icon component and export it.
  • apps/nestjs-backend/.../ai.service.spec.ts — add a unit test mirroring the OpenRouter case
    (verifies the new provider type flows through getModelTags without spurious tag inference).

Verification

  • pnpm --filter @teable/openapi typecheck, pnpm --filter @teable/icons typecheck, and the
    nestjs-backend typecheck pass with the changes.
  • pnpm --filter @teable/backend test-unit ai.service.spec.ts passes (including the new OrcaRouter
    case).

Live-verified end-to-end against https://api.orcarouter.ai/v1 with a real key:

  • GET /models → 200, 172 models (orcarouter/auto, openai/gpt-5.2, etc.).
  • non-stream POST /chat/completions (openai/gpt-4o-mini) → 200, correct content + usage.
  • streaming POST /chat/completions (stream:true, stream_options.include_usage:true) → 200,
    content streamed across chunks with usage in the final chunk — the exact path
    createOpenAICompatibleWrapper + includeUsage:true handles.
  • OrcaRouter routing controls (models fallback list + route) accepted → 200.

Notes

  • No new npm dependency: OrcaRouter reuses the built-in OpenAI-compatible client rather than a
    dedicated SDK package (unlike OpenRouter's @openrouter/ai-sdk-provider).
  • The included icon is a simple placeholder-style mark; happy to swap in an official SVG if
    preferred.
  • AI assistance was used to scaffold the provider (modeled on the existing OpenRouter/Qwen wiring)
    and draft this description; I reviewed and tested the result.

@CLAassistant

CLAassistant commented Jul 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

OrcaRouter is an OpenAI-compatible meta-router. Register it as a first-class
LLMProviderType (ORCAROUTER), mirroring the OpenRouter wiring but backed by the
built-in OpenAI-compatible client (no new dependency, same as qwen/zhipu):
enum entry, backend provider map + includeUsage adapter, AI Settings dropdown
entry + brand icon, and a unit test mirroring the OpenRouter case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jinhaosong-source jinhaosong-source force-pushed the add-orcarouter-provider branch from 10aa77a to 4538d33 Compare July 6, 2026 11:06
@jinhaosong-source

Copy link
Copy Markdown
Author

👋 Gentle nudge — checks are passing and the PR is ready whenever you get a chance to review. Happy to address anything. Thanks for your time!

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.

2 participants