feat: add OrcaRouter (orcarouter/) as a first-class provider#5147
Open
xilema2 wants to merge 1 commit into
Open
feat: add OrcaRouter (orcarouter/) as a first-class provider#5147xilema2 wants to merge 1 commit into
xilema2 wants to merge 1 commit into
Conversation
OrcaRouter (https://www.orcarouter.ai) is an OpenAI-compatible LLM meta-router. This adds it as a first-class provider in aider: - New OrcaRouterModelManager that fetches the public /api/pricing catalog (no auth) and exposes per-model context_length / pricing in litellm get_model_info shape. Pricing uses OrcaRouter's published quota formula (model_ratio * 2 USD/1M for input, * completion_ratio for output). - ModelInfoManager delegates to it for orcarouter/-prefixed models when litellm has no built-in info. - Model.send_completion auto-routes orcarouter/<vendor>/<model> to api.orcarouter.ai/v1 via litellm's OpenAI-compatible client, using ORCAROUTER_API_KEY from the environment. HTTP-Referer / X-Title attribution headers are injected so OrcaRouter's console can credit the traffic to aider. - ORCAROUTER_API_KEY added to fast_validate_environment keymap. - "orcarouter-auto" alias added for the orcarouter/orcarouter/auto adaptive router. - Docs page at aider/website/docs/llms/orcarouter.md. - Unit tests in tests/basic/test_orcarouter.py mirroring the existing OpenRouter test pattern. I'm an engineer on the OrcaRouter team.
Author
|
Hi @paul-gauthier, gentle ping on this PR. As a first-time contributor, the required CI workflows are waiting for maintainer approval to run (4 workflows pending). Could you kindly approve them when you have a moment? Happy to address any feedback. Thanks! |
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.
PR Description
I'm an engineer on the OrcaRouter team.
What's added
aider/orcarouter.py—OrcaRouterModelManagerthat fetches the publicpricing/catalog feed at
https://www.orcarouter.ai/api/pricing(no auth) andexposes per-model
max_input_tokens/max_output_tokens/input_cost_per_token/output_cost_per_tokenin the litellmget_model_infoshape. Computed from OrcaRouter's published quota formula(
model_ratio * 2 USD/1Mfor input,× completion_ratiofor output).24h on-disk cache at
~/.aider/caches/orcarouter_models.json, mirroring theOpenRouter manager.
aider/models.py—ModelInfoManagerdelegates toOrcaRouterModelManagerfororcarouter/-prefixed models when litellm has no built-in info.Model.send_completionauto-routesorcarouter/<vendor>/<model>tohttps://api.orcarouter.ai/v1via litellm's OpenAI-compatible client,using
ORCAROUTER_API_KEYfrom the environment.HTTP-Referer/X-Titleattribution headers are injected so OrcaRouter's console cancredit traffic to aider (users can override via
extra_params.extra_headers).ORCAROUTER_API_KEYadded tofast_validate_environmentkeymap soaider's startup env check recognises it.
orcarouter-autoalias added toMODEL_ALIASESfor OrcaRouter'sadaptive router.
aider/website/docs/llms/orcarouter.md— new docs page (parallel toopenrouter.md) covering setup, the adaptiveorcarouter/autorouter,the tool-calling caveat, and
extra_bodyprovider-routing config.tests/basic/test_orcarouter.py— unit tests mirroring the OpenRoutertest pattern: pricing formula on a flat-array payload, pricing formula on
the wrapped
{"data": [...]}payload, empty-result handling, and theModelInfoManagerdelegation.Design notes
orcarouter/prefix is rewrittento
openai/<rest>for the underlying litellm call, withapi_baseandapi_keyinjected, so litellm's existing OpenAI-compatible client handlesthe request. The user-facing model name keeps the
orcarouter/prefix soaider's per-provider hooks (alias resolution, metadata lookup) work
uniformly.
side-by-side and maintains the same caching / fallback behaviour.
How verified
pytest tests/basic/test_orcarouter.py).https://www.orcarouter.ai/api/pricingconfirmsthe pricing formula matches published per-model rates (e.g.
openai/gpt-4o:model_ratio=1.25, completion_ratio=4→$2.50 / $10.00 per 1M tokens).Happy to iterate on naming, doc tone, or scope. Thanks for maintaining aider!