Skip to content

feat: add OrcaRouter as a named LLM provider adapter - #2243

Open
XiaoHuo888-hue wants to merge 2 commits into
Zipstack:mainfrom
XiaoHuo888-hue:add-orcarouter-llm-adapter
Open

feat: add OrcaRouter as a named LLM provider adapter#2243
XiaoHuo888-hue wants to merge 2 commits into
Zipstack:mainfrom
XiaoHuo888-hue:add-orcarouter-llm-adapter

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Adds OrcaRouter as a named LLM provider. OrcaRouter is an OpenAI-compatible model routing gateway that exposes 150+ models from OpenAI, Anthropic, Google, DeepSeek, Qwen, MiniMax, xAI and others behind a single endpoint and API key, with gateway-level security controls for AI agents.

I'm an engineer on the OrcaRouter team.

What this changes

  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/orcarouter.py: the OrcaRouterLLMAdapter adapter class (provider id orcarouter, base URL https://api.orcarouter.ai/v1)
  • unstract/sdk1/src/unstract/sdk1/adapters/base1.py: OrcaRouterLLMParameters, reusing the shared branded OpenAI-compatible validation helper so the endpoint is preconfigured but overridable
  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/static/orcarouter.json: the adapter form schema (model + API key, reasoning toggle)
  • unstract/sdk1/src/unstract/sdk1/adapters/llm1/__init__.py: exports the new adapter
  • frontend/public/icons/adapter-icons/OrcaRouter.png: adapter logo
  • unstract/sdk1/tests/test_branded_openai_adapters.py: unit tests for registration, model prefixing, api_base default/override, and schema

Why a separate provider rather than the OpenAI-compatible escape hatch

This mirrors how OpenRouter and NVIDIA Build are wired in this repo — branded adapters with the endpoint preconfigured, so the model picker, docs and config reference stay consistent. OrcaRouter routes through the same custom_openai/ path LiteLLM already uses for NVIDIA Build, with the OrcaRouter base URL pinned as the default.

How to use it

  1. Get an API key at https://www.orcarouter.ai/console (keys start with sk-orca-).
  2. Add an OrcaRouter adapter in the platform UI and pick a model, e.g. deepseek/deepseek-v4-flash or openai/gpt-5.5.
  3. That's it — the endpoint is preconfigured.

Verification

  • Unit tests: pytest unstract/sdk1/tests/test_branded_openai_adapters.py59 passed (including the 5 new OrcaRouter cases; 9 deselected require the full llama-index stack not present in the local env)
  • Lint: ruff check on the changed files → no new findings (2 pre-existing import-sort notes on pristine main)
  • Live API: routed a completion through the adapter parameters (custom_openai/deepseek/deepseek-v4-flash + https://api.orcarouter.ai/v1) with a real sk-orca- key → HTTP 200, valid completion content returned

Adds OrcaRouter as a branded OpenAI-compatible LLM adapter, mirroring
the existing NVIDIA Build adapter: users pick a model and supply an
OrcaRouter API key, and the endpoint (https://api.orcarouter.ai/v1)
is preconfigured and overridable.

- base1.py: OrcaRouterLLMParameters reusing the shared branded
  OpenAI-compatible validation helper
- llm1/orcarouter.py: OrcaRouterLLMAdapter + schema + icon
- llm1/__init__.py: export the new adapter
- tests: registration, model prefixing, api_base default/override,
  and schema checks for the OrcaRouter adapter

Co-Authored-By: Claude <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarqubecloud

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds OrcaRouter as a named OpenAI-compatible LLM provider with a preconfigured endpoint.

  • Registers and exports the OrcaRouter adapter with its provider metadata and icon.
  • Adds shared parameter validation for model prefixing, endpoint defaults and overrides, and reasoning options.
  • Adds the adapter configuration schema and coverage for registration, validation, and schema defaults.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or non-blocking defects identified.

The adapter is discoverable through the existing registry, its schema and icon resolve at the expected paths, and its request validation follows the established idempotent branded OpenAI-compatible flow.

Important Files Changed

Filename Overview
unstract/sdk1/src/unstract/sdk1/adapters/base1.py Adds OrcaRouter parameters through the existing branded OpenAI-compatible validation path, preserving endpoint overrides and repeated-validation behavior.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/init.py Exports the new adapter while remaining compatible with the category's import-time registration mechanism.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/orcarouter.py Defines unique OrcaRouter metadata, provider identity, adapter type, and icon path following established LLM adapter conventions.
unstract/sdk1/src/unstract/sdk1/adapters/llm1/static/orcarouter.json Adds a configuration schema consistent with the existing branded OpenAI-compatible adapter schema pattern.
unstract/sdk1/tests/test_branded_openai_adapters.py Extends coverage for registration, model prefixing, endpoint fallback and override behavior, and schema defaults.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Adapter Settings
    participant SDK as OrcaRouter Adapter
    participant LiteLLM
    participant OrcaRouter
    User->>UI: Configure model and API key
    UI->>SDK: Submit adapter metadata
    SDK->>SDK: Apply default API base and custom_openai prefix
    SDK->>LiteLLM: Send validated completion parameters
    LiteLLM->>OrcaRouter: OpenAI-compatible request
    OrcaRouter-->>LiteLLM: Completion response
    LiteLLM-->>User: Return completion
Loading

Reviews (1): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile

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