OpenAI .NET
The official .NET library for the OpenAI API
OpenAI .NET is the official client library for calling the OpenAI REST API from C# and other .NET languages, with first-class support for modern .NET patterns. It provides strongly typed clients across API areas (chat, audio, images, embeddings, moderations, batches, files, models, vector stores, responses, realtime, assistants) and works with .NET Standard 2.0 while the examples use .NET 8. You install it via NuGet and authenticate with an API key, ideally through environment variables or configuration rather than hardcoding. Every synchronous method has an async counterpart, and the library offers convenient streaming primitives for chat completions so you can process tokens as they arrive. ...