Skip to content

feat: add OrcaRouter as a first-class LLM provider - #582

Open
armyluki-wq wants to merge 1 commit into
trailofbits:mainfrom
armyluki-wq:orcarouter/task-9003
Open

armyluki-wq wants to merge 1 commit into
trailofbits:mainfrom
armyluki-wq:orcarouter/task-9003

Conversation

@armyluki-wq

Copy link
Copy Markdown

Summary

This adds OrcaRouter as a named provider next to the existing ones. OrcaRouter is an OpenAI-compatible AI gateway that routes many providers behind one endpoint.

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.

Buttercup reaches every model through the LiteLLM proxy, so the integration lands in three places, all under the OrcaRouter name rather than as a generic custom base URL:

Provider registration (litellm/litellm_config.yaml, mirrored in deployment/k8s/values.yaml)

  • orcarouter-orcacyber-zero → orcacyber-zero, the recommended default, with orcarouter/fusion as the fallback for deployments where the cyber tier is not unlocked yet.
  • orcarouter-auto, orcarouter-deepseek-v4-pro, orcarouter-deepseek-v4-flash for general traffic.
  • Each entry carries its own api_base (https://api.orcarouter.ai/v1) and its own api_key: os.environ/ORCAROUTER_API_KEY. Nothing is derived from OPENAI_API_KEY or the OpenAI base URL, so a deployment that does not use OrcaRouter behaves exactly as before.

OrcaCyber Zero is aimed at security teams that have completed business verification, and it allows authorized security work that general-purpose gateways often refuse.

Model catalog (common/src/buttercup/common/orcarouter.py)

  • Reads the authoritative chat catalog from GET https://api.orcarouter.ai/v1/models?capability=chat with a bound on response size and a short timeout, then filters out records whose supported_endpoint_types contain no dialect the client speaks. Modality metadata is parsed strictly and fails closed, so the multimodal selector can never offer a model that does not declare image input.
  • Falls back to a small verified seed when the catalog is unreachable, so a fresh installation still starts offline.
  • The key is read only from ORCAROUTER_API_KEY. A masking helper renders it as a prefix plus the last four characters for display; the full value is never logged, returned by an endpoint or written anywhere.
  • create_orcarouter_llm builds the LangChain chat model against the gateway for callers that need a client rather than the proxy.

Dashboard (orchestrator/src/.../ui/competition_api, static/index.html, static/script.js, static/styles.css)

  • GET /v1/providers/orcarouter returns the provider identity, authentication method, key environment variable name, masked key and the capability/catalog summary.
  • GET /v1/providers/orcarouter/models?capability=chat|multimodal returns the selectable models.
  • The provider panel shows the API-key auth entry point, the key-management link, live catalog status and capability chips with per-capability counts, plus a searchable model selector whose list comes from the catalog. A missing key renders as not configured instead of an error, and a malformed catalog response returns HTTP 400 rather than a stack trace.

Tests

  • common/tests/test_orcarouter.py covers catalog parsing, endpoint-dialect filtering, multimodal selection, seed fallback, error paths, key masking and the LangChain factory.
  • orchestrator/test/test_orcarouter_provider_api.py covers both API routes, the capability filtering, the unconfigured-key path and that the existing dashboard routes are unchanged.
  • orchestrator/test/test_orcarouter_ui_evidence.py boots the real dashboard with uvicorn and drives it with Playwright and headless Chromium to record the auth panel and both model dropdowns from the live catalog; it is the source of the UI screenshots attached to this PR.

ruff check and ruff format --check pass on every changed Python file.

I'm an engineer on the OrcaRouter team.

🤖 Generated with Claude Code

Signed-off-by: armyluki-wq <armyluki-wq@users.noreply.github.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.

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