Skip to content

feat: route orcarouter/ models through the OrcaRouter gateway - #395

Open
XiaoHuo888-hue wants to merge 1 commit into
VectifyAI:mainfrom
XiaoHuo888-hue:feat/orcarouter-provider
Open

feat: route orcarouter/ models through the OrcaRouter gateway#395
XiaoHuo888-hue wants to merge 1 commit into
VectifyAI:mainfrom
XiaoHuo888-hue:feat/orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Adds OrcaRouter as a model 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. It also provides gateway-level security controls for AI agents.

I'm an engineer on the OrcaRouter team.

Concretely, orcarouter/... models now route through the gateway in local mode:

  • pageindex/utils.pyorcarouter/ models use the OpenAI SDK against https://api.orcarouter.ai/v1 with ORCAROUTER_API_KEY, mirroring how the existing openai/ prefix is handled. The routing prefix is stripped before the request, except for OrcaRouter's own orcarouter/auto alias. Both sync and async completion paths are covered, and a missing ORCAROUTER_API_KEY fails immediately instead of being retried.
  • run_pageindex.py, pageindex/tree_optimize.py — the CLI key gates now require ORCAROUTER_API_KEY for orcarouter/ models (previously these only checked OPENAI_API_KEY).
  • pageindex/client.pyretrieve_model normalization keeps orcarouter/... as passthrough (no litellm/ wrapping).
  • README.md, pageindex/config.yaml — documented the provider with usage examples.
  • tests/test_client.py — tests for the routing helpers, model-id resolution, missing-key failure, and the completion path.

Testing

  • python -m pytest -q76 passed, 1 failed. The failure (test_list_documents_skips_unsafe_directory_names) is a pre-existing Windows-only path test (it creates a directory named bad/name, which os.mkdir cannot create on Windows) — it also fails on clean main.
  • Live against the real endpoint with a valid key: llm_completion("orcarouter/deepseek/deepseek-v4-pro", ...) and llm_acompletion(...) both return the expected reply; orcarouter/orcarouter/auto also works; an invalid key is rejected with a 401 AuthenticationError.
  • litellm.token_counter (used by the standard indexing path) handles orcarouter/... model strings without error.

Checklist

  • Tests pass (one pre-existing Windows-only failure, present on clean main)
  • Docs updated

Adds OrcaRouter as a named OpenAI-compatible provider to the local-mode
LLM routing layer. 'orcarouter/...' models (e.g.
'orcarouter/deepseek/deepseek-v4-pro') now use the OpenAI SDK against
https://api.orcarouter.ai/v1 with ORCAROUTER_API_KEY, mirroring how the
'openai/' prefix is handled; the routing prefix is stripped before the
request, except for OrcaRouter's own 'orcarouter/auto' alias. Updates
the CLI key gates (run_pageindex.py, tree_optimize.py) to require
ORCAROUTER_API_KEY for orcarouter models, keeps retrieve_model
normalization passthrough in sync, and documents the provider in
README.md and config.yaml.

Verified: pytest suite (76 passed; the one failure is a pre-existing
Windows-only path test), sync + async live calls through
llm_completion/llm_acompletion against the real endpoint (deepseek
model and orcarouter/auto), and 401 rejection for an invalid key.
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