Soenneker.Azure.OpenAI.Client.Chat 11.0.1788

Prefix Reserved
dotnet add package Soenneker.Azure.OpenAI.Client.Chat --version 11.0.1788
                    
NuGet\Install-Package Soenneker.Azure.OpenAI.Client.Chat -Version 11.0.1788
                    
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="Soenneker.Azure.OpenAI.Client.Chat" Version="11.0.1788" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Azure.OpenAI.Client.Chat" Version="11.0.1788" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Azure.OpenAI.Client.Chat" />
                    
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 Soenneker.Azure.OpenAI.Client.Chat --version 11.0.1788
                    
#r "nuget: Soenneker.Azure.OpenAI.Client.Chat, 11.0.1788"
                    
#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 Soenneker.Azure.OpenAI.Client.Chat@11.0.1788
                    
#: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=Soenneker.Azure.OpenAI.Client.Chat&version=11.0.1788
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Azure.OpenAI.Client.Chat&version=11.0.1788
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Azure.OpenAI.Client.Chat

Creates and caches an OpenAI SDK ChatClient for an Azure OpenAI deployment.

Installation

dotnet add package Soenneker.Azure.OpenAI.Client.Chat

Configuration and registration

{
  "Azure": {
    "OpenAI": {
      "Uri": "https://your-resource.openai.azure.com",
      "ApiKey": "your-api-key",
      "Chat": {
        "Deployment": "chat-deployment-name"
      }
    }
  }
}
using Soenneker.Azure.OpenAI.Client.Chat.Registrars;

builder.Services.AddAzureOpenAIChatClientAsSingleton();

The registrar includes the shared Azure OpenAI client. Keep the API key in a secret provider.

Complete a chat request

using OpenAI.Chat;
using Soenneker.Azure.OpenAI.Client.Chat.Abstract;

public sealed class ChatService(IAzureOpenAIChatClient chatClientUtil)
{
    public async Task<string> Complete(
        string prompt,
        CancellationToken cancellationToken)
    {
        ChatClient client = await chatClientUtil.Get(cancellationToken);

        ChatCompletion completion = await client.CompleteChatAsync(
            [new UserChatMessage(prompt)],
            options: null,
            cancellationToken: cancellationToken);

        return completion.Content[0].Text;
    }
}

Handle empty content and model finish reasons according to the requirements of the consuming application.

Deployment and lifecycle

  • Azure:OpenAI:Chat:Deployment is required unless SetOptions(deployment) is called before the first Get().
  • SetOptions() overrides configuration for that utility instance.
  • Calling SetOptions() after client creation throws; it does not silently change the cached deployment.
  • The chat client and underlying Azure client are cached. Replace the DI scope or singleton to switch deployments or credentials.
  • Prompts and completions may contain sensitive data. Apply appropriate logging, retention, content-safety, and access controls in the consuming application.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.1788 387 11/18/2026
11.0.1787 110 11/18/2026
11.0.1786 96 11/18/2026
11.0.1784 97 11/18/2026
11.0.1783 99 11/18/2026
11.0.1782 221 11/15/2026
11.0.1781 1,212 11/11/2026
11.0.1780 101 11/11/2026
11.0.1779 99 11/11/2026
11.0.1778 123 11/11/2026
11.0.1777 199 11/11/2026
11.0.1776 104 11/11/2026
11.0.1775 126 11/11/2026
11.0.1774 106 11/11/2026
11.0.1773 33,410 11/3/2026
11.0.1772 124 11/3/2026
11.0.1771 118 11/3/2026
11.0.1770 109 11/3/2026
11.0.1769 13,882 10/27/2026
11.0.1768 112 10/27/2026
Loading failed

Update dependency Soenneker.Azure.OpenAI.Client to 11.0.1092 (#2378)