Skip to content

feat(online): add OrcaRouter chat provider - #1287

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

XiaoHuo888-hue wants to merge 1 commit into
LazyAGI:mainfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

📌 PR 内容 / PR Description

Add a named OrcaRouter online chat provider to LazyLLM's OnlineChatModule.

OrcaRouter is a unified multi-model gateway that exposes an OpenAI-compatible API (https://api.orcarouter.ai/v1/). This PR mirrors the existing DeepSeek/PPIO OpenAI-compatible gateway wiring so users can select it by name (source='orcarouter') instead of manually filling in a generic 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.


🎯 问题背景 / Problem Context

  • LazyLLM already ships named providers (openai, deepseek, ppio, glm, kimi, qwen, ...). OrcaRouter is another OpenAI-compatible gateway, so adding a named provider keeps the user experience consistent and lets users route through OrcaRouter's smart-routing models (orcarouter/auto, orcarouter/fusion, orcarouter/fusion-flash, orcarouter/fusion-mini).

🔍 相关 Issue / Related Issue

  • None (small provider addition following the existing supplier pattern in lazyllm/module/llms/onlinemodule/supplier/).

✅ 变更类型 / Type of Change

  • New feature

🧪 如何测试 / How Has This Been Tested?

  1. python3 -m flake8 on all changed files — clean.
  2. pytest tests/basic_tests/Models/test_orcarouter_provider.py tests/basic_tests/Modules/test_map_model.py — 5 passed.
  3. pytest tests/basic_tests/Models/test_online_chat_model_runtime.py — 59 passed (regression).
  4. pytest tests/doc_check/test_doc_api_check.py -k OrcaRouterChat — passed (docs registration).
  5. Live end-to-end (real API key): OnlineChatModule(source='orcarouter', model='orcarouter/auto')https://api.orcarouter.ai/v1/chat/completions → HTTP 200 ORCA-LIVE-OK. All four gateway models (orcarouter/auto, fusion, fusion-flash, fusion-mini) returned ORCA-LIVE-OK.

⚡ 更新后的用法示例 / Usage After Update

import lazyllm
# export LAZYLLM_ORCAROUTER_API_KEY=sk-orca-...
chat = lazyllm.OnlineChatModule(source='orcarouter', model='orcarouter/auto')
print(chat('Hello!'))

⚠️ 注意事项 / Additional Notes

  • Default base_url is https://api.orcarouter.ai/v1/ (trailing slash, matching the existing openai.py convention so urljoin produces /v1/chat/completions).
  • OrcaRouter is a chat-only gateway — no embedding/rerank endpoints were added.

🧠 AI 参与情况 / AI Involvement

  • 使用 AI 辅助(局部代码)/ AI-assisted (partial code)

使用工具 / Tools Used:

  • ClaudeCode

Add a named OrcaRouter online chat provider (source='orcarouter') that
mirrors the existing DeepSeek/PPIO OpenAI-compatible gateway wiring.

- supplier/orcarouter.py: OrcaRouterChat with base_url
  https://api.orcarouter.ai/v1/ and default model orcarouter/auto
- map_model_type.py: register orcarouter/{auto,fusion,fusion-flash,
  fusion-mini} as llm
- cli/run.py: add orcarouter to --source choices
- docs/module.py + docs API reference: bilingual docs + usage example
- tests: provider registration/defaults tests + model mapping cases

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>

This branch had an error being deployed

1 failed deployment
protected b7995e1d Deployed Aug 20, 2026 by XiaoHuo888-hue via wait_approve #5305
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.

1 participant