feat(cli): add OrcaRouter as a named provider - #202
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
Conversation
Wire OrcaRouter the same way OpenRouter is: provider registry entry, keystore credential, orcarouter: model prefix resolved to the gateway base URL, a live 24h-cached model catalogue, a /model picker section and a models orcarouter command, plus docs and 30 tests. 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.
Summary
Adds OrcaRouter as a named provider for the CLI, wired the same way OpenRouter is today: a provider registry entry, a keystore credential, a CLI-only
orcarouter:model prefix resolved to the gateway base URL, a live (24h-cached) model catalogue, and a picker section plus amodels orcaroutercommand.With one API key, users get 150+ models from OpenAI, Anthropic, Google, DeepSeek, Qwen, MiniMax and xAI behind a single endpoint. Because the provider is a thin base-URL swap, any pydantic-deepagents pipeline/agent that uses it also inherits OrcaRouter's gateway-level, zero-trust security controls for AI agents — with no application code changes. The gateway screens every prompt and response and governs every tool call on a default-deny basis, across four layers:
I'm an engineer on the OrcaRouter team.
pydantic-ai has no native
orcarouter:provider, so the prefix is resolved inapps/cli/model_resolve.py(mirroring the existingopenai-compatible:sentinel) and the gateway base URL is fixed so users never configure it by hand.Changes
OrcaRouterto the provider registry withORCAROUTER_API_KEYand theorcarouter:prefix (apps/cli/providers.py).ORCAROUTER_API_KEYcredential to the keystore and onboarding (apps/cli/credentials.py).orcarouter:<id>model strings to anOpenAIChatModelpointed athttps://api.orcarouter.ai/v1(apps/cli/model_resolve.py).openrouter_models.py(apps/cli/orcarouter_models.py)./modelpicker and amodels orcaroutercommand (apps/cli/modals/model_picker.py,apps/cli/main.py).README.md,docs/cli/settings.md).tests/test_cli_orcarouter.py).Testing
tests/test_cli_orcarouter.py, all passinguv run pytest tests/test_cli_orcarouter.py→ 30 passeduv run ruff format --check(294 files already formatted) anduv run ruff check→ All checks passeduv run pyright→ 0 errors, 0 warnings;uv run mypy pydantic_deep tests→ only the pre-existingtests/test_forking_core.py:2363mkfifoattr-defined error on Windows (untouched by this PR)uv run bandit -r pydantic_deep -x tests -ll→ only pre-existing findings inpydantic_deep; this PR touches onlyapps/cli/and adds testsNote on the full local suite: the coverage gate (
coverage fail_under = 100) is scoped topydantic_deep(seepyproject.toml), which this PR does not modify; the remaining local failures (subprocess/symlink/timing tests) reproduce on a clean checkout ofmainon Windows and are unrelated to this change.Related Issues
None.
Notes for Reviewers
The
orcarouter:prefix is a CLI-level marker exactly like the existingopenai-compatible:sentinel; pydantic-ai never sees it. The API key comes from the keystore (ORCAROUTER_API_KEY), never fromconfig.toml, andOPENAI_API_KEYis never sent to the gateway.