feat: add OrcaRouter as a named completion model - #433
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds OrcaRouter as a named registered completion model, plus a small
api_key_envresolution inLiteLLMCompletionModelso provider API keys stay in the environment instead of inmorphik.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 asorcarouter/autopick 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.py—LiteLLMCompletionModel.__init__now resolves anapi_key_enventry in a registered model config (e.g.ORCAROUTER_API_KEY) into theapi_keypassed to LiteLLM, then removesapi_key_envso it isn't forwarded as a LiteLLM kwarg. Models withoutapi_key_envare untouched.morphik.toml— new namedorcarouter_autoregistered model:openai/orcarouter/autoviahttps://api.orcarouter.ai/v1, readingORCAROUTER_API_KEYfrom the environment (keys start withsk-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
Checks
pytest core/tests/unit/test_litellm_completion_orcarouter.py— 4 passedruff checkon the changed files — cleanLiteLLMCompletionModel.complete()returns text fromhttps://api.orcarouter.ai/v1through the resolved keyDisclosure
I'm an engineer on the OrcaRouter team. Happy to adjust naming or scope — or close this if out of scope.