Repository navigation
feat(llms): add OrcaRouter named provider - #371
Open
JinhaoSong322 wants to merge 1 commit into
Open
JinhaoSong322 wants to merge 1 commit into
JinhaoSong322 wants to merge 1 commit into
Conversation
Add OrcaRouterAPI and AsyncOrcaRouterAPI wrappers that mirror the existing GPTAPI/AsyncGPTAPI OpenAI-compatible wrappers with OrcaRouter defaults: - base url https://api.orcarouter.ai/v1/chat/completions - default model orcarouter/auto (auto-routed open-weight models) - reads ORCAROUTER_API_KEY (sk-orca- prefix) instead of OPENAI_API_KEY - accepts gateway aliases (orcarouter/*) and vendor-qualified model names (vendor/model) through the generic Chat Completions payload - registered in lagent.llms exports, documented in quickstart.md, covered by 11 unit tests L3 live-tested against the real endpoint (chat + async + vendor-qualified model + json mode all returned correct responses). Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: JinhaoSong322 <jinhao.song@myflashcloud.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
Add OrcaRouter as a named LLM provider in Lagent, mirroring the existing
GPTAPI/AsyncGPTAPIOpenAI-compatible wrappers.OrcaRouter is a gateway that fronts open-weight models from many vendors through a single OpenAI-compatible endpoint. 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.
What changed
lagent/llms/orcarouter.py(new):OrcaRouterAPIandAsyncOrcaRouterAPI, subclasses ofGPTAPI/AsyncGPTAPIwith OrcaRouter defaults:https://api.orcarouter.ai/v1/chat/completionsorcarouter/auto(auto-routed open-weight models on the gateway)ORCAROUTER_API_KEY(keys start withsk-orca-) instead ofOPENAI_API_KEYorcarouter/*) and vendor-qualified model names (vendor/model, e.g.deepseek/deepseek-v4-pro) via the generic Chat Completions payloadlagent/llms/__init__.py: export the new wrappers.docs/en/get_started/quickstart.md: document the "Using OrcaRouter" section.tests/test_llms/test_orcarouter.py(new): 11 unit tests covering defaults, env-key resolution, payload generation (gateway alias / vendor-qualified / json mode / unsupported model), and a mocked chat call.Verification
flake8clean on changed files;py_compilepasses.main(7 pre-existing environment/network-dependent failures intests/test_actions/*;tests/test_agents/test_rewoo.pyfails collection on cleanmaintoo due to a refactored-outllm_qamodule — unrelated to this change).https://api.orcarouter.ai/v1with a real key, through the new provider path:orcarouter/auto) →ORCA-OKORCA-OKdeepseek/deepseek-v4-pro→VENDOR-OKExample
Disclosure: I'm an engineer on the OrcaRouter team.