[feature] Add OrcaRouter as a named model provider
What problem does this solve?
config.yaml and the Settings UI both treat model endpoints as a generic OpenAI-compatible pair of base_url + model. That works, but for users who route through OrcaRouter — an OpenAI-compatible model gateway with smart routing across many upstream models — it means hand-typing the endpoint every time and re-discovering the right model IDs. The repo already sets the precedent for a named provider (provider: AzureOpenAIChatCompletionClient in src/magentic_ui/_ai_client.py, the model_config_azure_example block in config.yaml.example, and the Azure bullet in docs/configuration.md). A named OrcaRouter provider would mirror that precedent so routing through the gateway is a one-block setup.
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.
Proposed solution
Add OrcaRouter as a named model provider, mirroring the existing Azure named-provider pattern:
Backend registry —
src/magentic_ui/_ai_client.py:- Add an
_ORCAROUTER_PROVIDERSset and a_create_orcarouter()factory alongside_create_azure(), dispatching onprovider: OrcaRouterChatCompletionClient. - The factory returns the standard
AsyncOpenAIclient withbase_url=https://api.orcarouter.ai/v1, anORCAROUTER_API_KEYenv-var fallback, and a default model oforcarouter/auto(OrcaRouter's smart-routing model). Everything downstream (theChatClientwrapper, OmniAgent, FaraWebSurfer) is already OpenAI-compatible and needs no changes.
- Add an
Config example —
config.yaml.example: add amodel_config_orcarouteranchor block for both the orchestrator and web-surfer roles (mirroring the Azure example), so users can route either agent through the gateway.Docs —
docs/configuration.md: add an OrcaRouter bullet and YAML example in the "Model clients" notes (mirroring the Azure note), including that the browser-use model should be a vision-capable gateway model (e.g.orcarouter/fusion).Optional UI polish — the model cards in
ModelSettings.tsx/ onboarding currently accept free-form input; a provider preset that pre-fillshttps://api.orcarouter.ai/v1+orcarouter/autowould make adoption one click.
I verified the gateway's OpenAI-compatible surface with a live probe:
GET https://api.orcarouter.ai/v1/models→200, 208 models,orcarouter/autopresent.POST https://api.orcarouter.ai/v1/chat/completionswithmodel: "orcarouter/auto"→200with a normalchat.completionresponse (routed todeepseek-v4-pro), which is exactly the shape MagenticLite's_verify_single_endpointprobe andcreate_openai_clientexpect.
Alternatives considered
- Generic OpenAI-compatible passthrough only (current state): already works if users type
https://api.orcarouter.ai/v1by hand, but there's no named entry point, no preset, and no documentation — the endpoint stays invisible and each user re-discovers it. A named provider gives the same one-block config the repo already offers for Azure. - Frontend-only dropdown: would be user-visible but without the backend
providerdispatch the saved config still records a generic client; the backend named provider is the foundation, so it should come first.
Additional context
I'm an engineer on the OrcaRouter team — happy to turn this into a PR (the code is small and mirrors the Azure wiring), and to adjust the model IDs, defaults, or docs based on your preferences. I understand from CONTRIBUTING that code PRs are currently limited to vetted contributors; opening this issue first per the repo's issues-first guidance.
Source: microsoft/magentic-ui