feat(models): add OrcaRouter as a named model provider - #6688
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
feat(models): add OrcaRouter as a named model provider#6688XiaoHuo888-hue wants to merge 1 commit into
XiaoHuo888-hue wants to merge 1 commit into
Conversation
Adds OrcaRouterLlm, a lean subclass of AnthropicLlm that points the Anthropic-compatible client at OrcaRouter's /v1/messages endpoint (https://api.orcarouter.ai) and reads the credential from the ORCAROUTER_API_KEY env var. Model names such as orcarouter/anthropic/claude-haiku-4.5 resolve to the named provider through the lazy registry, and the orcarouter:... prefix syntax works too, so OrcaRouter-hosted models no longer fall through to the LiteLLM passthrough (which does not list the orcarouter provider). Adds unit tests for resolution, model-name handling, and client construction, and a registry resolution test in test_models.py. Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
No issue exists for this change.
2. Or, if no issue exists, describe the change:
Problem:
Model names routed through an OpenAI-compatible aggregator that ADK does not yet know about fall through to LiteLLM; if LiteLLM does not list the provider, resolution fails with
Model not found.Solution:
Adds OrcaRouter as a model provider. OrcaRouter is an OpenAI-compatible model routing gateway that exposes 150+ models from OpenAI, Anthropic, Google, DeepSeek, Qwen, MiniMax, xAI and others behind a single endpoint and API key. It also provides gateway-level security controls for AI agents.
This PR registers a named
OrcaRouterLlmprovider that mirrors the existingClaudesubclass ofAnthropicLlm: it only overrides client construction so requests go to OrcaRouter's Anthropic-compatible/v1/messagesendpoint athttps://api.orcarouter.ai, reading the key fromORCAROUTER_API_KEY. Model names likeorcarouter/anthropic/claude-haiku-4.5now resolve directly to the named provider, andorcarouter:...prefix syntax is supported as well.Testing Plan
Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.
Unit Tests:
Added
tests/unittests/models/test_orca_router_llm.py(supported models, default model, model-name prefix stripping, client construction withORCAROUTER_API_KEY/ base URL, and the missing-credential error) and a registry resolution test intests/unittests/models/test_models.py.Manual End-to-End (E2E) Tests:
Live smoke test against the real OrcaRouter endpoint (
ORCAROUTER_API_KEYset to a placeholder) throughOrcaRouterLlm.generate_content_asyncreachedhttps://api.orcarouter.ai/v1/messagesand returned an OrcaRouter-level401 AuthenticationError(orcarouter_api_error), confirming the base URL and request path are wired correctly.Checklist
Additional context
Contributions to this project require a signed Google Contributor License Agreement; this change is submitted on that basis.
I'm an engineer on the OrcaRouter team.