Soenneker.Azure.OpenAI.Client
11.0.1087
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Azure.OpenAI.Client --version 11.0.1087
NuGet\Install-Package Soenneker.Azure.OpenAI.Client -Version 11.0.1087
<PackageReference Include="Soenneker.Azure.OpenAI.Client" Version="11.0.1087" />
<PackageVersion Include="Soenneker.Azure.OpenAI.Client" Version="11.0.1087" />
<PackageReference Include="Soenneker.Azure.OpenAI.Client" />
paket add Soenneker.Azure.OpenAI.Client --version 11.0.1087
#r "nuget: Soenneker.Azure.OpenAI.Client, 11.0.1087"
#:package Soenneker.Azure.OpenAI.Client@11.0.1087
#addin nuget:?package=Soenneker.Azure.OpenAI.Client&version=11.0.1087
#tool nuget:?package=Soenneker.Azure.OpenAI.Client&version=11.0.1087
Soenneker.Azure.OpenAI.Client
Creates and caches an API-key-authenticated AzureOpenAIClient for dependency-injected applications.
Installation
dotnet add package Soenneker.Azure.OpenAI.Client
Configuration
{
"Azure": {
"OpenAI": {
"Uri": "https://your-resource.openai.azure.com",
"ApiKey": "your-api-key"
}
}
}
The endpoint must be an absolute HTTPS URI. Store the API key in a secret provider or environment variable, not source-controlled configuration.
Registration and use
using Azure.AI.OpenAI;
using Soenneker.Azure.OpenAI.Client.Abstract;
using Soenneker.Azure.OpenAI.Client.Registrars;
builder.Services.AddAzureOpenAIClientUtilAsSingleton();
public sealed class AzureOpenAIService(IAzureOpenAIClientUtil clientUtil)
{
public ValueTask<AzureOpenAIClient> GetClient(
CancellationToken cancellationToken) =>
clientUtil.Get(cancellationToken);
}
Use the returned Azure client to obtain deployment-specific chat, audio, embedding, or other clients supported by the Azure/OpenAI SDK.
Client options and lifecycle
Call SetOptions() before the first Get() when custom AzureOpenAIClientOptions are required:
clientUtil.SetOptions(new AzureOpenAIClientOptions());
AzureOpenAIClient client = await clientUtil.Get(cancellationToken);
- The first successful
Get()creates the client; later calls return the same instance. SetOptions()after creation throws because a cached client cannot be reconfigured.- Endpoint, API key, and options changes require replacing the utility instance.
- Missing configuration or a non-HTTPS endpoint fails initialization.
- Let the DI container dispose registered instances.
For deployment-specific wrappers, see Soenneker.Azure.OpenAI.Client.Chat and Soenneker.Azure.OpenAI.Client.Audio.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Azure.AI.OpenAI (>= 2.1.0)
- Soenneker.Extensions.Configuration (>= 11.0.917)
- Soenneker.Utils.AsyncSingleton (>= 11.0.893)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Azure.OpenAI.Client:
| Package | Downloads |
|---|---|
|
Soenneker.Azure.OpenAI.Client.Chat
An async thread-safe singleton for the Azure OpenAI Chat (completions) client |
|
|
Soenneker.Azure.OpenAI.Client.Audio
An async thread-safe singleton for the Azure OpenAI audio client |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.1102 | 0 | 12/2/2026 |
| 11.0.1101 | 589 | 12/1/2026 |
| 11.0.1100 | 60 | 12/1/2026 |
| 11.0.1099 | 76 | 12/1/2026 |
| 11.0.1098 | 71 | 11/30/2026 |
| 11.0.1096 | 70 | 11/30/2026 |
| 11.0.1095 | 133 | 11/29/2026 |
| 11.0.1094 | 89 | 11/29/2026 |
| 11.0.1093 | 93 | 11/29/2026 |
| 11.0.1092 | 570 | 11/18/2026 |
| 11.0.1088 | 177 | 11/18/2026 |
| 11.0.1087 | 1,594 | 11/11/2026 |
| 11.0.1086 | 259 | 11/11/2026 |
| 11.0.1085 | 121 | 11/11/2026 |
| 11.0.1084 | 118 | 11/11/2026 |
| 11.0.1083 | 145 | 11/11/2026 |
| 11.0.1082 | 173 | 11/10/2026 |
| 11.0.1081 | 33,456 | 11/3/2026 |
| 11.0.1080 | 14,135 | 10/27/2026 |
| 11.0.1079 | 267 | 10/26/2026 |
Updated Soenneker.Utils.AsyncSingleton to 11.0.893