Skip to content

feat(llm): add OrcaRouter as a named OpenAI-compatible gateway - #205

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

feat(llm): add OrcaRouter as a named OpenAI-compatible gateway#205
XiaoHuo888-hue wants to merge 1 commit into
modelscope:mainfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Adds OrcaRouter as a named, OpenAI-compatible smart-routing gateway for FunClip's transcript-driven LLM clipping — mirroring the existing atlascloud/ and minimax/ gateway routes.

Users can now select any orcarouter/ model in the LLM Model Name dropdown (orcarouter/auto, orcarouter/fusion, orcarouter/fusion-flash, orcarouter/fusion-mini), paste an OrcaRouter API key in the APIKEY box, and run 'LLM Inference'. FunClip sends the transcript and prompts to https://api.orcarouter.ai/v1/chat/completions, and the returned segments work with the existing 'AI Clip' button unchanged.

  • funclip/llm/openai_api.py: orcarouter/ prefix branch in _resolve_model_config()ORCAROUTER_API_BASE (https://api.orcarouter.ai/v1, overridable via ORCAROUTER_API_BASE) + ORCAROUTER_API_KEY env fallback. Model IDs are sent verbatim with the orcarouter/ prefix, as the gateway routes by namespace.
  • funclip/launch.py: SUPPORT_LLM_PREFIX + dispatch branch + 4 gateway model dropdown entries.
  • tests/test_orcarouter_api.py, tests/test_orcarouter_launch_integration.py: unit tests mirroring the MiniMax/AtlasCloud conventions.
  • README.md / README_zh.md: "Using OrcaRouter as your LLM gateway (optional)" section.

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.

User impact

FunClip users get a one-dropdown way to route LLM-assisted clipping through a single gateway that can switch routing targets (frontier and open-weight models) without touching FunClip configuration.

Validation

  • I ran the relevant tests or commands:
    • python3 -m pytest -q tests/test_openai_api.py tests/test_minimax_api.py tests/test_minimax_launch_integration.py tests/test_orcarouter_api.py tests/test_orcarouter_launch_integration.py18 passed
    • python3 -m py_compile funclip/launch.py funclip/videoclipper.py funclip/utils/subtitle_utils.py funclip/llm/openai_api.py → OK
    • git diff --check → clean
    • Full suite: 6 pre-existing env failures (missing twelvelabs/gradio) identical on clean main; zero regressions.
  • I checked the affected README/docs links, if changed.
  • I verified the affected LLM path, if changed: L3 live test with a real key through the actual openai_call() code path → orcarouter/autohttps://api.orcarouter.ai/v1/chat/completions200 ORCA-LIVE-OK; _resolve_model_config("orcarouter/auto") resolves base_url https://api.orcarouter.ai/v1 and preserves the full model ID.

Screenshots or clips

No UI visuals — the change adds dropdown entries and a routing branch. The dropdown now lists orcarouter/auto, orcarouter/fusion, orcarouter/fusion-flash, orcarouter/fusion-mini.

Notes for reviewers

  • OrcaRouter is a smart-routing gateway: model IDs must keep the orcarouter/ prefix (a bare auto is not routable), so unlike AtlasCloud/MiniMax the prefix is intentionally preserved in the wire request.
  • OrcaRouter only exposes chat completions; no embeddings/audio endpoints, so no other FunClip surface was touched.

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

Add a named OrcaRouter provider to the transcript-driven LLM clipping
routing, mirroring the existing atlascloud/minimax gateways. Selecting
any orcarouter/ model in the LLM Model Name dropdown routes requests to
https://api.orcarouter.ai/v1/chat/completions with the ORCAROUTER_API_KEY
environment variable (or pasted APIKEY).

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

@LauraGPT LauraGPT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused integration tests passed (18/18), and the four documented model slugs are valid. One blocking documentation issue remains: the two READMEs describe optional security controls as active by default.

Comment thread README.md

Besides the transcript-based LLMs above, FunClip can route LLM-assisted clipping through [OrcaRouter](https://www.orcarouter.ai), an OpenAI-compatible smart-routing gateway. Select any `orcarouter/` model in the **LLM Model Name** dropdown (`orcarouter/auto` routes each request to the best model for the task), paste an OrcaRouter API key in the **APIKEY** box, and click 'LLM Inference' — FunClip sends the transcript and prompts to `https://api.orcarouter.ai/v1/chat/completions`, and the returned segments work with the existing 'AI Clip' button unchanged.

OrcaRouter exposes one endpoint for all frontier and open-weight models, so you can switch routing targets without changing FunClip. 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Make the security guarantee conditional on configuration

This integration only supplies the base URL, API key, and model; it does not attach a Guardrail or Firewall policy or apply the tight autonomy posture. OrcaRouter documents that with neither a key attachment nor a workspace default there is no enforcement, and that default-deny requires explicitly applying tight. It also scopes Firewall coverage to tool calls that cross or report through the gateway, not every tool call. As written, users can reasonably believe selecting OrcaRouter protects every prompt, response, and action automatically. Please qualify this paragraph in both READMEs, link the security setup, and avoid the unconditional every-tool-call claim.

References: https://docs.orcarouter.ai/features/guardrails#scoping-and-the-workspace-default, https://docs.orcarouter.ai/features/firewall#scoping-and-resolution, https://docs.orcarouter.ai/security/concepts/quickstart, https://docs.orcarouter.ai/security/concepts/shared-responsibility

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.

2 participants