Coverage for src/local_deep_research/llm/providers/implementations/orcarouter.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.1, created at 2026-07-19 23:35 +0000

1"""OrcaRouter LLM provider for Local Deep Research.""" 

2 

3from ..openai_base import OpenAICompatibleProvider 

4 

5 

6class OrcaRouterProvider(OpenAICompatibleProvider): 

7 """OrcaRouter provider using OpenAI-compatible endpoint. 

8 

9 OrcaRouter is an OpenAI-compatible routing gateway that provides access 

10 to many upstream models through a unified API, automatically supporting 

11 current and future models without needing code updates. Models are 

12 addressed with a ``<vendor>/<model>`` namespace (e.g. ``openai/gpt-5``), 

13 and the virtual ``orcarouter/auto`` router selects an upstream per request. 

14 """ 

15 

16 provider_name = "OrcaRouter" 

17 api_key_setting = "llm.orcarouter.api_key" 

18 default_base_url = "https://api.orcarouter.ai/v1" 

19 default_model = "" # User must explicitly pick a model — no silent fallback 

20 

21 # Metadata for auto-discovery 

22 provider_key = "ORCAROUTER" 

23 company_name = "OrcaRouter" 

24 is_cloud = True 

25 

26 @classmethod 

27 def requires_auth_for_models(cls): 

28 """OrcaRouter needs a valid key to list models through this client. 

29 

30 ``GET /v1/models`` is open when sent with NO Authorization header, but 

31 returns 401 for an *invalid* token (verified live). The base class's 

32 no-auth path sends a placeholder key (``dummy-key-for-models-list``), 

33 which OrcaRouter would reject with 401 — so we require the real key 

34 (return True) and only list models once it is configured. This differs 

35 from OpenRouter, whose ``/models`` ignores the token entirely. 

36 """ 

37 return True