Skip to content

feat: add OrcaRouter as a named OpenAI-compatible provider - #622

Open
JinhaoSong322 wants to merge 1 commit into
abi:mainfrom
JinhaoSong322:add-orcarouter-provider
Open

feat: add OrcaRouter as a named OpenAI-compatible provider#622
JinhaoSong322 wants to merge 1 commit into
abi:mainfrom
JinhaoSong322:add-orcarouter-provider

Conversation

@JinhaoSong322

Copy link
Copy Markdown

Add OrcaRouter as a named OpenAI-compatible provider

Adds OrcaRouter as a first-class model provider alongside OpenAI, Anthropic, and Gemini. OrcaRouter is an OpenAI-compatible gateway that routes each request to the best available model automatically via orcarouter/auto. 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

  • backend/llm.py — register orcarouter/auto and expose ORCAROUTER_MODELS.
  • backend/agent/providers/factory.py — dispatch OrcaRouter models to the existing OpenAI-compatible Responses session, pointed at https://api.orcarouter.ai/v1.
  • backend/routes/generate_code.py — accept ORCAROUTER_API_KEY from backend/.env or the settings dialog; when set, use the OrcaRouter gateway model for every variant.
  • backend/config.py, backend/evals/core.py, backend/agent/engine.py, backend/agent/tools/runtime.py — thread the OrcaRouter key/base URL through the agent pipeline and eval runner.
  • frontend — add OrcaRouter API key + base URL fields to the Settings dialog, and register orcarouter/auto in lib/models.ts.
  • README.md — document the new key.

How it works

The app already has an OpenAI-compatible code path that talks to the Responses API with configurable base_url. OrcaRouter exposes the same endpoint shape, so this reuses that proven session — no new transport or streaming code.

Verification

  • Backend: pytest276 passed.
  • Frontend: tsc --noEmit clean, eslint clean on changed files, jest42 passed.
  • Live: a real request through the new provider path (via create_provider_session for orcarouter/auto) returned a streaming 200 response from https://api.orcarouter.ai/v1/responses.

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

Add OrcaRouter (https://www.orcarouter.ai) as a first-class model
provider alongside OpenAI, Anthropic, and Gemini.

- backend/llm.py: register 'orcarouter/auto' as an OrcaRouter model and
  expose ORCAROUTER_MODELS.
- backend/agent/providers/factory.py: dispatch OrcaRouter models to the
  existing OpenAI-compatible Responses session against
  https://api.orcarouter.ai/v1.
- backend/routes/generate_code.py: accept ORCAROUTER_API_KEY from env or
  the settings dialog; when set, use the OrcaRouter gateway model for all
  variants.
- backend/evals/core.py, config.py, agent/engine.py, tools/runtime.py:
  thread the OrcaRouter key/base URL through the agent pipeline.
- frontend: add OrcaRouter key/base URL fields to the Settings dialog and
  register the model in lib/models.ts.

Verified: backend pytest (276 passed), frontend tsc + eslint + jest pass,
and a live request through the new provider path returns a 200 response
from the OrcaRouter Responses API.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: JinhaoSong322 <jinhao.song@myflashcloud.com>
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