Soenneker.Azure.OpenAI.Client.Chat
11.0.1781
Prefix Reserved
dotnet add package Soenneker.Azure.OpenAI.Client.Chat --version 11.0.1781
NuGet\Install-Package Soenneker.Azure.OpenAI.Client.Chat -Version 11.0.1781
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.1781" />
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.1781" />
<PackageReference Include="Soenneker.Azure.OpenAI.Client.Chat" />
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.1781
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Azure.OpenAI.Client.Chat, 11.0.1781"
#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.1781
#: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.1781
#tool nuget:?package=Soenneker.Azure.OpenAI.Client.Chat&version=11.0.1781
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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:Deploymentis required unlessSetOptions(deployment)is called before the firstGet().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 | Versions 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.
-
net11.0
- Soenneker.Azure.OpenAI.Client (>= 11.0.1087)
- Soenneker.Extensions.String (>= 11.0.820)
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.1781 | 1,103 | 11/11/2026 |
| 11.0.1780 | 52 | 11/11/2026 |
| 11.0.1779 | 48 | 11/11/2026 |
| 11.0.1778 | 74 | 11/11/2026 |
| 11.0.1777 | 155 | 11/11/2026 |
| 11.0.1776 | 55 | 11/11/2026 |
| 11.0.1775 | 77 | 11/11/2026 |
| 11.0.1774 | 61 | 11/11/2026 |
| 11.0.1773 | 33,401 | 11/3/2026 |
| 11.0.1772 | 114 | 11/3/2026 |
| 11.0.1771 | 106 | 11/3/2026 |
| 11.0.1770 | 97 | 11/3/2026 |
| 11.0.1769 | 13,878 | 10/27/2026 |
| 11.0.1768 | 105 | 10/27/2026 |
| 11.0.1767 | 165 | 10/26/2026 |
| 11.0.1766 | 98 | 10/26/2026 |
| 11.0.1764 | 103 | 10/26/2026 |
| 11.0.1763 | 110 | 10/26/2026 |
| 11.0.1762 | 107 | 10/26/2026 |
| 11.0.1761 | 128 | 10/26/2026 |
Loading failed
Updated Multiple NuGet packages