Skip to content

feat(as_llm): add named OrcaRouter provider - #462

Open
XiaoHuo888-hue wants to merge 1 commit into
agentscope-ai:mainfrom
XiaoHuo888-hue:add-orcarouter-provider
Open

feat(as_llm): add named OrcaRouter provider#462
XiaoHuo888-hue wants to merge 1 commit into
agentscope-ai:mainfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Add a named OrcaRouter provider to the as_llm component registry, mirroring the existing OpenAI-compatible wrappers.

OrcaRouter is an OpenAI-compatible gateway (base URL https://api.orcarouter.ai/v1). Until now, ReMe users could only reach it by repurposing the openai backend with a custom LLM_BASE_URL and a non-obvious model value. This PR registers a first-class orcarouter backend so the provider is visible and selectable by name:

LLM_BACKEND=orcarouter
LLM_MODEL_NAME=orcarouter/auto
LLM_API_KEY=sk-orca-...

LLM_BASE_URL stays optional and defaults to https://api.orcarouter.ai/v1.

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

  • reme/components/as_llm/__init__.py
    • OrcaRouterCredential: OpenAICredential subclass with a default base_url of https://api.orcarouter.ai/v1 and an empty-string fallback, so the shared base_url: ${LLM_BASE_URL:-} config key works without forcing users to set LLM_BASE_URL.
    • OrcaRouterAsLLM: registered as backend orcarouter in the built-in component registry.
  • README.md, README_ZH.md, docs/en/quick_start.md, docs/zh/quick_start.md, example.env: document the new backend.
  • tests/unit/test_orcarouter_provider.py: registration, default, fallback, and custom-base-url coverage.

Verification

  • Unit tests: pytest tests/unit → 1078 passed (2 pre-existing failures in test_codex_agent_wrapper.py reproduce on clean main; they are sandbox-environment issues with the Codex MCP stdio bridge, unrelated to this change).
  • Pre-commit hooks (black, flake8, pylint, add-trailing-comma, pyroma) all pass on the changed files.
  • Live L3 check: built OrcaRouterAsLLM with a real OrcaRouter key and hit https://api.orcarouter.ai/v1/chat/completions with model orcarouter/auto; the provider returned a valid completion.

Disclosure: I'm an engineer on the OrcaRouter team.

Add an OrcaRouter chat-model provider alongside the existing OpenAI-compatible
wrappers. OrcaRouter is an OpenAI-compatible gateway at
https://api.orcarouter.ai/v1; users can now select it with
LLM_BACKEND=orcarouter instead of pointing an OpenAI wrapper at a custom
base_url.

- OrcaRouterCredential: subclass of OpenAICredential with a default base_url
  of https://api.orcarouter.ai/v1 and an empty-string fallback for the shared
  ${LLM_BASE_URL:-} config key
- OrcaRouterAsLLM: registered as backend "orcarouter" in the as_llm registry
- docs: README (en/zh), quick start (en/zh), example.env
- tests: unit coverage for registration, defaults, and fallback behavior

Live-verified against the OrcaRouter chat/completions endpoint with model
orcarouter/auto.

Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jinliyl

jinliyl commented Aug 20, 2026

Copy link
Copy Markdown
Member

Thank you for the contribution and for providing tests and documentation.

Could you clarify why a dedicated orcarouter backend is necessary here? Since OrcaRouter exposes an OpenAI-compatible API, it appears to work with the existing backend already:

LLM_BACKEND=openai
LLM_MODEL_NAME=orcarouter/auto
LLM_API_KEY=sk-orca-...
LLM_BASE_URL=https://api.orcarouter.ai/v1

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants