Skip to content

feat: add OrcaRouter as a named completion model - #433

Open
XiaoHuo888-hue wants to merge 1 commit into
morphik-org:mainfrom
XiaoHuo888-hue:feat/orcarouter-completion
Open

feat: add OrcaRouter as a named completion model#433
XiaoHuo888-hue wants to merge 1 commit into
morphik-org:mainfrom
XiaoHuo888-hue:feat/orcarouter-completion

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Description

Adds OrcaRouter as a named registered completion model, plus a small api_key_env resolution in LiteLLMCompletionModel so provider API keys stay in the environment instead of in morphik.toml.

This adds a dedicated OrcaRouter provider rather than relying on the generic OpenAI-compatible endpoint, mirroring how this repo already treats openai_gpt4-1-style aggregators. Named routers such as orcarouter/auto pick an upstream per request. OrcaRouter is an OpenAI-compatible gateway that exposes 150+ models behind one API key, and it also provides gateway-level security controls for AI agents.

Changes

  • core/completion/litellm_completion.pyLiteLLMCompletionModel.__init__ now resolves an api_key_env entry in a registered model config (e.g. ORCAROUTER_API_KEY) into the api_key passed to LiteLLM, then removes api_key_env so it isn't forwarded as a LiteLLM kwarg. Models without api_key_env are untouched.
  • morphik.toml — new named orcarouter_auto registered model: openai/orcarouter/auto via https://api.orcarouter.ai/v1, reading ORCAROUTER_API_KEY from the environment (keys start with sk-orca-).
  • core/tests/unit/test_litellm_completion_orcarouter.py — unit tests covering the resolution (key present, key missing, no-op for other models, unknown key raises).

Usage

# morphik.toml
[completion]
model = "orcarouter_auto"

Checks

  • pytest core/tests/unit/test_litellm_completion_orcarouter.py — 4 passed
  • ruff check on the changed files — clean
  • L3 live test: with a real key, LiteLLMCompletionModel.complete() returns text from https://api.orcarouter.ai/v1 through the resolved key

Disclosure

I'm an engineer on the OrcaRouter team. Happy to adjust naming or scope — or close this if out of scope.

Registers an orcarouter_auto model in morphik.toml (OpenAI-compatible
endpoint https://api.orcarouter.ai/v1) and teaches LiteLLMCompletionModel
to resolve an api_key_env config entry into the api_key passed to LiteLLM,
so provider keys stay in the environment rather than in config.

Co-Authored-By: Claude <noreply@anthropic.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