feat(llm): add built-in orcarouter LLM provider - #369
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
Conversation
Add "orcarouter" to the built-in llmProviders in pkg/cli/root.go, mirroring the openai/anthropic entries. OrcaRouter (https://www.orcarouter.ai) is an OpenAI-compatible router exposing 200+ models (openai/gpt-4o, anthropic/claude-sonnet-4.6, deepseek/deepseek-v4-flash) behind a single endpoint and API key. Its model ids carry their own provider prefix, so the model field uses the "orcarouter/<provider>/<model>" format, e.g. "orcarouter/openai/gpt-4o". BaseURL is pinned to https://api.orcarouter.ai/v1 so an unset env var cannot fall back to api.openai.com/v1. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds built-in support for the OrcaRouter LLM provider and validates provider/model resolution for its prefixed model IDs.
Changes:
- Add
orcarouteras a built-in LLM provider in CLI defaults (dialect, API key env var, base URL). - Extend provider resolution tests to cover
orcarouter/<provider>/<model>parsing. - Document OrcaRouter configuration and model ID format in the README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/llm/client_test.go | Adds orcarouter to provider resolution fixtures and test cases for nested prefixes. |
| pkg/cli/root_test.go | Adds tests asserting orcarouter exists in built-in LLM config and has expected defaults. |
| pkg/cli/root.go | Defines built-in orcarouter provider with OpenAI Responses dialect and fixed base URL. |
| README.md | Documents OrcaRouter as a built-in provider and shows YAML config example and model naming. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+178
to
+188
| // OrcaRouter is an OpenAI-compatible router that exposes 200+ models | ||
| // (e.g. openai/gpt-4o, anthropic/claude-sonnet-4.6) behind one endpoint. | ||
| // Its model ids carry their own provider prefix, so reference them as | ||
| // "orcarouter/<provider>/<model>", e.g. "orcarouter/openai/gpt-4o". | ||
| "orcarouter": { | ||
| Dialect: types.DialectOpenAIResponses, | ||
| APIKey: "${ORCAROUTER_API_KEY}", | ||
| // Hardcoded: unlike OPENAI_BASE_URL there is no ORCAROUTER_BASE_URL | ||
| // default, and an empty BaseURL would fall back to api.openai.com/v1. | ||
| BaseURL: "https://api.orcarouter.ai/v1", | ||
| }, |
Comment on lines
+114
to
115
| `openai`, `anthropic`, and `orcarouter` are built-in providers — set `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `ORCAROUTER_API_KEY` and they work with no additional config. Use the `{provider}/{model}` format in the `model` field to select a provider. For OrcaRouter, model ids carry their own provider prefix, so the model field uses the `orcarouter/<provider>/<model>` format, e.g. `orcarouter/openai/gpt-4o`. | ||
|
|
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.
Description
Adds OrcaRouter as a built-in LLM provider in
Nanobot, alongside the existing
openaiandanthropicbuilt-ins. OrcaRouteris an OpenAI-compatible model routing gateway that exposes 200+ models from
OpenAI, Anthropic, Google, DeepSeek and others behind a single endpoint and API
key, with gateway-level security controls for AI agents.
Setting
ORCAROUTER_API_KEYis enough to start using it:Because OrcaRouter model ids carry their own provider prefix, the
modelfielduses the
orcarouter/<provider>/<model>format (e.g.orcarouter/openai/gpt-4o,orcarouter/anthropic/claude-sonnet-4.6,orcarouter/deepseek/deepseek-v4-flash).I'm an engineer on the OrcaRouter team.
Motivation and Context
pkg/cli/root.go'sllmConfig()already ships built-inopenaiandanthropicproviders for zero-config use. Addingorcarouteras a namedbuilt-in gives users the same one-env-var experience for the OrcaRouter
gateway. The base URL is pinned to
https://api.orcarouter.ai/v1so an unsetenv var can never silently fall back to
api.openai.com/v1.Additional Changes
orcarouterreadingORCAROUTER_API_KEY(documented in
README.md)How did you test it?
go build ./...andgofmtare clean.go test ./pkg/llm/... ./pkg/cli/...passes, including new tests(
TestNanobotLLMConfigBuiltinOrcaRouter,TestNanobotLLMConfigBuiltinProviders,and
orcarouterresolve cases inTestResolveProvider).llm.Client.Completewith the built-in provider shape(
model: orcarouter/deepseek/deepseek-v4-flash) returns a valid completion(HTTP 200) against the real OrcaRouter API.
go test ./...has a pre-existing Windows-only failure inpkg/session(TestDeleteSessionsUpdatedBefore: SQLite temp-dir cleanupfile lock). It reproduces on a clean checkout and is unrelated to this change.