XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

feat(provider): add OrcaRouter as a named provider

Adds a dedicated OrcaRouter provider mirroring the OpenRouter wiring. OrcaRouter is an OpenAI-compatible gateway exposing 150+ models behind one API key (sk-orca- prefix) at https://api.orcarouter.ai/v1, with gateway-level security controls for AI agents.

467d9018
XiaoHuo888 <sjh00112233@outlook.com>
提交于

代码差异

4 个文件 +29 -0
Modified example.env +1 -0
@@ -17,6 +17,7 @@ OPENAI_API_KEY=
17 17 GROQ_API_KEY=
18 18 OPENROUTER_API_KEY=
19 19 OPENROUTERFREE_API_KEY=
20 ORCAROUTER_API_KEY=
20 21 OLLAMA_API_KEY=
21 22 NVIDIA_API_KEY=
22 23 PUTER_API_KEY=
Modified g4f/Provider/__init__.py +5 -0
@@ -235,6 +235,10 @@ def _resolve_provider(name: str) -> ProviderType:
235 235 from g4f.Provider.needs_auth.OpenRouter import OpenRouter
236 236
237 237 return OpenRouter
238 elif name == "OrcaRouter":
239 from g4f.Provider.needs_auth.OrcaRouter import OrcaRouter
240
241 return OrcaRouter
238 242 elif name == "OpenaiAPI":
239 243 from g4f.Provider.needs_auth.OpenaiAPI import OpenaiAPI
240 244
@@ -406,6 +410,7 @@ _provider_names = [
406 410 "OpenAIFM",
407 411 "OpenRouter",
408 412 "OpenRouterFree",
413 "OrcaRouter",
409 414 "OpenaiAPI",
410 415 "OpenaiAccount",
411 416 "OpenaiChat",
Added g4f/Provider/needs_auth/OrcaRouter.py +22 -0
@@ -0,0 +1,22 @@
1 from __future__ import annotations
2
3 from ..template import OpenaiTemplate
4
5
6 class OrcaRouter(OpenaiTemplate):
7 label = "OrcaRouter"
8 url = "https://www.orcarouter.ai"
9 login_url = "https://www.orcarouter.ai"
10 base_url = "https://api.orcarouter.ai/v1"
11 working = True
12 needs_auth = True
13 default_model = "orcarouter/auto"
14
15 @classmethod
16 def get_headers(
17 cls, stream: bool, api_key: str = None, headers: dict = None
18 ) -> dict:
19 return {
20 **super().get_headers(stream, api_key, headers),
21 **({"Authorization": f"Bearer {api_key}"} if api_key else {}),
22 }
Modified g4f/Provider/needs_auth/__init__.py +1 -0
@@ -33,6 +33,7 @@ from .OpenaiAPI import OpenaiAPI
33 33 from .OpenaiChat import OpenaiChat
34 34 from .OpenRouter import OpenRouter
35 35 from .OpenRouter import OpenRouterFree
36 from .OrcaRouter import OrcaRouter
36 37 from .PerplexityApi import PerplexityApi
37 38 from .Pi import Pi
38 39 from .Puter import Puter