Verba icon indicating copy to clipboard operation
Verba copied to clipboard

Add OrcaRouter generator

Open xilema2 opened this issue 6 months ago • 2 comments

Summary

Adds OrcaRouter as a new Generator option in Verba.

OrcaRouter is an OpenAI-compatible meta-router that exposes 150+ upstream LLMs from OpenAI, Anthropic, Google, DeepSeek, xAI, Qwen, MiniMax and others through a single API key. The virtual orcarouter/auto model picks an upstream per-request based on a configurable routing policy (cheapest / balanced / quality / adaptive bandit).

Inspired by the existing AtlasCloudGenerator / NovitaGenerator implementations — same httpx async streaming loop, same InputConfig shape, same env-var fallback approach.

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

Changes

  • New file: goldenverba/components/generation/OrcaRouterGenerator.py
    • Streams chat/completions via httpx.AsyncClient
    • Reads API key from ORCAROUTER_API_KEY env var or in-UI config
    • Optional ORCAROUTER_API_BASE_URL env var (defaults to https://api.orcarouter.ai/v1)
    • Auto-fetches model list from GET /v1/models when an API key is present; falls back to a curated default list (8 flagship models incl. orcarouter/auto) when no key is configured, so the dropdown is never empty on first launch
    • Adds HTTP-Referer: https://verba.weaviate.io/ and X-Title: Verba attribution headers (standard meta-router convention; OrcaRouter accepts but does not require them)
  • Registers OrcaRouterGenerator() in both the dev and production generator lists in goldenverba/components/managers.py

How to use

  1. Get an API key at https://www.orcarouter.ai
  2. Set it as ORCAROUTER_API_KEY env var, or paste it into the Verba UI's "API Key" field after selecting OrcaRouter in the Generator dropdown
  3. Pick a model (e.g. orcarouter/auto, openai/gpt-5, anthropic/claude-opus-4.7)
  4. Chat as normal

Docs: https://docs.orcarouter.ai · Model catalog: https://www.orcarouter.ai/models

Testing

  • pytest goldenverba/tests — 8 passed (no regressions)
  • Manual: instantiated OrcaRouterGenerator, verified it registers in managers.generators alongside the other generators
  • Verified GET https://api.orcarouter.ai/v1/models is reachable and returns the expected 150+ model list, used by the dropdown population logic
  • Local streaming chat tested end-to-end against orcarouter/auto and openai/gpt-4o-mini via the Verba UI

Notes for reviewers

  • Pattern is intentionally identical to AtlasCloudGenerator to minimize cognitive load
  • No new dependencies — only uses httpx / requests / dotenv / wasabi which are already in setup.py
  • No frontend changes; the new generator surfaces automatically via the existing generators list

xilema2 avatar May 26 '26 02:05 xilema2

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

weaviate-git-bot avatar May 26 '26 03:05 weaviate-git-bot

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.beep boop - the Weaviate bot 👋🤖PS:Are you already a member of the Weaviate Forum?

Hi maintainers, thanks for the review!

CLA: I have read and I agree to the terms of the Weaviate Contributor License Agreement. This contribution is my own work and I have the right to submit it under the project's license.

Disclosure: For full transparency, I'm an engineer on the OrcaRouter team. This PR adds OrcaRouter as an additional LLM provider option following the same pattern as the existing AtlasCloudGenerator — it introduces no new dependencies, is fully opt-in (requires the user to configure ORCAROUTER_API_KEY), and doesn't alter any existing generator behavior. Happy to adjust naming, attribution headers, or the fallback model list if you'd prefer a different approach.

Let me know if there's anything else you'd like me to change before merge. 🙏

xilema2 avatar May 26 '26 08:05 xilema2