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. It supports tool/function calling, structured outputs via JSON schema, audio input/output, image generation, embeddings, Whisper transcription, and assistants with retrieval augmented generation.

Features

  • Strongly typed clients for chat, audio, images, embeddings, moderations, files, models, batches, vector stores, realtime, responses, assistants
  • Async and streaming APIs for low-latency, token-by-token processing
  • Tool calling and structured outputs with JSON schema constraints
  • Audio input/output, Whisper transcription, and TTS support
  • DI-friendly design, OpenAIClient factory, and protocol methods for raw access
  • Built-in retries and testing support with model factories and virtual methods

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow OpenAI .NET

OpenAI .NET Web Site

Other Useful Business Software
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of OpenAI .NET!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

C#

Related Categories

C# Libraries

Registered

2025-10-04