Skip to content

Commit 6ee2867

Browse files
HavenDVclaude
andcommitted
feat: Add Nebius AI as a CustomProvider
Add Nebius AI Studio (https://api.studio.nebius.ai/v1/) as an OpenAI-compatible custom provider with test infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent df63e21 commit 6ee2867

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/libs/tryAGI.OpenAI/CustomProviders.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public static class CustomProviders
9191
/// </summary>
9292
public const string CerebrasBaseUrl = "https://api.cerebras.ai/v1";
9393

94+
/// <summary>
95+
/// https://docs.nebius.com/studio/inference/api
96+
/// </summary>
97+
public const string NebiusBaseUrl = "https://api.studio.nebius.ai/v1/";
98+
9499
/// <summary>
95100
/// Creates an API to use for GitHub Models: https://github.com/marketplace/models
96101
/// </summary>
@@ -252,4 +257,13 @@ public static OpenAiClient Cerebras(string apiKey)
252257
{
253258
return new OpenAiClient(apiKey, baseUri: new Uri(CerebrasBaseUrl));
254259
}
260+
261+
/// <summary>
262+
/// Create an API to use for Nebius AI Studio.
263+
/// </summary>
264+
/// <returns></returns>
265+
public static OpenAiClient Nebius(string apiKey)
266+
{
267+
return new OpenAiClient(apiKey, baseUri: new Uri(NebiusBaseUrl));
268+
}
255269
}

src/tests/OpenAI.IntegrationTests/CustomProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ public enum CustomProvider
2121
Hyperbolic,
2222
Cerebras,
2323
Cohere,
24+
Nebius,
2425
}

src/tests/OpenAI.IntegrationTests/Tests.Helpers.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ internal static (OpenAiClient Api, string Model) GetAuthorizedChatApi(CustomProv
164164
throw new AssertInconclusiveException("COHERE_API_KEY environment variable is not found.")),
165165
model ?? "command-r-08-2024");
166166
}
167+
if (customProvider == CustomProvider.Nebius)
168+
{
169+
return (CustomProviders.Nebius(apiKey:
170+
Environment.GetEnvironmentVariable("NEBIUS_API_KEY") ??
171+
throw new AssertInconclusiveException("NEBIUS_API_KEY environment variable is not found.")),
172+
model ?? "meta-llama/Meta-Llama-3.1-8B-Instruct");
173+
}
167174

168175
var apiKey =
169176
Environment.GetEnvironmentVariable("OPENAI_API_KEY") ??

0 commit comments

Comments
 (0)