OpenAiNg 3.0.0-beta7

This is a prerelease version of OpenAiNg.
dotnet add package OpenAiNg --version 3.0.0-beta7
                    
NuGet\Install-Package OpenAiNg -Version 3.0.0-beta7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenAiNg" Version="3.0.0-beta7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenAiNg" Version="3.0.0-beta7" />
                    
Directory.Packages.props
<PackageReference Include="OpenAiNg" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenAiNg --version 3.0.0-beta7
                    
#r "nuget: OpenAiNg, 3.0.0-beta7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenAiNg@3.0.0-beta7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenAiNg&version=3.0.0-beta7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=OpenAiNg&version=3.0.0-beta7&prerelease
                    
Install as a Cake Tool

OpenAI

.NET SDK for accessing the OpenAI Compatible APIs such as GPT-4 Turbo, Assistants, and DALL-E 3

OpenAiNextGeneration is a simple .NET library to use with various OpenAI compatible providers, such as OpenAI, Azure OpenAI, and KoboldCpp ( v1.45.2+). Supports features such as function calling in conjunction with streaming, caches its own HttpClients.

Supported features compared to OpenAI-API-dotnet:

  • Assistants, threads, and messages support.
  • Includes new models.
  • Parallel function calling.
  • Improved memory usage, and function calling in conjunction with streaming.
  • Manages its pool of HttpClients.
  • Improved credentials passing.
  • Supports OpenAI-compatible API providers, such as KoboldCpp.
  • Improved Azure OpenAI integration.
  • Nullability annotations.
  • Calls are guaranteed not to throw, full response is included in the call result. (Fully supported in 3.0+)
  • Actively maintained, backed by a company I work for.

Features scheduled for open-sourcing:

  • High-level plugin API.
  • Approximate token counting for streaming & function calling.

⚡Getting Started

Install the library via NuGet:

Install-Package OpenAiNg

🔮 Quick Inference

var api = new OpenAiNg.OpenAiApi("YOUR_API_KEY");
var result = await api.Completions.GetCompletion("One Two Three One Two");
Console.WriteLine(result);
// should print something starting with "Three"

📖 Readme

Requirements

Unlike the original library, OpenAiNg supports only .NET Core >= 6.0, if you need .NET Standard 2.0 /.NET Framework support, please use OpenAI-API-DotNet.

Getting started

Install from NuGet

Install package OpenAiNg from Nuget. Here's how via the command line:

Install-Package OpenAiNg

Authentication

Pass keys directly to ApiAuthentication(string key) constructor.

You use the APIAuthentication when you initialize the API as shown:

// for example
var api = new OpenAiApi("YOUR_API_KEY"); // shorthand
// or
var api = new OpenAiApi(new APIAuthentication("YOUR_API_KEY")); // create object manually

You may optionally include an OpenAi Organization if multiple Organizations are under one account.

// for example
var api = new OpenAiApi(new ApiAuthentication("YOUR_API_KEY", "org-yourOrgHere"));

Documentation

Every single class, method, and property has extensive XML documentation, so it should show up automatically in IntelliSense. That combined with the official OpenAI documentation should be enough to get started. Feel free to open an issue here if you have any questions.

License

This library is licensed under MIT license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-beta7 185 4/21/2024
3.0.0-beta6 134 4/20/2024
3.0.0-beta5 111 4/20/2024
3.0.0-beta4 139 3/12/2024
3.0.0-beta3 123 3/10/2024
3.0.0-beta2 157 2/6/2024
3.0.0-beta1 163 1/29/2024
2.3.3 5,487 12/14/2023
2.3.2 210 12/3/2023
2.3.1 182 12/2/2023
2.3.0 171 12/1/2023
2.2.9 1,023 11/9/2023
2.2.8 161 11/8/2023
2.2.7 197 11/7/2023
2.2.6 167 11/7/2023
2.2.5 158 11/7/2023
2.2.4 214 10/8/2023
2.2.3 197 10/8/2023
2.2.2 198 10/8/2023
2.2.1 191 10/8/2023
2.2.0 202 10/8/2023

TTS endpoint