From 641d61bc4486ae1b9f6f2d713d18311e2b4c53e7 Mon Sep 17 00:00:00 2001 From: Felix Wunderlich Date: Wed, 23 Sep 2026 23:58:36 +0200 Subject: [PATCH] Add Opper provider to the CLI Opper is an EU hosted OpenAI compatible gateway. One key reaches models from OpenAI, Anthropic, Google, Mistral, DeepSeek, Moonshot and open weight vendors at https://api.opper.ai/v3/compat. Mirrors the Requesty provider added in #624: an enum value, the endpoint and API key environment variable rows, and a matching HelpersTests case. The existing default branch already builds an OpenAI client against the endpoint, so no client code changes. --- src/Cli/src/Helpers.cs | 2 ++ src/Cli/src/Models/Provider.cs | 1 + .../test/LangChain.Cli.IntegrationTests/HelpersTests.cs | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/src/Cli/src/Helpers.cs b/src/Cli/src/Helpers.cs index 9d7a2eca..f17cb3ab 100644 --- a/src/Cli/src/Helpers.cs +++ b/src/Cli/src/Helpers.cs @@ -107,6 +107,7 @@ public static IChatClient GetChatModel( { Provider.Free or Provider.OpenRouter => new Uri(tryAGI.OpenAI.CustomProviders.OpenRouterBaseUrl), Provider.Requesty => new Uri("https://router.requesty.ai/v1"), + Provider.Opper => new Uri("https://api.opper.ai/v3/compat"), _ => null, }; @@ -115,6 +116,7 @@ public static IChatClient GetChatModel( Provider.OpenAi or null => "OPENAI_API_KEY", Provider.OpenRouter or Provider.Free => "OPENROUTER_API_KEY", Provider.Requesty => "REQUESTY_API_KEY", + Provider.Opper => "OPPER_API_KEY", _ => throw new NotImplementedException(), }; } diff --git a/src/Cli/src/Models/Provider.cs b/src/Cli/src/Models/Provider.cs index ee560002..154dbd78 100644 --- a/src/Cli/src/Models/Provider.cs +++ b/src/Cli/src/Models/Provider.cs @@ -5,6 +5,7 @@ internal enum Provider OpenAi, OpenRouter, Requesty, + Opper, Anthropic, Free, } \ No newline at end of file diff --git a/src/Cli/test/LangChain.Cli.IntegrationTests/HelpersTests.cs b/src/Cli/test/LangChain.Cli.IntegrationTests/HelpersTests.cs index 1c9abf04..e832d252 100644 --- a/src/Cli/test/LangChain.Cli.IntegrationTests/HelpersTests.cs +++ b/src/Cli/test/LangChain.Cli.IntegrationTests/HelpersTests.cs @@ -11,4 +11,11 @@ public void Requesty_UsesExpectedEndpointAndApiKeyEnvironmentVariable() Helpers.GetEndpoint(Provider.Requesty).Should().Be(new Uri("https://router.requesty.ai/v1")); Helpers.GetApiKeyEnvironmentVariable(Provider.Requesty).Should().Be("REQUESTY_API_KEY"); } + + [Test] + public void Opper_UsesExpectedEndpointAndApiKeyEnvironmentVariable() + { + Helpers.GetEndpoint(Provider.Opper).Should().Be(new Uri("https://api.opper.ai/v3/compat")); + Helpers.GetApiKeyEnvironmentVariable(Provider.Opper).Should().Be("OPPER_API_KEY"); + } }