Skip to content

feat(llm): add built-in orcarouter LLM provider - #369

Open
XiaoHuo888-hue wants to merge 1 commit into
obot-platform:mainfrom
XiaoHuo888-hue:feat/orcarouter-llm-provider
Open

feat(llm): add built-in orcarouter LLM provider#369
XiaoHuo888-hue wants to merge 1 commit into
obot-platform:mainfrom
XiaoHuo888-hue:feat/orcarouter-llm-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Description

Adds OrcaRouter as a built-in LLM provider in
Nanobot, alongside the existing openai and anthropic built-ins. OrcaRouter
is 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_KEY is enough to start using it:

agents:
  main:
    model: orcarouter/openai/gpt-4o

Because OrcaRouter model ids carry their own provider prefix, the model field
uses 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's llmConfig() already ships built-in openai and
anthropic providers for zero-config use. Adding orcarouter as a named
built-in gives users the same one-env-var experience for the OrcaRouter
gateway. The base URL is pinned to https://api.orcarouter.ai/v1 so an unset
env var can never silently fall back to api.openai.com/v1.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies application configuration/environment variables
    • New built-in provider orcarouter reading ORCAROUTER_API_KEY
      (documented in README.md)

How did you test it?

  • go build ./... and gofmt are clean.
  • go test ./pkg/llm/... ./pkg/cli/... passes, including new tests
    (TestNanobotLLMConfigBuiltinOrcaRouter, TestNanobotLLMConfigBuiltinProviders,
    and orcarouter resolve cases in TestResolveProvider).
  • Live API: llm.Client.Complete with the built-in provider shape
    (model: orcarouter/deepseek/deepseek-v4-flash) returns a valid completion
    (HTTP 200) against the real OrcaRouter API.
  • Note: go test ./... has a pre-existing Windows-only failure in
    pkg/session (TestDeleteSessionsUpdatedBefore: SQLite temp-dir cleanup
    file lock). It reproduces on a clean checkout and is unrelated to this change.

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>
Copilot AI balanced review requested due to automatic review settings August 18, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 orcarouter as 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 thread pkg/cli/root.go
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 thread README.md
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`.

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