feat(llms): add OrcaRouter as a named LLM provider - #2275
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
Conversation
Adds an orcarouter: provider to the pipeline LLM provider registry (opencontractserver/pipeline/llm_providers/orcarouter_provider.py) mirroring the OpenAI provider pattern. OrcaRouter is an OpenAI-compatible model routing gateway; model specs like orcarouter:orcarouter/auto reuse the existing pydantic-ai OpenAI client path. pydantic-ai has no native orcarouter: prefix, so opencontractserver/llms/model_factory.py now always constructs a concrete OpenAI-compatible model for this provider instead of returning a bare spec string (which would raise 'Unknown model'). DB-configured credentials win; otherwise ORCAROUTER_API_KEY and the default endpoint https://api.orcarouter.ai/v1 are used. Docs: model-spec table + API-keys section in docs/architecture/llms/README.md, ORCAROUTER_API_KEY in the production sample env. Changelog fragment added. Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>
Contributor
|
I have read the CLA Document and I hereby sign the CLA XiaoHuo888-hue seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
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.
Summary
Adds OrcaRouter as a first-class LLM provider. OrcaRouter is an OpenAI-compatible model routing gateway that fronts dozens of hosted models behind one endpoint — pick a router alias like
orcarouter/autoor a specific hosted model. 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.Changes
opencontractserver/pipeline/llm_providers/orcarouter_provider.py— mirrors the OpenAI provider. DeclaresORCAROUTER_API_KEY(secret) and abase_url(optional, defaulting tohttps://api.orcarouter.ai/v1) so credentials are configurable live in System Settings → Pipeline Components, exactly like the other providers. The registry auto-discovers it and it surfaces in the System Settings LLM picker andCorpus.preferred_llm/AgentConfiguration.preferred_llm.opencontractserver/llms/model_factory.py— pydantic-ai has no nativeorcarouter:provider prefix, so a bare"orcarouter:..."spec string would raise "Unknown model" at agent construction. The factory now always builds a concrete OpenAI-compatible model for this provider (DB credentials win; otherwiseORCAROUTER_API_KEY+ the default endpoint), keeping the env-fallback contract safe.test_llm_model_factory.py: registry discovery + model construction (no-DB-creds still builds a concrete model; DBbase_url/api_keyoverride; invalid DBbase_urlfalls back to default).test_llm_runtime_config.py: provider registered + schema.docs/architecture/llms/README.md;ORCAROUTER_API_KEYadded to the production sample env.changelog.d/orcarouter-provider.added.md.Test plan
pre-commit run --all-filespasses on the touched files (black, isort, flake8, mypy, pyupgrade, trailing-whitespace, end-of-file-fixer); the changelog fragment validates viapython3 scripts/collate_changelog.py --check(the pre-commit wrapper needs barepythonin PATH, which the CI runner provides).orcarouter:specs.https://api.orcarouter.ai/v1/chat/completionswith a real key — HTTP 200, returnedORCA-LIVE-OK.Checklist
pre-commit run --all-filespasses (black, isort, flake8, prettier)changelog.d/pydantic-ai-slim[openai]/openaistackContributor License Agreement
By submitting this pull request, you agree to license your contribution under the project's Contributor License Agreement.
Disclosure: I'm an engineer on the OrcaRouter team.