

OpenAIAPI api = new OpenAIAPI(new APIAuthentication("YOUR_API_KEY","org-yourOrgHere")) Organization IDs can be found on your Organization settings page. Usage from these API requests will count against the specified organization's subscription quota. You may optionally include an openAIOrganization (OPENAI_ORGANIZATION in env or config file) specifying which organization is used for an API request. OpenAIAPI api = new OpenAIAPI() // uses default, env, or config file

OpenAIAPI api = new OpenAIAPI(APIAuthentication LoadFromPath()) // use config file (can optionally specify where to look) OpenAIAPI api = new OpenAIAPI(APIAuthentication LoadFromEnv()) // use env vars OpenAIAPI api = new OpenAIAPI(new APIAuthentication("YOUR_API_KEY")) // create object manually OpenAIAPI api = new OpenAIAPI("YOUR_API_KEY") // shorthand You use the APIAuthentication when you initialize the API as shown: // for example Include a config file in the local directory or in your user directory named.Set environment var for OPENAI_API_KEY (or OPENAI_KEY for backwards compatibility).Pass keys directly to APIAuthentication(string key) constructor.There are 3 ways to provide your API keys, in order of precedence: Here's how via commandline: Install-Package OpenAI It should work across Windows, Linux, and Mac, although I have only tested on Windows so far. It should work across console apps, winforms, wpf, asp.net, etc (although I have not yet tested with asp.net). NET Standard 2.0, so it should work across. Thank you and for your contributions! Requirements See the Azure section for further details.

Should work with the Azure OpenAI Service. should print something starting with "Three"Īdded support for GPT4, streaming conversations with ChatGPT, and supporting IHttpClientFactory. Var result = await ("One Two Three One Two") Quick Example var api = new OpenAI_API.OpenAIAPI("YOUR_API_KEY") I am not affiliated with OpenAI and this library is not endorsed or supported by them. This is an unofficial wrapper library around the OpenAI API.

NET wrapper library to use with OpenAI's GPT-3 API. C#/.NET SDK for accessing the OpenAI GPT-3 API, ChatGPT, and DALL-E 2Ī simple C#.
