feat(llms): add OrcaRouter as a named LLM provider - #2275
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>
|
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. |
|
Reviewed this as part of a batch pass over the open PRs. Thanks for the clean, well-commented provider module and for the up-front disclosure. Two notes on state first: the branch merges cleanly with current I found two things I'd call blockers. Both are reproduced, not inferred. 1. With no OrcaRouter key configured, the install's
|
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.