feat: add OrcaRouter as a first-class LLM provider - #353
Open
dulcestentaciones2920-debug wants to merge 1 commit into
Conversation
Route orcarouter/* model names to the OrcaRouter OpenAI-compatible endpoint using ORCA_API_KEY/ORCA_URL, mirroring the existing GLM and ARK named-provider branches in OpenAICompatibleClientSync. The router is configurable through the standard AIConfig env surface and documented in both .env.example files. 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.
Summary
Knowhere describes itself as "the memory layer between complex, dirty documents and AI agents." The agents consuming that memory make a steady stream of LLM/VLM calls through Knowhere's parsing, page-memory, and map-nav retrieval pipelines. Today those calls are routed to a handful of named providers — DeepSeek, DashScope/Qwen, Zhipu GLM, Volcengine ARK — by model-name prefix in
OpenAICompatibleClientSync, with credentials supplied throughAIConfigenv vars. There is no way to run that traffic through a gateway without treating it as an anonymous custom base URL.This PR adds OrcaRouter as a first-class named provider on exactly that same surface. A self-hoster sets
ORCA_API_KEY, pointsNORMOL_MODEL(or any parse/retrieval model) at anorcarouter/*model, and every text and vision call routes through the OrcaRouter gateway — no application code changes, no base-URL plumbing.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 Knowhere 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.
What changed
packages/shared-python/shared/core/config/ai.py— newORCA_API_KEYandORCA_URL(defaulthttps://api.orcarouter.ai/v1) onAIConfig, mirroringDS_KEY/DS_URL.packages/shared-python/shared/services/ai/openai_compatible_client_sync.py—orcarouter/*model names resolve to the OrcaRouter base URL andORCA_API_KEY, the same way the existingglm/doubao/ep-branches route to GLM and ARK. This covers the parsing summarizer, page-memory VLM calls, and the map-nav retrieval backend, all of which go throughget_openai_client.apps/api/.env.example/apps/worker/.env.example— documentORCA_API_KEYandORCA_URL.packages/shared-python/shared/tests/test_openai_client_routing.py— unit tests assertingorcarouter/*resolves to OrcaRouter credentials and that non-OrcaRouter models keep existing DeepSeek routing.Verification
ruff check apps packages— all checks passed.pyright --project pyproject.tomlon the full CI path — 0 errors.pytest packages/shared-python/shared/tests/test_openai_client_routing.py(+ relatedtest_nav_llm_backend.py,test_llm_config.py) — passed.get_openai_client(model="orcarouter/fusion")) againsthttps://api.orcarouter.ai/v1with a real key returnedcontent='OK'with token usage — HTTP 200.Deployment Notes
ORCA_API_KEY,ORCA_URL(defaults tohttps://api.orcarouter.ai/v1). No existing variable is changed; fully backwards compatible. No migrations, queue, or storage changes.Checklist
To try it: set
ORCA_API_KEYand e.g.NORMOL_MODEL=orcarouter/fusioninapps/api/.env/apps/worker/.env.I'm an engineer on the OrcaRouter team. Feedback welcome — Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter